Detailed equations of motion for the ballbot.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
// Autolev results for the Ballbot with Lagrange's method 
// Date:  May 2016
// Author:  Firat Yavuz
// Supervisor: Prof. Mustafa Unel 
// Problem:  Kinematics / Dynamics of Ballbot 
/* The name of this program is bb_Lagrange.c */
/* Created by Autolev 4.1 on Thu May 9 10:50:38 2016 */

/*Constants MA     	% Mass of body and omniwheels
Constants MK    	% Mass of ball
Constants MW     	% Mass of each omniwheel
Constants rK    	% Radius of the ball
Constants rW    	% Radius of the Omniwheel
Constants rA 	    % Radius of the body
Constants l     	% Distance between center of the ball an center of gravity of the body
Constants g         % Gravitational acceleration
Constants IK    	% Inertia of ball in the intertial reference frame I or L
Constants IAX   	% Inertia of body and omniwheels in the body reference frame A
Constants IAY   	% Inertia of body and omniwheels in the body reference frame A
Constants IAZ   	% Inertia of body and omniwheels in the body reference frame A
Constants IW    	% Inertia of each omniwheel and motor (gear ratio!) about the motor axis
Specified T{3} 	   	% Declares T as a func of time, constants and variables
Specified Td{3}		% Disturbance force acting on body 
*/

#include <ctype.h> 
#include <math.h>  
#include <stdarg.h>
#include <stdio.h> 
#include <stdlib.h>
#include <string.h>

void     eqns1     (void);
void     output    (FILE *Fptr[] );
void     readf     (FILE *Fp, double *next, ...);
void     pgets     (FILE *Fp, double *x);
void     writef    (FILE *Fp, char format[], ...);

double   rK,rW,theta1,theta2,theta3,phi1p,phi2p,theta1p,theta2p,theta3p;
double   T1,T2,T3,Td1,Td2,Td3;
double   q1p,q2p,q3p,phi1pp,phi2pp,q1pp,q2pp,q3pp,theta1pp,theta2pp,theta3pp,abx,
  aby,abz,q1d,q1dd,q2d,q2dd,q3d,q3dd,wbx,wby,wbz;
double   Pi,DEGtoRAD,RADtoDEG,z[452],Encode[17];

/* ................................ MAIN ............................. */
int      main         (void)
{
FILE     *Fptr[1];
int      iloop;

/* Open input and output files */
for(iloop=0;  iloop<=0;  iloop++)
  {
  char fileName[256];
  if( !iloop ) strcpy(fileName, "bb_Lagrange.in");
  else sprintf(fileName, "bb_Lagrange.%d", iloop);
  if( (Fptr[iloop] = fopen(fileName, iloop ? "w" : "r")) == NULL)
    {printf("Error: unable to open file %s\n", fileName);  exit(0);}
  }

/* Read top of input file */
for(iloop=0;  iloop<6;  iloop++) pgets(Fptr[0],NULL);

/* Read values of constants from input file */
readf(Fptr[0],&rK,&rW,&theta1,&theta2,&theta3,&phi1p,&phi2p,&theta1p,&theta2p,&
  theta3p,NULL);

/* Write heading(s) to output file(s) */

/* Unit conversions */
  Pi       = 3.141592653589793;
  DEGtoRAD = Pi/180.0;
  RADtoDEG = 180.0/Pi;

/* Evaluate output quantities */
eqns1();
output( Fptr );

/* Inform user of input and output filename(s) */
puts( "\n Input is in the file bb_Lagrange.in" );
return 0;
}

/* ................................ EQNS1 ............................. */
void     eqns1        (void)
{

/* Evaluate constants */
  z[5] = cos(theta1);
  z[3] = cos(theta2);
  z[4] = sin(theta2);
  z[12] = pow(z[3],2) + pow(z[4],2);
  z[19] = z[5]*z[12];
  z[6] = sin(theta1);
  z[22] = z[6]*z[12];
  z[339] = 0.0006716339689125586*z[19]*z[22] + 0.1191650249844773*pow(z[22],2) + 
  3.150188444402258*pow(z[19],2) + 0.007467354584049426*pow((z[19]-1.376118514983941*
  z[22]),2) + 0.007467354584049426*pow((z[19]+1.376118514983941*z[22]),2) + 
  0.004012971037204967*(z[22]+1.032088886237957*z[19])*(z[22]+1.18835843455651*
  z[19]) + 0.008360356327510346*(z[22]+1.52308996522828*z[19])*(z[22]+1.758770483143635*
  z[19]) + 0.003362218977117674*(1.032088886237957*z[19]-z[22])*(1.23184802550982*
  z[19]-z[22]) + 0.008360356327510341*(1.032088886237957*z[19]-z[22])*(1.032088886237958*
  z[19]-z[22]);
  z[1] = cos(theta3);
  z[2] = sin(theta3);
  z[13] = pow(z[1],2) + pow(z[2],2);
  z[18] = z[4]*z[13];
  z[16] = z[3]*z[6];
  z[20] = z[13]*z[16];
  z[17] = z[3]*z[5];
  z[21] = z[13]*z[17];
  z[73] = 0.5566703992264194*z[16] - 0.7660444431189779*z[17] - 0.3213938048432695*
  z[4];
  z[65] = -0.7660444431189779*z[17] - 0.5566703992264194*z[16] - 0.3213938048432695*
  z[4];
  z[58] = 0.6427876096865393*z[4] - 0.766044443118978*z[17];
  z[345] = 0.002467968435692828*z[18]*z[20] + 0.0239*pow(z[13],2) + 0.09601297103720496*
  pow(z[21],2) + 3.115758693954735*pow(z[18],2) + 3.136753363323185*pow(z[20],
  2) + 0.0060243545846018*pow((z[20]+1.732050807568878*z[18]),2) + 0.009956472778732566*
  pow((z[18]-1.19175359259421*z[21]),2) + 0.006024354584601798*pow((1.732050807568878*
  z[18]-z[20]),2) + 0.002489118194683139*pow((z[18]+1.732050807568878*z[20]+
  2.383507185188421*z[21]),2) + 0.00248911819468314*pow((1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18]),2) + 0.001424882240698758*(z[18]-1.732050807568878*
  z[20])*(z[18]-1.732050807568878*z[20]-1.67819926235456*z[21]) + 0.001640625*(
  z[18]-1.732050807568878*z[20]-1.67819926235456*z[21])*(1.732050807568878*
  z[13]*z[16]-1.457515474458067*z[21]-1.285575219373078*z[13]*z[73]-z[4]*
  z[13]) + 0.008489328299801381*(1.032088886237957*z[20]-z[21])*(1.281675562640063*
  z[18]+1.504285522708015*z[20]-1.457515474458068*z[21]-1.732050807568878*
  z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13]) + 0.007374101413072466*(
  1.555723826860413*z[4]*z[13]-1.351145601417332*z[18]-1.133745775816087*
  z[21]-z[13]*z[58])*(2.030853223771491*z[4]*z[13]-1.763795317039432*z[18]-
  z[21]-1.305407289332279*z[13]*z[58]) + 0.005824520184225059*(z[18]-1.732050807568878*
  z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13])*(1.281675562640063*
  z[18]+1.504285522708015*z[20]-1.457515474458068*z[21]-1.732050807568878*
  z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13]) + 0.002968504668122412*(
  z[18]+1.994302248285554*z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*
  z[21]-1.480225371641685*z[13]*z[73]-1.15141093989314*z[4]*z[13])*(z[18]+
  2.951567327462619*z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*
  z[21]-2.190733550029694*z[13]*z[73]-1.704088191041847*z[4]*z[13]) - 0.001640624999999999*
  z[13]*z[18]*(z[4]+1.285575219373079*z[65]+1.732050807568878*z[16]) - 0.002391236325282797*
  z[21]*(2.302821879786252*z[4]*z[13]-z[18]-1.480225371641668*z[13]*z[58]);
  z[340] = 0.006134222092766571*z[20]*z[22] + 3.160544073798535*z[19]*z[20] + 
  0.007467354584049424*(z[19]-1.376118514983941*z[22])*(z[20]+1.376118514983941*
  z[21]) + 0.001195618162641383*(z[22]+1.523089965228279*z[19])*(z[18]+1.732050807568878*
  z[20]-1.67819926235456*z[21]) + 0.009684946462442765*(z[22]+1.52308996522828*
  z[19])*(z[18]+1.104755952575599*z[20]-1.070407759744918*z[21]) + 0.01091367009134725*
  z[22]*(1.555723826860412*z[4]*z[13]-12.52266088101976*z[21]-1.132040909295605*
  z[18]-z[13]*z[58]) - 0.006134222092766581*z[19]*z[21] - 0.002467968435692837*
  z[18]*z[19] - 0.008489328299801383*z[13]*(z[22]+1.52308996522828*z[19])*(
  z[4]+1.285575219373079*z[65]+1.732050807568878*z[16]) - 0.004981742344339096*(
  1.032088886237957*z[19]-z[22])*(z[18]+2.951567327462619*z[13]*z[16]-1.732050807568878*
  z[20]-1.678199262354559*z[21]-2.190733550029694*z[13]*z[73]-1.704088191041847*
  z[4]*z[13]);
  z[344] = 3.163736781660488*z[19]*z[20] + 0.01091367009134725*z[13]*z[22]*(
  1.555723826860412*z[4]-z[58]) + 0.004311279179235319*(z[18]+2.383507185188421*
  z[21])*(z[19]-1.376118514983941*z[22]) + 0.002711466917030383*(z[22]+1.032088886237957*
  z[19])*(1.301447474108356*z[18]+1.527491551632176*z[20]-z[21]-1.758770483143635*
  z[13]*z[16]-1.305407289332279*z[13]*z[65]-1.015426611885745*z[4]*z[13]) + 
  0.005736032635000932*(z[22]+1.758770483143635*z[19])*(1.281675562640063*
  z[18]+1.504285522708015*z[20]-1.457515474458068*z[21]-1.732050807568878*
  z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13]) - 0.1198157770445645*
  z[21]*z[22] - 0.002880295135622764*z[18]*z[22] - 0.001343267937825107*z[19]*
  z[21] - 0.00431127917923532*(z[18]+2.38350718518842*z[21])*(z[19]+1.376118514983941*
  z[22]) - 0.004981742344339095*(1.032088886237958*z[19]-z[22])*(z[18]+1.994302248285554*
  z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*z[21]-1.480225371641685*
  z[13]*z[73]-1.15141093989314*z[4]*z[13]) - 0.002391236325282767*(1.032088886237957*
  z[19]-z[22])*(z[18]+1.994302248285554*z[13]*z[16]-1.732050807568878*z[20]-
  1.678199262354559*z[21]-1.480225371641685*z[13]*z[73]-1.15141093989314*z[4]*
  z[13]);
  z[383] = z[339]*z[345] - z[340]*z[344];
  z[11] = pow(z[5],2) + pow(z[6],2);
  z[14] = z[4]*z[6];
  z[15] = z[4]*z[5];
  z[68] = 0.3213938048432695*z[3] + 0.5566703992264194*z[14] - 0.7660444431189779*
  z[15];
  z[60] = 0.3213938048432695*z[3] - 0.7660444431189779*z[15] - 0.5566703992264194*
  z[14];
  z[61] = -0.8660254037844386*z[3] - 0.4999999999999997*z[14];
  z[152] = z[2]*z[61] - 0.4999999999999997*z[1]*z[5];
  z[69] = 0.8660254037844386*z[3] - 0.4999999999999998*z[14];
  z[158] = z[2]*z[69] - 0.4999999999999998*z[1]*z[5];
  z[63] = 0.7660444431189779*z[6] - 0.5566703992264194*z[5];
  z[151] = z[1]*z[63] + z[2]*z[60];
  z[71] = 0.5566703992264194*z[5] + 0.7660444431189779*z[6];
  z[154] = z[1]*z[68] - z[2]*z[71];
  z[50] = z[1]*z[5] + z[2]*z[14];
  z[56] = -0.766044443118978*z[15] - 0.6427876096865393*z[3];
  z[47] = z[1]*z[14] - z[2]*z[5];
  z[157] = z[1]*z[71] + z[2]*z[68];
  z[148] = z[1]*z[60] - z[2]*z[63];
  z[155] = z[1]*z[69] + 0.4999999999999998*z[2]*z[5];
  z[149] = z[1]*z[61] + 0.4999999999999997*z[2]*z[5];
  z[323] = z[11]*(z[14]+1.560168553385352*z[68]+2.302395752353911*z[60]+
  1.496156408822901*z[1]*z[152]+1.496156408822902*z[1]*z[158]+4.031532153232987*
  z[1]*z[151]+4.031532153232988*z[2]*z[154]+112.2623863799929*z[1]*z[50]-
  7.858924446449426*z[3]-3.120337106770705*z[56]-112.2623863799929*z[2]*z[47]-
  4.031532153232988*z[1]*z[157]-4.031532153232987*z[2]*z[148]-1.496156408822902*
  z[2]*z[155]-1.496156408822901*z[2]*z[149]);
  z[332] = z[11]*(2.390316901299647*z[6]-2.302395752353911*z[63]-1.560168553385352*
  z[71]-z[5]-1.496156408822901*z[1]*(2.694592710667723*z[154]-75.03385723442858*
  z[47]-2.694592710667723*z[148]-z[149]-z[155])-1.496156408822901*z[2]*(
  2.694592710667723*z[157]-75.03385723442858*z[50]-2.694592710667723*z[151]-
  z[152]-z[158]));
  z[46] = z[1]*z[3];
  z[49] = z[2]*z[3];
  z[48] = z[1]*z[15] + z[2]*z[6];
  z[51] = z[2]*z[15] - z[1]*z[6];
  z[322] = 0.007374101413072465*z[6]*(z[56]+1.555723826860413*z[3]) + 0.007487858813578057*(
  1.347296355333861*z[5]-z[71])*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68]) - 0.007487858813578056*(z[63]+1.347296355333861*z[5])*(z[3]-1.732050807568878*
  z[14]-1.285575219373079*z[60]) - 0.14375*z[1]*(z[46]*(z[1]*z[49]-z[2]*z[46])+
  z[47]*(z[1]*z[50]-z[2]*z[47])+z[48]*(z[1]*z[51]-z[2]*z[48])) - 0.14375*z[2]*(
  z[49]*(z[1]*z[49]-z[2]*z[46])+z[50]*(z[1]*z[50]-z[2]*z[47])+z[51]*(z[1]*
  z[51]-z[2]*z[48]));
  z[333] = pow(z[11],2);
  z[407] = 1.737446941671211E-05*z[323]*z[332] + 3.196271610358775*z[322]*
  z[333];
  z[343] = z[11]*(1.032088886237958*z[20]+911.2454123558392*z[18]+3.708078919490628*
  z[13]*z[58]-z[21]-9.339219152480537*z[4]*z[13]-2.736071411996854*z[13]*
  z[65]-1.854039459745313*z[13]*z[73]-1.188358434556511*z[13]*z[16]);
  z[338] = z[11]*(z[22]+2.555178851466242*z[19]);
  z[387] = 0.003507585955462279*z[339]*z[343] - 0.003507585955462276*z[338]*
  z[344];
  z[144] = z[1]*z[56] - 0.766044443118978*z[2]*z[6];
  z[146] = z[2]*z[56] + 0.766044443118978*z[1]*z[6];
  z[325] = 0.01486446347400122*z[2]*z[21]*z[47] + 0.01940417897097459*z[2]*
  z[20]*z[144] + 0.4679398648787442*z[2]*z[18]*z[47] + 0.4804126306974268*
  z[2]*z[20]*z[46] + 0.009702089485487295*z[1]*z[157]*(z[20]+1.732050807568878*
  z[18]) + 0.005058593749999997*z[18]*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68]) + 0.009702089485487293*z[2]*z[148]*(1.732050807568878*z[18]-z[20]) + 
  0.006236382909341283*z[2]*z[149]*(z[18]+1.732050807568878*z[20]+2.383507185188421*
  z[21]) + 0.01091367009134725*(z[21]+1.191753592594211*z[18])*(z[56]+1.555723826860413*
  z[3]) + 0.006236382909341284*z[1]*z[158]*(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18]) + 0.007465145184225056*(z[18]+1.173686669666548*z[20])*(z[3]-
  1.732050807568878*z[14]-1.285575219373079*z[60]) + 0.00582452018422506*(
  z[3]+1.732050807568878*z[14]-1.285575219373079*z[68])*(1.732050807568878*
  z[13]*z[16]-1.504285522708014*z[20]-1.457515474458067*z[21]-1.285575219373078*
  z[13]*z[73]-z[4]*z[13]) - 0.4804126306974268*z[1]*z[20]*z[49] - 0.4679398648787442*
  z[1]*z[18]*z[50] - 0.01940417897097459*z[1]*z[20]*z[146] - 0.01486446347400122*
  z[1]*z[21]*z[50] - 0.009702089485487295*z[2]*z[154]*(z[20]+1.732050807568878*
  z[18]) - 0.009702089485487293*z[1]*z[151]*(1.732050807568878*z[18]-z[20]) - 
  0.008489328299801379*z[21]*(z[3]-1.732050807568878*z[14]-1.285575219373079*
  z[60]) - 0.006236382909341283*z[1]*z[152]*(z[18]+1.732050807568878*z[20]+
  2.383507185188421*z[21]) - 0.006236382909341284*z[2]*z[155]*(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18]) - 0.009626205736900255*z[13]*(z[56]+
  1.555723826860413*z[3])*(1.555723826860413*z[4]-z[58]) - 0.005824520184225059*
  z[13]*(z[3]-1.732050807568878*z[14]-1.285575219373079*z[60])*(z[4]+1.285575219373079*
  z[65]+1.732050807568878*z[16]);
  z[335] = z[11]*(1.032088886237964*z[20]+911.2454123558437*z[18]+3.708078919490647*
  z[13]*z[58]-z[21]-9.339219152480583*z[4]*z[13]-2.736071411996867*z[13]*
  z[65]-1.854039459745321*z[13]*z[73]-1.188358434556518*z[13]*z[16]);
  z[409] = 0.004168269355105558*z[325]*z[332] - 0.003507585955462262*z[322]*
  z[335];
  z[337] = 0.009702089485487293*z[1]*(2*z[19]*z[144]+49.51640895665247*z[19]*
  z[46]+1.113340798452839*z[149]*(z[19]-1.376118514983941*z[22])-1.532088886237957*
  z[22]*z[47]-z[19]*z[148]-z[19]*z[154]-1.113340798452839*z[155]*(z[19]+
  1.376118514983941*z[22])) + 0.009702089485487293*z[2]*(2*z[19]*z[146]+
  49.51640895665247*z[19]*z[49]+1.113340798452839*z[152]*(z[19]-1.376118514983941*
  z[22])-1.532088886237957*z[22]*z[50]-z[19]*z[151]-z[19]*z[157]-1.113340798452839*
  z[158]*(z[19]+1.376118514983941*z[22])) - 0.00836035632751035*z[6]*z[22] - 
  0.01091367009134725*(z[22]+1.52308996522828*z[19])*(z[63]+1.347296355333861*
  z[5]) - 0.01091367009134725*(1.032088886237957*z[19]-z[22])*(1.347296355333861*
  z[5]-z[71]);
  z[342] = 0.006503202769875534*(1.347296355333861*z[5]-z[71])*(z[18]+1.994302248285554*
  z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*z[21]-1.480225371641685*
  z[13]*z[73]-1.15141093989314*z[4]*z[13]) + 0.006236382909341283*z[1]*(
  2.38350718518842*z[21]*z[47]+3.111447653720826*z[20]*z[144]+75.03385723442858*
  z[18]*z[47]+77.03385723442858*z[20]*z[46]+1.555723826860412*z[148]*(1.732050807568878*
  z[18]-z[20])+z[149]*(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])-
  1.555723826860413*z[154]*(z[20]+1.732050807568878*z[18])-z[155]*(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])) + 0.006236382909341283*z[2]*(2.38350718518842*
  z[21]*z[50]+3.111447653720826*z[20]*z[146]+75.03385723442858*z[18]*z[50]+
  77.03385723442858*z[20]*z[49]+1.555723826860412*z[151]*(1.732050807568878*
  z[18]-z[20])+z[152]*(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])-
  1.555723826860413*z[157]*(z[20]+1.732050807568878*z[18])-z[158]*(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])) - 0.007374101413072466*z[6]*(1.555723826860413*
  z[4]*z[13]-1.351145601417332*z[18]-1.133745775816087*z[21]-z[13]*z[58]) - 
  0.007487858813578057*(z[63]+1.347296355333861*z[5])*(1.281675562640063*
  z[18]+1.504285522708015*z[20]-1.457515474458068*z[21]-1.732050807568878*
  z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13]);
  z[389] = z[337]*z[345] - z[340]*z[342];
  z[324] = 0.01126387760934708*z[19]*z[68] + 0.009702089485487292*z[1]*z[19]*
  z[151] + 0.009702089485487295*z[1]*z[19]*z[157] + 0.01486446347400122*z[1]*
  z[22]*z[50] + 0.01940417897097459*z[2]*z[19]*z[144] + 0.4804126306974268*
  z[2]*z[19]*z[46] + 0.01080173205443332*z[2]*z[149]*(z[19]-1.376118514983941*
  z[22]) + 0.01080173205443332*z[1]*z[158]*(z[19]+1.376118514983941*z[22]) + 
  0.004168269355105557*z[19]*(z[3]-9.013624984828686*z[14]-3.987866422207747*
  z[60]) - 0.01091367009134725*z[22]*z[56] - 0.01091367009134724*z[22]*z[60] - 
  0.01091367009134724*z[22]*z[68] - 0.4804126306974268*z[1]*z[19]*z[49] - 
  0.01940417897097459*z[1]*z[19]*z[146] - 0.01486446347400122*z[2]*z[22]*
  z[47] - 0.009702089485487295*z[2]*z[19]*z[154] - 0.009702089485487292*z[2]*
  z[19]*z[148] - 0.01080173205443332*z[2]*z[155]*(z[19]+1.376118514983941*
  z[22]) - 0.01080173205443332*z[1]*z[152]*(z[19]-1.376118514983941*z[22]);
  z[334] = z[11]*(z[22]+2.555178851466256*z[19]);
  z[410] = -3.196271610358775*z[324]*z[333] - 1.462056304855198E-05*z[323]*
  z[334];
  z[393] = 0.003507585955462276*z[338]*z[342] - 0.003507585955462279*z[337]*
  z[343];
  z[412] = 0.003507585955462257*z[325]*z[334] - 0.003507585955462262*z[324]*
  z[335];
  z[385] = 0.003507585955462279*z[340]*z[343] - 0.003507585955462276*z[338]*
  z[345];
  z[408] = 0.004168269355105558*z[324]*z[332] - 0.003507585955462257*z[322]*
  z[334];
  z[391] = z[337]*z[344] - z[339]*z[342];
  z[411] = -3.196271610358775*z[325]*z[333] - 1.4620563048552E-05*z[323]*
  z[335];
  z[413] = z[383]*z[407] + z[387]*z[409] + z[389]*z[410] + z[393]*z[412] - 
  z[385]*z[408] - z[391]*z[411];
  z[331] = z[11]*(3.120337106770704*z[56]+7.858924446449423*z[3]+1.496156408822901*
  z[1]*(2.694592710667723*z[157]-75.03385723442858*z[50]-2.694592710667723*
  z[151]-z[152]-z[158])-2.30239575235391*z[60]-1.560168553385351*z[68]-z[14]-
  1.496156408822901*z[2]*(2.694592710667723*z[154]-75.03385723442858*z[47]-
  2.694592710667723*z[148]-z[149]-z[155]));
  z[321] = 0.10655625*pow(z[1],2) + 0.10655625*pow(z[2],2) + 0.009626205736900253*
  pow((z[56]+1.555723826860413*z[3]),2) + 0.005824520184225058*pow((z[3]-
  1.732050807568878*z[14]-1.285575219373079*z[60]),2) + 0.00582452018422506*
  pow((z[3]+1.732050807568878*z[14]-1.285575219373079*z[68]),2) + 0.14375*
  z[2]*(z[2]*pow(z[46],2)+z[2]*pow(z[48],2)-z[47]*(2*z[1]*z[50]-z[2]*z[47])) + 
  0.14375*z[1]*(z[1]*pow(z[50],2)+z[49]*(z[1]*z[49]-2*z[2]*z[46])+z[51]*(z[1]*
  z[51]-2*z[2]*z[48]));
  z[414] = 1.737446941671212E-05*z[323]*z[331] + 3.196271610358775*z[321]*
  z[333];
  z[416] = 0.00416826935510556*z[325]*z[331] - 0.003507585955462262*z[321]*
  z[335];
  z[336] = 0.008489328299801381*(z[22]+1.52308996522828*z[19])*(z[3]-1.732050807568878*
  z[14]-1.285575219373079*z[60]) + 0.009702089485487293*z[2]*(2*z[19]*z[144]+
  49.51640895665247*z[19]*z[46]+1.113340798452839*z[149]*(z[19]-1.376118514983941*
  z[22])-1.532088886237957*z[22]*z[47]-z[19]*z[148]-z[19]*z[154]-1.113340798452839*
  z[155]*(z[19]+1.376118514983941*z[22])) - 0.01091367009134725*z[22]*(z[56]+
  1.555723826860413*z[3]) - 0.008489328299801379*(1.032088886237957*z[19]-
  z[22])*(z[3]+1.732050807568878*z[14]-1.285575219373079*z[68]) - 0.009702089485487293*
  z[1]*(2*z[19]*z[146]+49.51640895665247*z[19]*z[49]+1.113340798452839*z[152]*(
  z[19]-1.376118514983941*z[22])-1.532088886237957*z[22]*z[50]-z[19]*z[151]-
  z[19]*z[157]-1.113340798452839*z[158]*(z[19]+1.376118514983941*z[22]));
  z[341] = 0.005058593749999999*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68])*(z[18]+1.994302248285554*z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*
  z[21]-1.480225371641685*z[13]*z[73]-1.15141093989314*z[4]*z[13]) + 0.005824520184225059*(
  z[3]-1.732050807568878*z[14]-1.285575219373079*z[60])*(1.281675562640063*
  z[18]+1.504285522708015*z[20]-1.457515474458068*z[21]-1.732050807568878*
  z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13]) + 0.006236382909341283*
  z[2]*(2.38350718518842*z[21]*z[47]+3.111447653720826*z[20]*z[144]+75.03385723442858*
  z[18]*z[47]+77.03385723442858*z[20]*z[46]+1.555723826860412*z[148]*(1.732050807568878*
  z[18]-z[20])+z[149]*(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])-
  1.555723826860413*z[154]*(z[20]+1.732050807568878*z[18])-z[155]*(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])) - 0.009626205736900255*(z[56]+1.555723826860413*
  z[3])*(1.555723826860413*z[4]*z[13]-1.351145601417332*z[18]-1.133745775816087*
  z[21]-z[13]*z[58]) - 0.006236382909341283*z[1]*(2.38350718518842*z[21]*
  z[50]+3.111447653720826*z[20]*z[146]+75.03385723442858*z[18]*z[50]+77.03385723442858*
  z[20]*z[49]+1.555723826860412*z[151]*(1.732050807568878*z[18]-z[20])+z[152]*(
  z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])-1.555723826860413*
  z[157]*(z[20]+1.732050807568878*z[18])-z[158]*(1.732050807568878*z[20]-
  2.38350718518842*z[21]-z[18]));
  z[398] = z[336]*z[345] - z[340]*z[341];
  z[400] = 0.003507585955462276*z[338]*z[341] - 0.003507585955462279*z[336]*
  z[343];
  z[415] = 0.00416826935510556*z[324]*z[331] - 0.003507585955462257*z[321]*
  z[334];
  z[399] = z[336]*z[344] - z[339]*z[341];
  z[417] = z[383]*z[414] + z[387]*z[416] + z[398]*z[410] + z[400]*z[412] - 
  z[385]*z[415] - z[399]*z[411];
  z[418] = 0.00416826935510556*z[322]*z[331] - 0.004168269355105558*z[321]*
  z[332];
  z[403] = z[336]*z[342] - z[337]*z[341];
  z[419] = z[383]*z[418] + z[391]*z[416] + z[398]*z[408] + z[403]*z[412] - 
  z[389]*z[415] - z[399]*z[409];
  z[420] = z[385]*z[418] + z[393]*z[416] + z[398]*z[407] + z[403]*z[411] - 
  z[389]*z[414] - z[400]*z[409];
  z[421] = z[387]*z[418] + z[393]*z[415] + z[399]*z[407] + z[403]*z[410] - 
  z[391]*z[414] - z[400]*z[408];
  z[8] = 0.8390996311772799*rK + 0.8390996311772799*rW;
  z[10] = rK*z[8]/(rK+rW);
  z[7] = 1.305407289332279*rK + 1.305407289332279*rW;
  z[9] = rK*z[7]/(rK+rW);
  z[78] = 0.6427876096865393*z[10]*(z[18]-1.19175359259421*z[21]-1.555723826860413*
  z[13]*z[58]) - z[9]*(z[18]-z[4]*z[13]);
  z[95] = z[78]/rW;
  z[80] = -z[9]*z[3] - z[10]*z[56];
  z[96] = z[80]/rW;
  z[82] = 1.555723826860413*z[9] - z[10];
  z[83] = z[82]*z[11];
  z[97] = z[83]/rW;
  z[79] = z[10]*z[22];
  z[98] = z[79]/rW;
  z[81] = z[10]*z[6];
  z[99] = z[81]/rW;
  q1p = z[95]*theta3p + z[96]*phi1p + 0.6427876096865393*z[97]*theta1p + 
  0.766044443118978*z[98]*theta2p - 0.766044443118978*z[99]*phi2p;
  z[84] = 0.4999999999999997*z[9]*z[3] - z[10]*z[60] - 0.8660254037844387*
  z[9]*z[14];
  z[100] = z[84]/rW;
  z[85] = 0.4999999999999997*z[9]*(z[18]-z[4]*z[13]) + 0.8660254037844387*
  z[9]*(z[20]-z[13]*z[16]) - 0.5566703992264193*z[10]*(z[20]+1.376118514983941*
  z[21]+1.796395140445148*z[13]*z[65]);
  z[101] = z[85]/rW;
  z[87] = 0.7660444431189778*z[10]*z[22] + 0.8660254037844387*z[9]*z[19];
  z[102] = z[87]/rW;
  z[88] = -z[10]*z[63] - 0.8660254037844387*z[9]*z[5];
  z[103] = z[88]/rW;
  z[86] = z[9]*z[11];
  z[104] = z[86]/rW;
  q2p = z[100]*phi1p + z[101]*theta3p + z[102]*theta2p + z[103]*phi2p - 
  0.4999999999999997*z[104]*theta1p;
  z[89] = 0.4999999999999998*z[9]*z[3] + 0.8660254037844387*z[9]*z[14] - 
  z[10]*z[68];
  z[105] = z[89]/rW;
  z[90] = 0.4999999999999998*z[9]*(z[18]-z[4]*z[13]) + 0.3213938048432694*
  z[10]*(1.732050807568878*z[20]-2.38350718518842*z[21]-z[18]-3.111447653720826*
  z[13]*z[73]) - 0.8660254037844387*z[9]*(z[20]-z[13]*z[16]);
  z[106] = z[90]/rW;
  z[93] = 0.5566703992264191*z[10]*(z[19]+1.376118514983941*z[22]) - 0.8660254037844387*
  z[9]*z[19];
  z[107] = z[93]/rW;
  z[94] = 0.8660254037844387*z[9]*z[5] - z[10]*z[71];
  z[108] = z[94]/rW;
  z[91] = 1.555723826860413*z[9] - z[10];
  z[92] = z[91]*z[11];
  z[109] = z[92]/rW;
  q3p = z[105]*phi1p + z[106]*theta3p + z[107]*theta2p + z[108]*phi2p - 
  0.3213938048432694*z[109]*theta1p;
  z[116] = z[3]*z[5]*theta2p - z[4]*z[6]*theta1p;
  z[117] = 0.6427876096865393*z[4]*theta2p - 0.766044443118978*z[116];
  z[118] = z[9]*z[4]*theta2p - z[10]*z[117];
  z[23] = z[3]*z[13]*theta2p;
  z[28] = -z[3]*z[6]*theta1p - z[4]*z[5]*theta2p;
  z[114] = 0.6427876096865393*z[3]*theta2p - 0.766044443118978*z[28];
  z[115] = z[9]*(z[3]*z[13]*theta2p-z[23]) + 0.6427876096865393*z[10]*(z[23]-
  1.555723826860413*z[13]*z[114]-1.19175359259421*z[13]*z[28]);
  z[29] = z[5]*z[12]*theta1p;
  z[119] = z[10]*z[5]*theta1p;
  z[120] = phi1p*z[118] + theta3p*z[115] + 0.766044443118978*z[10]*theta2p*
  z[29] - 0.766044443118978*phi2p*z[119];
  z[138] = z[120]/rW;
  z[121] = z[3]*z[6]*theta2p + z[4]*z[5]*theta1p;
  z[122] = -0.3213938048432695*z[4]*theta2p - 0.7660444431189779*z[116] - 
  0.5566703992264194*z[121];
  z[123] = -0.4999999999999997*z[9]*z[4]*theta2p - z[10]*z[122] - 0.8660254037844387*
  z[9]*z[121];
  z[127] = (z[6]+1.376118514983941*z[5])*theta1p;
  z[128] = 0.8660254037844387*z[9]*z[6]*theta1p - 0.5566703992264194*z[10]*
  z[127];
  z[25] = z[6]*z[12]*theta1p;
  z[126] = 0.7660444431189778*z[10]*z[29] - 0.8660254037844387*z[9]*z[25];
  z[26] = z[3]*z[5]*theta1p - z[4]*z[6]*theta2p;
  z[124] = -0.3213938048432695*z[3]*theta2p - 0.7660444431189779*z[28] - 
  0.5566703992264194*z[26];
  z[125] = -0.4999999999999997*z[9]*(z[3]*z[13]*theta2p-z[23]) - 0.5566703992264193*
  z[10]*z[13]*(z[26]+1.376118514983941*z[28]+1.796395140445148*z[124]);
  z[129] = phi1p*z[123] + phi2p*z[128] + theta2p*z[126] + theta3p*z[125];
  z[139] = z[129]/rW;
  z[130] = 0.5566703992264194*z[121] - 0.3213938048432695*z[4]*theta2p - 
  0.7660444431189779*z[116];
  z[131] = 0.8660254037844387*z[9]*z[121] - 0.4999999999999998*z[9]*z[4]*
  theta2p - z[10]*z[130];
  z[135] = (1.376118514983941*z[5]-z[6])*theta1p;
  z[136] = -0.8660254037844387*z[9]*z[6]*theta1p - 0.5566703992264194*z[10]*
  z[135];
  z[134] = 0.8660254037844387*z[9]*z[25] - 0.5566703992264191*z[10]*(z[25]-
  1.376118514983941*z[29]);
  z[132] = 0.5566703992264194*z[26] - 0.3213938048432695*z[3]*theta2p - 
  0.7660444431189779*z[28];
  z[133] = 0.3213938048432694*z[10]*(1.732050807568878*z[13]*z[26]-z[23]-
  3.111447653720826*z[13]*z[132]-2.38350718518842*z[13]*z[28]) - 0.4999999999999998*
  z[9]*(z[3]*z[13]*theta2p-z[23]);
  z[137] = phi1p*z[131] + phi2p*z[136] + theta2p*z[134] + theta3p*z[133];
  z[140] = z[137]/rW;
  q1d = q1p;
  q2d = q2p;
  q3d = q3p;
  wbx = z[11]*theta1p - z[18]*theta3p;
  wby = z[19]*theta2p + z[20]*theta3p;
  wbz = z[21]*theta3p - z[22]*theta2p;
  z[24] = theta3p*z[23];
  z[27] = z[13]*theta3p*z[26] - theta2p*z[25];
  z[30] = z[13]*theta3p*z[28] - theta2p*z[29];
  z[166] = z[1]*z[6]*theta3p + z[2]*z[5]*theta1p + z[1]*z[116] - z[2]*z[15]*
  theta3p;
  z[167] = z[1]*z[15]*theta3p + z[2]*z[6]*theta3p + z[2]*z[116] - z[1]*z[5]*
  theta1p;
  z[168] = -z[1]*z[4]*theta2p - z[2]*z[3]*theta3p;
  z[169] = z[1]*z[3]*theta3p - z[2]*z[4]*theta2p;
  z[171] = z[2]*z[6]*theta1p + z[1]*z[121] - z[1]*z[5]*theta3p - z[2]*z[14]*
  theta3p;
  z[172] = z[1]*z[14]*theta3p + z[2]*z[121] - z[1]*z[6]*theta1p - z[2]*z[5]*
  theta3p;
  z[173] = 0.8660254037844386*z[4]*theta2p - 0.4999999999999997*z[121];
  z[174] = z[1]*z[61]*theta3p + 0.4999999999999997*z[1]*z[6]*theta1p + 0.4999999999999997*
  z[2]*z[5]*theta3p + z[2]*z[173];
  z[177] = z[1]*z[60]*theta3p + z[2]*z[122] + 0.5566703992264194*z[1]*z[127] - 
  z[2]*z[63]*theta3p;
  z[179] = z[1]*z[122] - z[1]*z[63]*theta3p - z[2]*z[60]*theta3p - 0.5566703992264194*
  z[2]*z[127];
  z[180] = 0.4999999999999997*z[1]*z[5]*theta3p + z[1]*z[173] - z[2]*z[61]*
  theta3p - 0.4999999999999997*z[2]*z[6]*theta1p;
  z[181] = z[1]*z[117] - z[2]*z[56]*theta3p - 0.766044443118978*z[1]*z[6]*
  theta3p - 0.766044443118978*z[2]*z[5]*theta1p;
  z[185] = z[1]*z[56]*theta3p + 0.766044443118978*z[1]*z[5]*theta1p + z[2]*
  z[117] - 0.766044443118978*z[2]*z[6]*theta3p;
  z[186] = -0.8660254037844386*z[4]*theta2p - 0.4999999999999998*z[121];
  z[187] = 0.4999999999999998*z[1]*z[5]*theta3p + z[1]*z[186] - z[2]*z[69]*
  theta3p - 0.4999999999999998*z[2]*z[6]*theta1p;
  z[190] = z[1]*z[68]*theta3p + z[2]*z[130] + 0.5566703992264194*z[1]*z[135] - 
  z[2]*z[71]*theta3p;
  z[192] = z[1]*z[69]*theta3p + 0.4999999999999998*z[1]*z[6]*theta1p + 0.4999999999999998*
  z[2]*z[5]*theta3p + z[2]*z[186];
  z[193] = z[1]*z[130] - z[1]*z[71]*theta3p - z[2]*z[68]*theta3p - 0.5566703992264194*
  z[2]*z[135];
  z[227] = z[2]*z[5] - z[1]*z[4]*z[6];
  z[228] = -z[1]*z[5] - z[2]*z[4]*z[6];
  z[230] = z[2]*z[6] + z[1]*z[4]*z[5];
  z[231] = z[2]*z[4]*z[5] - z[1]*z[6];
  z[244] = -0.5566703992264194*z[2]*(z[6]+1.376118514983941*z[5]) - 0.5566703992264194*
  z[1]*z[4]*(z[5]-1.376118514983941*z[6]);
  z[245] = 0.5566703992264194*z[1]*(z[6]+1.376118514983941*z[5]) - 0.5566703992264194*
  z[2]*z[4]*(z[5]-1.376118514983941*z[6]);
  z[246] = -0.4999999999999997*z[2]*z[6] - 0.4999999999999997*z[1]*z[4]*z[5];
  z[247] = 0.4999999999999997*z[1]*z[6] - 0.4999999999999997*z[2]*z[4]*z[5];
  z[248] = -0.4999999999999998*z[2]*z[6] - 0.4999999999999998*z[1]*z[4]*z[5];
  z[251] = 0.4999999999999998*z[1]*z[6] - 0.4999999999999998*z[2]*z[4]*z[5];
  z[252] = 0.5566703992264194*z[1]*z[4]*(z[5]+1.376118514983941*z[6]) - 
  0.5566703992264194*z[2]*(1.376118514983941*z[5]-z[6]);
  z[253] = 0.5566703992264194*z[1]*(1.376118514983941*z[5]-z[6]) + 0.5566703992264194*
  z[2]*z[4]*(z[5]+1.376118514983941*z[6]);
  z[254] = 0.766044443118978*z[1]*z[4]*z[6] - 0.766044443118978*z[2]*z[5];
  z[255] = 0.766044443118978*z[1]*z[5] + 0.766044443118978*z[2]*z[4]*z[6];
  z[274] = -0.3213938048432695*z[4] - 0.7660444431189779*z[3]*z[5] - 0.5566703992264194*
  z[3]*z[6];
  z[276] = 0.5566703992264194*z[4]*z[6] + 0.7660444431189779*z[4]*z[5] - 
  0.3213938048432695*z[3];
  z[279] = 0.5566703992264194*z[3]*z[6] - 0.3213938048432695*z[4] - 0.7660444431189779*
  z[3]*z[5];
  z[281] = 0.7660444431189779*z[4]*z[5] - 0.3213938048432695*z[3] - 0.5566703992264194*
  z[4]*z[6];
  z[287] = z[1]*(1.732050807568878*z[4]-z[3]*z[6]);
  z[288] = z[2]*(1.732050807568878*z[4]-z[3]*z[6]);
  z[289] = z[1]*(1.732050807568878*z[4]+z[3]*z[6]);
  z[291] = z[2]*(1.732050807568878*z[4]+z[3]*z[6]);
  z[294] = z[1]*(z[4]-1.19175359259421*z[3]*z[5]);
  z[295] = z[2]*(z[4]-1.19175359259421*z[3]*z[5]);
  z[298] = 0.3830222215594888*z[3] + 0.6427876096865391*z[4]*z[5] - 0.6634139481689384*
  z[4]*z[6];
  z[299] = 0.383022221559489*z[3] + 0.642787609686539*z[4]*z[5] + 0.6634139481689384*
  z[4]*z[6];
  z[313] = z[1]*z[6] - z[2]*z[15];
  z[314] = -z[1]*z[5] - z[2]*z[14];
  z[315] = -z[1]*z[63] - z[2]*z[60];
  z[316] = 0.4999999999999997*z[1]*z[5] - z[2]*z[61];
  z[317] = 0.4999999999999998*z[1]*z[5] - z[2]*z[69];
  z[318] = -z[1]*z[71] - z[2]*z[68];
  z[319] = -z[2]*z[56] - 0.766044443118978*z[1]*z[6];
  z[326] = 0.007374101413072466*z[6]*(z[56]+1.555723826860413*z[3]) + 0.007487858813578057*(
  1.347296355333861*z[5]-z[71])*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68]) + 0.14375*z[2]*(z[46]*(z[1]*z[46]+z[2]*z[49])+z[47]*(z[1]*z[47]+z[2]*
  z[50])+z[48]*(z[1]*z[48]+z[2]*z[51])) - 0.007487858813578057*(z[63]+1.347296355333861*
  z[5])*(z[3]-1.732050807568878*z[14]-1.285575219373079*z[60]) - 0.14375*z[1]*(
  z[49]*(z[1]*z[46]+z[2]*z[49])+z[50]*(z[1]*z[47]+z[2]*z[50])+z[51]*(z[1]*
  z[48]+z[2]*z[51]));
  z[327] = 0.005648889410479966*pow(z[6],2) + 0.10655625*pow(z[1],2) + 0.10655625*
  pow(z[2],2) + 0.009626205736900253*pow((z[63]+1.347296355333861*z[5]),2) + 
  0.009626205736900253*pow((1.347296355333861*z[5]-z[71]),2) + 0.14375*z[2]*(
  z[2]*pow(z[49],2)+z[2]*pow(z[51],2)+z[50]*(z[2]*z[50]+2*z[1]*z[47])) + 
  0.14375*z[1]*(z[1]*pow(z[47],2)+z[46]*(z[1]*z[46]+2*z[2]*z[49])+z[48]*(z[1]*
  z[48]+2*z[2]*z[51]));
  z[328] = z[11]*(z[5]+1.560168553385352*z[71]+2.302395752353911*z[63]+4.031532153232987*
  z[1]*z[154]+4.031532153232987*z[2]*z[157]-2.390316901299647*z[6]-112.2623863799929*
  z[1]*z[47]-112.2623863799929*z[2]*z[50]-4.031532153232986*z[1]*z[148]-
  4.031532153232986*z[2]*z[151]-1.496156408822902*z[1]*z[155]-1.496156408822902*
  z[2]*z[158]-1.496156408822901*z[1]*z[149]-1.496156408822901*z[2]*z[152]);
  z[329] = 0.01126387760934708*z[19]*z[71] + 0.01940417897097459*z[1]*z[19]*
  z[144] + 0.01940417897097459*z[2]*z[19]*z[146] + 0.4804126306974268*z[1]*
  z[19]*z[46] + 0.4804126306974268*z[2]*z[19]*z[49] + 0.01080173205443332*
  z[1]*z[149]*(z[19]-1.376118514983941*z[22]) + 0.01080173205443332*z[2]*
  z[152]*(z[19]-1.376118514983941*z[22]) - 0.01091367009134725*z[22]*z[63] - 
  0.01091367009134724*z[22]*z[71] - 0.00836035632751035*z[6]*z[22] - 0.01486446347400122*
  z[1]*z[22]*z[47] - 0.01486446347400122*z[2]*z[22]*z[50] - 0.009702089485487295*
  z[1]*z[19]*z[154] - 0.009702089485487295*z[2]*z[19]*z[157] - 0.009702089485487292*
  z[1]*z[19]*z[148] - 0.009702089485487292*z[2]*z[19]*z[151] - 0.016622501399943*
  z[19]*(z[63]+2.260262513968208*z[5]) - 0.01080173205443332*z[1]*z[155]*(
  z[19]+1.376118514983941*z[22]) - 0.01080173205443332*z[2]*z[158]*(z[19]+
  1.376118514983941*z[22]);
  z[330] = 0.003539568678274783*z[21]*z[71] + 0.01486446347400122*z[1]*z[21]*
  z[47] + 0.01486446347400122*z[2]*z[21]*z[50] + 0.01940417897097459*z[1]*
  z[20]*z[144] + 0.01940417897097459*z[2]*z[20]*z[146] + 0.4679398648787442*
  z[1]*z[18]*z[47] + 0.4679398648787442*z[2]*z[18]*z[50] + 0.4804126306974269*
  z[1]*z[20]*z[46] + 0.4804126306974269*z[2]*z[20]*z[49] + 0.00836035632751035*
  z[6]*(z[21]+1.191753592594211*z[18]) + 0.009935099957694807*z[21]*(z[5]+
  1.098496254473467*z[63]) + 0.006503202769875533*z[18]*(1.347296355333861*
  z[5]-z[71]) + 0.009702089485487293*z[1]*z[148]*(1.732050807568878*z[18]-
  z[20]) + 0.009702089485487293*z[2]*z[151]*(1.732050807568878*z[18]-z[20]) + 
  0.006236382909341283*z[1]*z[149]*(z[18]+1.732050807568878*z[20]+2.383507185188421*
  z[21]) + 0.006236382909341283*z[2]*z[152]*(z[18]+1.732050807568878*z[20]+
  2.383507185188421*z[21]) + 0.007487858813578057*z[13]*(z[63]+1.347296355333861*
  z[5])*(z[4]+1.285575219373079*z[65]+1.732050807568878*z[16]) + 0.007374101413072461*(
  1.347296355333861*z[5]-z[71])*(1.758770483143635*z[13]*z[16]-1.527491551632177*
  z[20]-z[21]-1.305407289332279*z[13]*z[73]-1.015426611885746*z[4]*z[13]) - 
  0.009702089485487295*z[1]*z[154]*(z[20]+1.732050807568878*z[18]) - 0.009702089485487295*
  z[2]*z[157]*(z[20]+1.732050807568878*z[18]) - 0.007374101413072467*z[6]*
  z[13]*(1.555723826860413*z[4]-z[58]) - 0.009597005657862012*(z[18]+1.173686669666548*
  z[20])*(z[63]+1.347296355333861*z[5]) - 0.006236382909341285*z[1]*z[155]*(
  1.732050807568878*z[20]-2.38350718518842*z[21]-z[18]) - 0.006236382909341285*
  z[2]*z[158]*(1.732050807568878*z[20]-2.38350718518842*z[21]-z[18]);
  z[351] = z[321]*z[327] - z[322]*z[326];
  z[352] = 3.196271610358775*z[333]*z[339] - 1.230315923495614E-05*z[334]*
  z[338];
  z[353] = 3.196271610358775*z[333]*z[340] - 1.230315923495616E-05*z[335]*
  z[338];
  z[354] = 0.003507585955462262*z[335]*z[339] - 0.003507585955462257*z[334]*
  z[340];
  z[355] = z[345]*z[352] - z[344]*z[353] - 0.003507585955462279*z[343]*z[354];
  z[356] = 0.004168269355105559*z[321]*z[328] - 0.004168269355105558*z[323]*
  z[326];
  z[357] = 0.003507585955462257*z[334]*z[337] - 0.004168269355105558*z[332]*
  z[339];
  z[358] = 0.003507585955462262*z[335]*z[337] - 0.004168269355105558*z[332]*
  z[340];
  z[359] = z[342]*z[354] + z[345]*z[357] - z[344]*z[358];
  z[360] = z[321]*z[329] - z[324]*z[326];
  z[361] = 1.462056304855206E-05*z[332]*z[338] - 3.196271610358775*z[333]*
  z[337];
  z[362] = z[342]*z[353] + z[345]*z[361] + 0.003507585955462279*z[343]*z[358];
  z[363] = z[321]*z[330] - z[325]*z[326];
  z[364] = z[342]*z[352] + z[344]*z[361] + 0.003507585955462279*z[343]*z[357];
  z[365] = 0.004168269355105559*z[322]*z[328] - 0.004168269355105558*z[323]*
  z[327];
  z[366] = 0.003507585955462257*z[334]*z[336] - 0.00416826935510556*z[331]*
  z[339];
  z[367] = 0.003507585955462262*z[335]*z[336] - 0.00416826935510556*z[331]*
  z[340];
  z[368] = z[341]*z[354] + z[345]*z[366] - z[344]*z[367];
  z[369] = z[322]*z[329] - z[324]*z[327];
  z[370] = 1.462056304855206E-05*z[331]*z[338] - 3.196271610358775*z[333]*
  z[336];
  z[371] = z[341]*z[353] + z[345]*z[370] + 0.003507585955462279*z[343]*z[367];
  z[372] = z[322]*z[330] - z[325]*z[327];
  z[373] = z[341]*z[352] + z[344]*z[370] + 0.003507585955462279*z[343]*z[366];
  z[374] = 0.004168269355105558*z[323]*z[329] - 0.004168269355105559*z[324]*
  z[328];
  z[375] = 0.004168269355105558*z[332]*z[336] - 0.00416826935510556*z[331]*
  z[337];
  z[376] = z[341]*z[358] + z[345]*z[375] - z[342]*z[367];
  z[377] = 0.004168269355105558*z[323]*z[330] - 0.004168269355105559*z[325]*
  z[328];
  z[378] = z[341]*z[357] + z[344]*z[375] - z[342]*z[366];
  z[379] = z[324]*z[330] - z[325]*z[329];
  z[380] = z[341]*z[361] - z[342]*z[370] - 0.003507585955462279*z[343]*z[375];
  z[381] = z[351]*z[355] + z[360]*z[362] + z[365]*z[368] + z[372]*z[373] + 
  z[374]*z[376] + z[379]*z[380] - z[356]*z[359] - z[363]*z[364] - z[369]*
  z[371] - z[377]*z[378];
  z[382] = 1.737446941671211E-05*z[328]*z[332] + 3.196271610358775*z[327]*
  z[333];
  z[384] = 0.004168269355105558*z[329]*z[332] - 0.003507585955462257*z[327]*
  z[334];
  z[386] = 0.004168269355105558*z[330]*z[332] - 0.003507585955462262*z[327]*
  z[335];
  z[388] = -3.196271610358775*z[329]*z[333] - 1.462056304855198E-05*z[328]*
  z[334];
  z[390] = -3.196271610358775*z[330]*z[333] - 1.4620563048552E-05*z[328]*
  z[335];
  z[392] = 0.003507585955462257*z[330]*z[334] - 0.003507585955462262*z[329]*
  z[335];
  z[394] = z[382]*z[383] + z[386]*z[387] + z[388]*z[389] + z[392]*z[393] - 
  z[384]*z[385] - z[390]*z[391];
  z[395] = 1.737446941671212E-05*z[328]*z[331] + 3.196271610358775*z[326]*
  z[333];
  z[396] = 0.00416826935510556*z[329]*z[331] - 0.003507585955462257*z[326]*
  z[334];
  z[397] = 0.00416826935510556*z[330]*z[331] - 0.003507585955462262*z[326]*
  z[335];
  z[401] = z[383]*z[395] + z[387]*z[397] + z[388]*z[398] + z[392]*z[400] - 
  z[385]*z[396] - z[390]*z[399];
  z[402] = 0.00416826935510556*z[327]*z[331] - 0.004168269355105558*z[326]*
  z[332];
  z[404] = z[383]*z[402] + z[384]*z[398] + z[391]*z[397] + z[392]*z[403] - 
  z[386]*z[399] - z[389]*z[396];
  z[405] = z[382]*z[398] + z[385]*z[402] + z[390]*z[403] + z[393]*z[397] - 
  z[386]*z[400] - z[389]*z[395];
  z[406] = z[382]*z[399] + z[387]*z[402] + z[388]*z[403] + z[393]*z[396] - 
  z[384]*z[400] - z[391]*z[395];
  z[422] = z[365]*z[383] + z[372]*z[387] + z[374]*z[389] + z[379]*z[393] - 
  z[369]*z[385] - z[377]*z[391];
  z[423] = z[356]*z[383] + z[363]*z[387] + z[374]*z[398] + z[379]*z[400] - 
  z[360]*z[385] - z[377]*z[399];
  z[424] = z[351]*z[383] + z[363]*z[391] + z[369]*z[398] + z[379]*z[403] - 
  z[360]*z[389] - z[372]*z[399];
  z[425] = z[351]*z[385] + z[363]*z[393] + z[365]*z[398] + z[377]*z[403] - 
  z[356]*z[389] - z[372]*z[400];
  z[426] = z[351]*z[387] + z[360]*z[393] + z[365]*z[399] + z[374]*z[403] - 
  z[356]*z[391] - z[369]*z[400];
  z[427] = 0.003507585955462262*z[335]*z[344] - 0.003507585955462257*z[334]*
  z[345];
  z[428] = 3.196271610358775*z[333]*z[345] - 1.230315923495617E-05*z[335]*
  z[343];
  z[429] = 3.196271610358775*z[333]*z[344] - 1.230315923495615E-05*z[334]*
  z[343];
  z[430] = 0.003507585955462262*z[335]*z[342] - 0.004168269355105558*z[332]*
  z[345];
  z[431] = 0.003507585955462257*z[334]*z[342] - 0.004168269355105558*z[332]*
  z[344];
  z[432] = 1.462056304855207E-05*z[332]*z[343] - 3.196271610358775*z[333]*
  z[342];
  z[433] = z[365]*z[427] + z[372]*z[429] + z[374]*z[430] + z[379]*z[432] - 
  z[369]*z[428] - z[377]*z[431];
  z[434] = 0.003507585955462262*z[335]*z[341] - 0.00416826935510556*z[331]*
  z[345];
  z[435] = 0.003507585955462257*z[334]*z[341] - 0.00416826935510556*z[331]*
  z[344];
  z[436] = 1.462056304855208E-05*z[331]*z[343] - 3.196271610358775*z[333]*
  z[341];
  z[437] = z[356]*z[427] + z[363]*z[429] + z[374]*z[434] + z[379]*z[436] - 
  z[360]*z[428] - z[377]*z[435];
  z[438] = 0.004168269355105558*z[332]*z[341] - 0.00416826935510556*z[331]*
  z[342];
  z[439] = z[351]*z[427] + z[363]*z[431] + z[369]*z[434] + z[379]*z[438] - 
  z[360]*z[430] - z[372]*z[435];
  z[440] = z[351]*z[428] + z[363]*z[432] + z[365]*z[434] + z[377]*z[438] - 
  z[356]*z[430] - z[372]*z[436];
  z[441] = z[351]*z[429] + z[360]*z[432] + z[365]*z[435] + z[374]*z[438] - 
  z[356]*z[431] - z[369]*z[436];
  z[442] = z[352]*z[372] + z[354]*z[365] + z[358]*z[374] + z[361]*z[379] - 
  z[353]*z[369] - z[357]*z[377];
  z[443] = z[352]*z[363] + z[354]*z[356] + z[367]*z[374] + z[370]*z[379] - 
  z[353]*z[360] - z[366]*z[377];
  z[444] = z[351]*z[354] + z[357]*z[363] + z[367]*z[369] + z[375]*z[379] - 
  z[358]*z[360] - z[366]*z[372];
  z[445] = z[351]*z[353] + z[361]*z[363] + z[365]*z[367] + z[375]*z[377] - 
  z[356]*z[358] - z[370]*z[372];
  z[446] = z[351]*z[352] + z[360]*z[361] + z[365]*z[366] + z[374]*z[375] - 
  z[356]*z[357] - z[369]*z[370];

/* Quantities to be specified */
  T1 = 0;
  T2 = 0;
  T3 = 0;
  Td1 = 0;
  Td2 = 0;
  Td3 = 0;

/* Evaluate output quantities */
  z[347] = 1.748124231619333*T3*(1.347296355333861*z[5]-z[71]) + 0.08265625*
  pow(z[1],2)*phi1p*theta3p + 0.07808986487874425*z[2]*z[18]*z[47]*pow(theta3p,
  2) + 0.01940417897097459*z[2]*z[144]*theta3p*(z[19]*theta2p+z[20]*theta3p) + 
  0.09056263069742683*z[2]*z[46]*theta3p*(z[19]*theta2p+z[20]*theta3p) + 
  0.07808986487874425*z[1]*z[50]*theta3p*(z[11]*theta1p-z[18]*theta3p) + 
  0.01486446347400122*z[2]*z[47]*theta3p*(z[21]*theta3p-5.253460040137192*
  z[11]*theta1p-z[22]*theta2p) + 0.009702089485487293*z[1]*z[151]*theta3p*(
  z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*z[18]-
  z[20])*theta3p) + 0.009702089485487295*z[2]*z[154]*theta3p*(1.732050807568878*
  z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*z[18])*theta3p) + 
  0.006236382909341283*z[1]*z[152]*theta3p*(z[11]*theta1p-1.732050807568878*(
  z[19]-1.376118514983941*z[22])*theta2p-(z[18]+1.732050807568878*z[20]+
  2.383507185188421*z[21])*theta3p) + 0.006236382909341284*z[1]*z[158]*theta3p*(
  z[11]*theta1p+1.732050807568878*(z[19]+1.376118514983941*z[22])*theta2p+(
  1.732050807568878*z[20]-2.38350718518842*z[21]-z[18])*theta3p) + 0.07808986487874425*
  z[1]*(z[11]*theta1p-z[18]*theta3p)*z[171] + 0.07808986487874425*z[2]*(z[11]*
  theta1p-z[18]*theta3p)*z[172] + 0.01940417897097459*z[1]*z[144]*(theta2p*
  z[25]-z[13]*theta3p*z[26]) + 0.01940417897097459*z[2]*z[146]*(theta2p*z[25]-
  z[13]*theta3p*z[26]) + 0.09056263069742683*z[1]*z[46]*(theta2p*z[25]-z[13]*
  theta3p*z[26]) + 0.09056263069742683*z[2]*z[49]*(theta2p*z[25]-z[13]*theta3p*
  z[26]) + 0.001705474295672534*(z[63]+1.347296355333861*z[5])*theta3p*(
  5.627176957291839*z[23]-z[13]*z[26]) + 0.00836035632751035*z[6]*(theta2p*
  z[29]-1.191753592594211*theta3p*z[23]-z[13]*theta3p*z[28]) + 0.01486446347400122*
  z[1]*z[47]*(theta2p*z[29]-theta3p*(5.253460040137192*z[23]+z[13]*z[28])) + 
  0.01486446347400122*z[2]*z[50]*(theta2p*z[29]-theta3p*(5.253460040137192*
  z[23]+z[13]*z[28])) + 0.01091367009134725*(z[63]+1.347296355333861*z[5])*(
  theta2p*z[29]-1.523089965228279*theta2p*z[25]-z[13]*theta3p*z[28]) + 0.006075317086775705*(
  z[21]*theta3p-1.523089965228279*z[19]*theta2p-z[22]*theta2p)*(2.420276625461207*
  z[6]*theta1p-z[127]) + 0.009702089485487293*z[1]*(z[19]*theta2p+1.732050807568878*
  z[11]*theta1p-(1.732050807568878*z[18]-z[20])*theta3p)*z[179] + 0.009702089485487293*
  z[2]*(z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*
  z[18]-z[20])*theta3p)*z[177] + 0.007374101413072468*z[6]*(phi1p*(1.555723826860413*
  z[4]*theta2p-z[117])+z[13]*theta3p*(1.555723826860412*z[3]*theta2p-z[114])) + 
  0.006236382909341283*z[1]*(z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*
  z[22])*theta2p-(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*
  theta3p)*z[180] + 0.006236382909341283*z[1]*z[149]*(1.732050807568878*
  theta2p*(z[25]+1.376118514983941*z[29])-theta3p*(z[23]+1.732050807568878*
  z[13]*z[26]+2.383507185188421*z[13]*z[28])) + 0.006236382909341283*z[2]*(
  z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-(
  z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p)*z[174] + 
  0.006236382909341283*z[2]*z[152]*(1.732050807568878*theta2p*(z[25]+1.376118514983941*
  z[29])-theta3p*(z[23]+1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*
  z[28])) + 0.006236382909341284*z[1]*(z[11]*theta1p+1.732050807568878*(z[19]+
  1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p)*z[187] + 0.006236382909341284*z[2]*(z[11]*theta1p+
  1.732050807568878*(z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])*theta3p)*z[192] + 0.14375*(z[48]*(z[1]*
  phi2p+z[2]*phi1p)-z[51]*(z[1]*phi1p-z[2]*phi2p))*(z[2]*z[48]*theta3p-z[1]*
  z[51]*theta3p-z[1]*z[166]-z[2]*z[167]) + 0.007487858813578057*(z[63]+1.347296355333861*
  z[5])*(1.431283341208007*phi2p*(2.420276625461207*z[6]*theta1p-z[127])-
  z[13]*theta3p*(z[3]*theta2p+1.285575219373079*z[124])-phi1p*(z[4]*theta2p+
  1.285575219373079*z[122]+1.732050807568878*z[121])) + 0.14375*(2.712*z[18]*
  theta3p+z[47]*(z[1]*phi2p+z[2]*phi1p)-2.712*z[11]*theta1p-z[50]*(z[1]*phi1p-
  z[2]*phi2p))*(z[2]*z[47]*theta3p-z[1]*z[50]*theta3p-z[1]*z[171]-z[2]*z[172]) + 
  0.14375*(2.712*z[19]*theta2p+2.712*z[20]*theta3p+z[46]*(z[1]*phi2p+z[2]*
  phi1p)-z[49]*(z[1]*phi1p-z[2]*phi2p))*(z[2]*z[46]*theta3p-z[1]*z[49]*theta3p-
  z[1]*z[168]-z[2]*z[169]) + 0.006503202769875533*(1.347296355333861*z[5]-
  z[71])*(1.647995297153704*phi2p*(2.420276625461207*z[6]*theta1p+z[135])-
  1.678199262354559*theta2p*(z[29]+1.032088886237957*z[25])-1.15141093989314*
  phi1p*(1.732050807568878*z[121]-z[4]*theta2p-1.285575219373079*z[130])-
  theta3p*(z[23]-1.15141093989314*z[3]*z[13]*theta2p-1.480225371641685*z[13]*
  z[132])) - 1.339140853513623*T1*z[6] - 1.748124231619333*T2*(z[63]+1.347296355333861*
  z[5]) - 0.08265625*z[1]*z[2]*phi2p*theta3p - 0.09056263069742683*z[1]*z[49]*
  theta3p*(z[19]*theta2p+z[20]*theta3p) - 0.01940417897097459*z[1]*z[146]*
  theta3p*(z[19]*theta2p+z[20]*theta3p) - 0.01486446347400122*z[1]*z[50]*
  theta3p*(z[21]*theta3p-z[22]*theta2p) - 0.009702089485487295*z[1]*z[157]*
  theta3p*(1.732050807568878*z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*
  z[18])*theta3p) - 0.009702089485487293*z[2]*z[148]*theta3p*(z[19]*theta2p+
  1.732050807568878*z[11]*theta1p-(1.732050807568878*z[18]-z[20])*theta3p) - 
  0.006236382909341284*z[2]*z[155]*theta3p*(z[11]*theta1p+1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p) - 0.006236382909341283*z[2]*z[149]*theta3p*(z[11]*
  theta1p-1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-(z[18]+
  1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p) - 0.14375*(z[49]*(
  z[1]*z[46]+z[2]*z[49])+z[50]*(z[1]*z[47]+z[2]*z[50])+z[51]*(z[1]*z[48]+z[2]*
  z[51]))*theta3p*(z[1]*phi2p+z[2]*phi1p) - 0.08265625*(z[1]+1.739130434782609*
  z[46]*(z[1]*z[46]+z[2]*z[49])+1.739130434782609*z[47]*(z[1]*z[47]+z[2]*
  z[50])+1.739130434782609*z[48]*(z[1]*z[48]+z[2]*z[51]))*theta3p*(z[1]*phi1p-
  z[2]*phi2p) - 0.007374101413072465*z[5]*theta1p*(1.133745775816088*z[21]*
  theta3p+1.351145601417333*z[18]*theta3p+1.532088886237957*z[6]*phi2p+(z[56]+
  1.555723826860413*z[3])*phi1p-1.351145601417333*z[11]*theta1p-1.133745775816088*
  z[22]*theta2p-z[13]*(1.555723826860413*z[4]-z[58])*theta3p) - 0.09056263069742683*
  z[1]*(z[19]*theta2p+z[20]*theta3p)*z[168] - 0.09056263069742683*z[2]*(z[19]*
  theta2p+z[20]*theta3p)*z[169] - 0.01940417897097459*z[1]*(z[19]*theta2p+
  z[20]*theta3p)*z[181] - 0.01940417897097459*z[2]*(z[19]*theta2p+z[20]*
  theta3p)*z[185] - 0.01486446347400122*z[1]*(z[21]*theta3p-z[22]*theta2p)*
  z[171] - 0.01486446347400122*z[2]*(z[21]*theta3p-z[22]*theta2p)*z[172] - 
  0.001705474295672533*z[13]*(1.347296355333861*z[5]-z[71])*theta3p*(z[26]-
  6.399199401034403*z[28]) - 0.009702089485487295*z[1]*z[154]*(theta2p*z[25]-
  theta3p*(1.732050807568878*z[23]+z[13]*z[26])) - 0.009702089485487295*z[2]*
  z[157]*(theta2p*z[25]-theta3p*(1.732050807568878*z[23]+z[13]*z[26])) - 
  0.009702089485487293*z[1]*z[148]*(theta2p*z[25]+theta3p*(1.732050807568878*
  z[23]-z[13]*z[26])) - 0.009702089485487293*z[2]*z[151]*(theta2p*z[25]+
  theta3p*(1.732050807568878*z[23]-z[13]*z[26])) - 0.006075317086775701*(
  z[21]*theta3p+1.032088886237957*z[20]*theta3p-z[22]*theta2p)*(2.420276625461207*
  z[6]*theta1p+z[135]) - 0.009702089485487295*z[1]*(1.732050807568878*z[11]*
  theta1p-z[19]*theta2p-(z[20]+1.732050807568878*z[18])*theta3p)*z[193] - 
  0.009702089485487295*z[2]*(1.732050807568878*z[11]*theta1p-z[19]*theta2p-(
  z[20]+1.732050807568878*z[18])*theta3p)*z[190] - 0.14375*(z[1]*z[48]+z[2]*
  z[51])*((z[1]*phi2p+z[2]*phi1p)*z[166]-(z[1]*phi1p-z[2]*phi2p)*z[167]) - 
  0.006236382909341284*z[1]*z[155]*(1.732050807568878*theta2p*(z[25]-1.376118514983941*
  z[29])-theta3p*(1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*z[13]*
  z[28])) - 0.006236382909341284*z[2]*z[158]*(1.732050807568878*theta2p*(
  z[25]-1.376118514983941*z[29])-theta3p*(1.732050807568878*z[13]*z[26]-z[23]-
  2.38350718518842*z[13]*z[28])) - 0.14375*(z[1]*z[47]+z[2]*z[50])*(2.712*
  theta3p*z[23]+(z[1]*phi2p+z[2]*phi1p)*z[171]-(z[1]*phi1p-z[2]*phi2p)*z[172]) - 
  0.14375*(z[1]*z[46]+z[2]*z[49])*(2.712*z[13]*theta3p*z[26]+(z[1]*phi2p+z[2]*
  phi1p)*z[168]-2.712*theta2p*z[25]-(z[1]*phi1p-z[2]*phi2p)*z[169]) - 0.004168269355105559*(
  1.281675562640064*z[18]*theta3p+1.504285522708015*z[20]*theta3p+(z[3]-
  1.732050807568878*z[14]-1.285575219373079*z[60])*phi1p-1.281675562640064*
  z[11]*theta1p-z[13]*(z[4]+1.285575219373079*z[65]+1.732050807568878*z[16])*
  theta3p)*(2.420276625461207*z[6]*theta1p-z[127]) - 0.003620140482156968*(
  z[11]*theta1p+1.732050807568878*z[19]*theta2p-z[18]*theta3p-1.15141093989314*(
  z[3]+1.732050807568878*z[14]-1.285575219373079*z[68])*phi1p-1.15141093989314*
  z[13]*(1.732050807568878*z[16]-1.285575219373078*z[73]-z[4])*theta3p)*(
  2.420276625461207*z[6]*theta1p+z[135]);
  z[349] = 1.166563093439616*z[3] + Td2*z[19] + 0.6634139481689384*T3*z[19] + 
  0.6963532438270841*T1*z[22] + 36.72392059568384*z[4]*z[5] + 1.339140853513623*
  T2*(z[22]+1.758770483143635*z[19]) + 0.02409741833840722*z[4]*z[6]*z[13]*
  z[20]*pow(theta3p,2) + 0.09056263069742683*z[3]*z[13]*z[47]*theta3p*(z[1]*
  phi2p+z[2]*phi1p) + 0.01247276581868257*z[294]*(z[1]*phi2p+z[2]*phi1p)*(
  z[19]*theta2p+z[20]*theta3p) + 0.01940417897097459*z[4]*z[6]*z[13]*z[146]*
  theta3p*(z[1]*phi1p-z[2]*phi2p) + 0.09056263069742683*z[4]*z[6]*z[13]*z[49]*
  theta3p*(z[1]*phi1p-z[2]*phi2p) + 0.006024354584601798*z[13]*(1.732050807568878*
  z[3]+z[4]*z[6])*theta3p*(z[19]*theta2p+z[20]*theta3p) + 0.006024354584601801*
  z[4]*z[6]*z[13]*theta3p*(6*z[19]*theta2p+(z[20]+1.732050807568878*z[18])*
  theta3p) + 0.009702089485487293*z[13]*z[148]*(1.732050807568878*z[3]+z[4]*
  z[6])*theta3p*(z[1]*phi2p+z[2]*phi1p) + 0.01043448822334082*z[13]*(1.732050807568878*
  z[3]+z[4]*z[6])*theta3p*(z[11]*theta1p-z[18]*theta3p) + 0.02409741833840722*
  z[13]*(z[3]+1.19175359259421*z[4]*z[5])*theta3p*(z[11]*theta1p-z[18]*theta3p) + 
  0.09056263069742683*z[2]*z[4]*(z[19]*theta2p+z[20]*theta3p)*(z[1]*phi1p-
  z[2]*phi2p) + 0.01043448822334082*z[3]*z[13]*theta3p*(6.928203230275511*
  z[11]*theta1p-(1.732050807568878*z[18]-z[20])*theta3p) + 0.01043448822334082*
  z[13]*(1.732050807568878*z[3]-z[4]*z[6])*theta3p*(z[11]*theta1p-z[18]*
  theta3p) + 0.01247276581868257*z[13]*z[50]*(z[3]+1.19175359259421*z[4]*z[5])*
  theta3p*(z[1]*phi1p-z[2]*phi2p) + 0.009702089485487295*z[13]*z[157]*(1.732050807568878*
  z[3]-z[4]*z[6])*theta3p*(z[1]*phi1p-z[2]*phi2p) + 0.09056263069742684*z[2]*
  z[3]*z[6]*(z[1]*phi1p-z[2]*phi2p)*(z[11]*theta1p-z[18]*theta3p) + 0.006024354584601798*
  z[13]*(z[3]-2.383507185188421*z[4]*z[5]-1.732050807568878*z[4]*z[6])*theta3p*(
  z[11]*theta1p-z[18]*theta3p) + 0.006236382909341283*z[13]*z[149]*(z[3]-
  2.383507185188421*z[4]*z[5]-1.732050807568878*z[4]*z[6])*theta3p*(z[1]*
  phi2p+z[2]*phi1p) + 0.006024354584601801*z[3]*z[13]*theta3p*(1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p) + 0.006236382909341283*z[13]*z[158]*(2.38350718518842*
  z[4]*z[5]-z[3]-1.732050807568878*z[4]*z[6])*theta3p*(z[1]*phi1p-z[2]*phi2p) + 
  0.01043448822334082*z[4]*z[6]*z[13]*theta3p*(1.732050807568878*(z[19]-
  1.376118514983941*z[22])*theta2p+(z[18]+1.732050807568878*z[20]+2.383507185188421*
  z[21])*theta3p) + 0.01043448822334082*z[4]*z[6]*z[13]*theta3p*(1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p) + 0.009702089485487295*z[1]*z[279]*(z[1]*phi2p+z[2]*
  phi1p)*(1.732050807568878*z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*
  z[18])*theta3p) + 0.01247276581868257*z[1]*z[3]*z[6]*(z[1]*phi2p+z[2]*phi1p)*(
  z[11]*theta1p-1.19175359259421*z[22]*theta2p-(z[18]-1.19175359259421*z[21])*
  theta3p) + 0.009702089485487293*z[2]*z[274]*(z[1]*phi1p-z[2]*phi2p)*(z[19]*
  theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*z[18]-z[20])*
  theta3p) + 0.003118191454670641*z[289]*(z[1]*phi2p+z[2]*phi1p)*(z[11]*
  theta1p+1.732050807568878*(z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])*theta3p) + 0.00311819145467064*z[288]*(
  z[1]*phi1p-z[2]*phi2p)*(z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*
  z[22])*theta2p-(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*
  theta3p) + 0.00248911819468314*z[13]*(2.38350718518842*z[4]*z[5]-z[3]-
  1.732050807568878*z[4]*z[6])*theta3p*(z[11]*theta1p+1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p) + 0.14375*z[3]*z[5]*(z[1]*(z[1]*phi2p+z[2]*phi1p)-
  z[2]*(z[1]*phi1p-z[2]*phi2p))*(z[48]*(z[1]*phi2p+z[2]*phi1p)-z[51]*(z[1]*
  phi1p-z[2]*phi2p)) + 0.14375*z[3]*(2.712*z[13]*theta3p+z[1]*z[6]*(z[1]*
  phi2p+z[2]*phi1p)-z[2]*z[6]*(z[1]*phi1p-z[2]*phi2p))*(2.712*z[18]*theta3p+
  z[47]*(z[1]*phi2p+z[2]*phi1p)-2.712*z[11]*theta1p-z[50]*(z[1]*phi1p-z[2]*
  phi2p)) + 0.001301504120174585*(1.19175359259421*z[3]*z[13]*theta3p-z[4]*
  z[5]*z[13]*theta3p-2.083333333333333*(1.191753592594211*z[4]+z[3]*z[5])*
  phi1p)*(z[21]*theta3p+1.19175359259421*z[18]*theta3p+2.083333333333334*z[6]*
  phi2p+2.719598519442247*(z[56]+1.555723826860413*z[3])*phi1p-3.674573577165482*
  z[11]*theta1p-3.083333333333334*z[22]*theta2p-2.083333333333333*(2.030853223771491*
  z[4]*z[13]-1.191753592594211*z[18]-z[21]-1.305407289332279*z[13]*z[58])*
  theta3p) + 0.0002310619849781768*(3.550183731337182*(z[4]+1.285575219373079*
  z[279]-1.732050807568878*z[3]*z[6])*phi1p-z[3]*z[13]*theta3p-1.732050807568878*
  z[4]*z[6]*z[13]*theta3p-1.678199262354559*z[4]*z[5]*z[13]*theta3p-1.466850398003847*
  z[13]*(2.38350718518842*z[4]*z[5]-3.111447653720826*z[281]-z[3]-1.732050807568878*
  z[4]*z[6])*theta3p)*(1.67819926235456*z[21]*theta3p+1.732050807568878*z[19]*
  theta2p+1.732050807568878*z[20]*theta3p+3.083333333333334*z[11]*theta1p+
  3.496248463238665*(1.032088886237958*z[19]-z[22])*theta2p-1.67819926235456*
  z[22]*theta2p-z[18]*theta3p-4.564028229228534*(1.347296355333861*z[5]-z[71])*
  phi2p-3.550183731337182*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68])*phi1p-2.083333333333334*(z[18]+2.951567327462619*z[13]*z[16]-1.732050807568878*
  z[20]-1.678199262354559*z[21]-2.190733550029694*z[13]*z[73]-1.704088191041847*
  z[4]*z[13])*theta3p) + 0.0002310619849781768*(3.550183731337182*(z[4]+
  1.285575219373079*z[279]-1.732050807568878*z[3]*z[6])*phi1p-z[3]*z[13]*
  theta3p-1.732050807568877*z[4]*z[6]*z[13]*theta3p-1.678199262354559*z[4]*
  z[5]*z[13]*theta3p-1.466850398003847*z[13]*(2.38350718518842*z[4]*z[5]-
  3.111447653720826*z[281]-z[3]-1.732050807568878*z[4]*z[6])*theta3p)*(1.67819926235456*
  z[21]*theta3p+1.732050807568878*z[19]*theta2p+1.732050807568878*z[20]*
  theta3p+3.083333333333334*z[11]*theta1p+3.496248463238664*(1.032088886237958*
  z[19]-z[22])*theta2p-1.67819926235456*z[22]*theta2p-z[18]*theta3p-4.564028229228533*(
  1.347296355333861*z[5]-z[71])*phi2p-3.550183731337181*(z[3]+1.732050807568878*
  z[14]-1.285575219373079*z[68])*phi1p-2.083333333333334*(z[18]+2.951567327462619*
  z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*z[21]-2.190733550029694*
  z[13]*z[73]-1.704088191041847*z[4]*z[13])*theta3p) + 0.02871818487704241*
  z[22]*theta3p*z[23] + 0.092*z[13]*z[22]*theta3p*z[28] + 0.01043448822334082*(
  z[19]-1.376118514983941*z[22])*theta3p*z[23] + 0.009702089485487293*z[19]*(
  z[1]*phi2p+z[2]*phi1p)*z[193] + 0.009702089485487295*z[19]*(z[1]*phi2p+z[2]*
  phi1p)*z[179] + 0.01486446347400122*z[22]*(z[1]*phi2p+z[2]*phi1p)*z[171] + 
  0.01486446347400122*z[47]*(z[1]*phi2p+z[2]*phi1p)*z[29] + 0.0194041789709746*
  z[144]*(z[1]*phi2p+z[2]*phi1p)*z[25] + 0.09056263069742684*z[46]*(z[1]*
  phi2p+z[2]*phi1p)*z[25] + 0.092*(z[21]*theta3p-2*z[22]*theta2p)*z[29] + 
  2.163821127507611*(z[20]*theta3p+2*z[19]*theta2p)*z[25] + 0.009702089485487293*
  z[157]*(z[1]*phi1p-z[2]*phi2p)*z[25] + 0.009702089485487295*z[151]*(z[1]*
  phi1p-z[2]*phi2p)*z[25] + 0.0194041789709746*z[19]*(z[1]*phi1p-z[2]*phi2p)*
  z[185] + 0.09056263069742684*z[19]*(z[1]*phi1p-z[2]*phi2p)*z[169] + 0.01043448822334082*(
  z[11]*theta1p-z[18]*theta3p)*(z[25]+1.376118514983941*z[29]) + 0.01043448822334082*
  z[19]*theta3p*(z[23]+1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*
  z[28]) + 0.01080173205443332*(z[19]+1.376118514983941*z[22])*(z[1]*phi2p+
  z[2]*phi1p)*z[187] + 0.01080173205443332*z[149]*(z[1]*phi2p+z[2]*phi1p)*(
  z[25]+1.376118514983941*z[29]) + 0.01043448822334082*z[19]*theta3p*(1.732050807568878*
  z[13]*z[26]-z[23]-2.38350718518842*z[13]*z[28]) + 0.01080173205443332*(
  z[19]-1.376118514983941*z[22])*(z[1]*phi1p-z[2]*phi2p)*z[174] + 0.01080173205443332*
  z[158]*(z[1]*phi1p-z[2]*phi2p)*(z[25]-1.376118514983941*z[29]) + 0.006024354584601798*
  z[19]*(12*theta2p*z[25]+theta3p*(1.732050807568878*z[23]-z[13]*z[26])) + 
  0.01186566220362099*(z[11]*theta1p-2.38350718518842*z[22]*theta2p-(z[18]-
  1.19175359259421*z[21])*theta3p)*z[29] + 0.0008004221953598381*z[19]*(
  theta3p*z[23]+1.67819926235456*theta2p*z[29]+1.732050807568878*theta2p*
  z[25]-1.732050807568878*z[13]*theta3p*z[26]-1.67819926235456*z[13]*theta3p*
  z[28]) + 0.001667546240332997*(z[19]-1.433985017893868*z[22])*(theta3p*
  z[23]+1.67819926235456*theta2p*z[29]+1.732050807568878*theta2p*z[25]-1.732050807568878*
  z[13]*theta3p*z[26]-1.67819926235456*z[13]*theta3p*z[28]) + 0.00431127917923532*(
  z[11]*theta1p+3.464101615137756*(z[19]+1.376118514983941*z[22])*theta2p+(
  1.732050807568878*z[20]-2.38350718518842*z[21]-z[18])*theta3p)*(z[25]-
  1.376118514983941*z[29]) + 0.38985*(2.712*z[20]*theta3p+5.424*z[19]*theta2p+
  z[46]*(z[1]*phi2p+z[2]*phi1p)-z[49]*(z[1]*phi1p-z[2]*phi2p))*z[25] + 0.00836035632751035*
  z[22]*(z[5]*phi2p*theta1p-theta2p*z[29]-1.305407289332279*phi1p*(1.555723826860413*
  z[4]*theta2p-z[117])-theta3p*(2.030853223771491*z[3]*z[13]*theta2p-1.191753592594211*
  z[23]-1.305407289332279*z[13]*z[114]-z[13]*z[28])) + 0.004012971037204969*(
  z[21]*theta3p+1.19175359259421*z[18]*theta3p+2.083333333333334*z[6]*phi2p+
  2.719598519442247*(z[56]+1.555723826860413*z[3])*phi1p-3.674573577165482*
  z[11]*theta1p-3.083333333333334*z[22]*theta2p-2.083333333333333*(2.030853223771491*
  z[4]*z[13]-1.191753592594211*z[18]-z[21]-1.305407289332279*z[13]*z[58])*
  theta3p)*z[29] + 0.006075317086775704*(z[22]+1.52308996522828*z[19])*(
  1.376118514983941*theta2p*(1.758770483143635*z[25]-z[29])+1.397347361223386*
  phi1p*(z[4]*theta2p+1.285575219373079*z[122]+1.732050807568878*z[121])-
  phi2p*(2.420276625461207*z[6]*theta1p-z[127])-theta3p*(1.397347361223386*
  z[23]-1.397347361223386*z[3]*z[13]*theta2p-z[13]*(z[26]+1.376118514983941*
  z[28]+1.796395140445148*z[124]))) + 0.001195618162641383*(1.67819926235456*
  z[21]*theta3p+1.732050807568878*z[19]*theta2p+1.732050807568878*z[20]*
  theta3p+3.083333333333334*z[11]*theta1p+3.496248463238665*(1.032088886237958*
  z[19]-z[22])*theta2p-1.67819926235456*z[22]*theta2p-z[18]*theta3p-4.564028229228534*(
  1.347296355333861*z[5]-z[71])*phi2p-3.550183731337182*(z[3]+1.732050807568878*
  z[14]-1.285575219373079*z[68])*phi1p-2.083333333333334*(z[18]+2.951567327462619*
  z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*z[21]-2.190733550029694*
  z[13]*z[73]-1.704088191041847*z[4]*z[13])*theta3p)*(z[29]+1.032088886237957*
  z[25]) + 0.001195618162641383*(1.67819926235456*z[21]*theta3p+1.732050807568878*
  z[19]*theta2p+1.732050807568878*z[20]*theta3p+3.083333333333334*z[11]*
  theta1p+3.496248463238664*(1.032088886237958*z[19]-z[22])*theta2p-1.67819926235456*
  z[22]*theta2p-z[18]*theta3p-4.564028229228533*(1.347296355333861*z[5]-z[71])*
  phi2p-3.550183731337181*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68])*phi1p-2.083333333333334*(z[18]+2.951567327462619*z[13]*z[16]-1.732050807568878*
  z[20]-1.678199262354559*z[21]-2.190733550029694*z[13]*z[73]-1.704088191041847*
  z[4]*z[13])*theta3p)*(z[29]+1.032088886237957*z[25]) - 1.522839965642087*
  z[298] - 1.522839965642087*z[299] - Td3*z[22] - 0.6634139481689384*T2*z[19] - 
  0.6427876096865391*T2*z[22] - 0.642787609686539*T3*z[22] - 1.339140853513622*
  T3*(1.032088886237958*z[19]-z[22]) - 0.01043448822334082*z[3]*z[13]*(z[20]+
  1.732050807568878*z[18])*pow(theta3p,2) - 2.200967255015221*z[3]*z[13]*
  theta3p*(z[11]*theta1p-z[18]*theta3p) - 2.199967255015221*z[4]*z[6]*z[13]*
  theta3p*(z[19]*theta2p+z[20]*theta3p) - 0.092*z[4]*z[5]*z[13]*theta3p*(
  z[21]*theta3p-z[22]*theta2p) - 0.09056263069742684*z[3]*z[13]*z[50]*theta3p*(
  z[1]*phi1p-z[2]*phi2p) - 0.09056263069742683*z[4]*z[6]*z[13]*z[46]*theta3p*(
  z[1]*phi2p+z[2]*phi1p) - 0.01940417897097459*z[4]*z[6]*z[13]*z[144]*theta3p*(
  z[1]*phi2p+z[2]*phi1p) - 0.006024354584601798*z[4]*z[6]*z[13]*(1.732050807568878*
  z[18]-z[20])*pow(theta3p,2) - 0.09056263069742683*z[1]*z[4]*(z[1]*phi2p+
  z[2]*phi1p)*(z[19]*theta2p+z[20]*theta3p) - 0.02409741833840722*z[3]*z[13]*
  theta3p*(1.19175359259421*z[22]*theta2p+(z[18]-1.19175359259421*z[21])*
  theta3p) - 0.01247276581868257*z[295]*(z[19]*theta2p+z[20]*theta3p)*(z[1]*
  phi1p-z[2]*phi2p) - 0.01247276581868257*z[13]*z[47]*(z[3]+1.19175359259421*
  z[4]*z[5])*theta3p*(z[1]*phi2p+z[2]*phi1p) - 0.0060243545846018*z[13]*(
  1.732050807568878*z[3]-z[4]*z[6])*theta3p*(z[19]*theta2p+z[20]*theta3p) - 
  0.09056263069742683*z[1]*z[3]*z[6]*(z[1]*phi2p+z[2]*phi1p)*(z[11]*theta1p-
  z[18]*theta3p) - 0.009702089485487295*z[13]*z[154]*(1.732050807568878*z[3]-
  z[4]*z[6])*theta3p*(z[1]*phi2p+z[2]*phi1p) - 0.009702089485487293*z[13]*
  z[151]*(1.732050807568878*z[3]+z[4]*z[6])*theta3p*(z[1]*phi1p-z[2]*phi2p) - 
  0.01043448822334082*z[13]*(z[3]-2.383507185188421*z[4]*z[5]-1.732050807568878*
  z[4]*z[6])*theta3p*(z[19]*theta2p+z[20]*theta3p) - 0.01043448822334082*
  z[13]*(2.38350718518842*z[4]*z[5]-z[3]-1.732050807568878*z[4]*z[6])*theta3p*(
  z[19]*theta2p+z[20]*theta3p) - 0.006236382909341283*z[13]*z[152]*(z[3]-
  2.383507185188421*z[4]*z[5]-1.732050807568878*z[4]*z[6])*theta3p*(z[1]*
  phi1p-z[2]*phi2p) - 0.006236382909341283*z[13]*z[155]*(2.38350718518842*
  z[4]*z[5]-z[3]-1.732050807568878*z[4]*z[6])*theta3p*(z[1]*phi2p+z[2]*phi1p) - 
  0.0060243545846018*z[13]*(2.38350718518842*z[4]*z[5]-z[3]-1.732050807568878*
  z[4]*z[6])*theta3p*(z[11]*theta1p-z[18]*theta3p) - 0.006024354584601799*
  z[3]*z[13]*theta3p*(1.732050807568878*(z[19]-1.376118514983941*z[22])*
  theta2p+(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p) - 
  0.009956472778732566*z[13]*(z[3]+1.19175359259421*z[4]*z[5])*theta3p*(z[11]*
  theta1p-1.19175359259421*z[22]*theta2p-(z[18]-1.19175359259421*z[21])*
  theta3p) - 0.009702089485487293*z[1]*z[274]*(z[1]*phi2p+z[2]*phi1p)*(z[19]*
  theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*z[18]-z[20])*
  theta3p) - 0.006024354584601797*z[13]*(1.732050807568878*z[3]+z[4]*z[6])*
  theta3p*(z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*
  z[18]-z[20])*theta3p) - 0.01247276581868257*z[2]*z[3]*z[6]*(z[1]*phi1p-z[2]*
  phi2p)*(z[11]*theta1p-1.19175359259421*z[22]*theta2p-(z[18]-1.19175359259421*
  z[21])*theta3p) - 0.009702089485487295*z[2]*z[279]*(z[1]*phi1p-z[2]*phi2p)*(
  1.732050807568878*z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*
  z[18])*theta3p) - 0.006024354584601799*z[13]*(1.732050807568878*z[3]-z[4]*
  z[6])*theta3p*(1.732050807568878*z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*
  z[18])*theta3p) - 0.00311819145467064*z[287]*(z[1]*phi2p+z[2]*phi1p)*(z[11]*
  theta1p-1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-(z[18]+
  1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p) - 0.003118191454670641*
  z[291]*(z[1]*phi1p-z[2]*phi2p)*(z[11]*theta1p+1.732050807568878*(z[19]+
  1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p) - 0.002489118194683139*z[13]*(z[3]-2.383507185188421*
  z[4]*z[5]-1.732050807568878*z[4]*z[6])*theta3p*(z[11]*theta1p-1.732050807568878*(
  z[19]-1.376118514983941*z[22])*theta2p-(z[18]+1.732050807568878*z[20]+
  2.383507185188421*z[21])*theta3p) - 0.009702089485487293*(2*z[19]*z[146]+
  49.51640895665247*z[19]*z[49]+1.113340798452839*z[152]*(z[19]-1.376118514983941*
  z[22])-1.532088886237957*z[22]*z[50]-z[19]*z[151]-z[19]*z[157]-1.113340798452839*
  z[158]*(z[19]+1.376118514983941*z[22]))*theta3p*(z[1]*phi2p+z[2]*phi1p) - 
  0.009702089485487293*(2*z[19]*z[144]+49.51640895665247*z[19]*z[46]+1.113340798452839*
  z[149]*(z[19]-1.376118514983941*z[22])-1.532088886237957*z[22]*z[47]-z[19]*
  z[148]-z[19]*z[154]-1.113340798452839*z[155]*(z[19]+1.376118514983941*z[22]))*
  theta3p*(z[1]*phi1p-z[2]*phi2p) - 0.14375*z[4]*(2.712*z[6]*z[13]*theta3p+
  z[1]*(z[1]*phi2p+z[2]*phi1p)-z[2]*(z[1]*phi1p-z[2]*phi2p))*(2.712*z[19]*
  theta2p+2.712*z[20]*theta3p+z[46]*(z[1]*phi2p+z[2]*phi1p)-z[49]*(z[1]*phi1p-
  z[2]*phi2p)) - 0.0002310619849781767*(z[3]*z[13]*theta3p+1.67819926235456*
  z[4]*z[5]*z[13]*theta3p-1.732050807568878*z[4]*z[6]*z[13]*theta3p-3.550183731337183*(
  z[4]+1.285575219373079*z[274]+1.732050807568878*z[3]*z[6])*phi1p-2.540659416445295*
  z[13]*(1.796395140445148*z[276]-1.376118514983941*z[4]*z[5]-z[4]*z[6])*
  theta3p)*(1.678199262354561*z[21]*theta3p+4.550183731337183*z[11]*theta1p+
  4.564028229228534*(z[63]+1.347296355333861*z[5])*phi2p-1.732050807568878*
  z[19]*theta2p-1.732050807568878*z[20]*theta3p-1.678199262354561*z[22]*
  theta2p-z[18]*theta3p-3.496248463238667*(z[22]+1.758770483143635*z[19])*
  theta2p-3.550183731337182*(z[3]-1.732050807568878*z[14]-1.285575219373079*
  z[60])*phi1p-3.496248463238667*(1.015426611885745*z[18]+1.032088886237957*
  z[20]-z[21]-1.758770483143635*z[13]*z[16]-1.305407289332279*z[13]*z[65]-
  1.015426611885745*z[4]*z[13])*theta3p) - 0.0002310619849781767*(z[3]*z[13]*
  theta3p+1.678199262354561*z[4]*z[5]*z[13]*theta3p-1.732050807568878*z[4]*
  z[6]*z[13]*theta3p-3.550183731337183*(z[4]+1.285575219373079*z[274]+1.732050807568878*
  z[3]*z[6])*phi1p-2.540659416445295*z[13]*(1.796395140445148*z[276]-1.376118514983941*
  z[4]*z[5]-z[4]*z[6])*theta3p)*(1.67819926235456*z[21]*theta3p+4.550183731337183*
  z[11]*theta1p+4.564028229228534*(z[63]+1.347296355333861*z[5])*phi2p-1.732050807568878*
  z[19]*theta2p-1.732050807568878*z[20]*theta3p-1.67819926235456*z[22]*theta2p-
  z[18]*theta3p-3.496248463238667*(z[22]+1.758770483143635*z[19])*theta2p-
  3.550183731337182*(z[3]-1.732050807568878*z[14]-1.285575219373079*z[60])*
  phi1p-3.496248463238667*(1.015426611885745*z[18]+1.032088886237957*z[20]-
  z[21]-1.758770483143635*z[13]*z[16]-1.305407289332279*z[13]*z[65]-1.015426611885745*
  z[4]*z[13])*theta3p) - 2.199967255015221*z[13]*z[19]*theta3p*z[26] - 0.01043448822334082*(
  z[19]+1.376118514983941*z[22])*theta3p*z[23] - 0.09056263069742684*z[19]*(
  z[1]*phi2p+z[2]*phi1p)*z[168] - 0.0287181848770424*(z[11]*theta1p-z[18]*
  theta3p)*z[29] - 0.0194041789709746*z[19]*(z[1]*phi2p+z[2]*phi1p)*z[181] - 
  0.01186566220362099*z[22]*theta3p*(z[23]-1.19175359259421*z[13]*z[28]) - 
  0.009702089485487295*z[148]*(z[1]*phi2p+z[2]*phi1p)*z[25] - 0.009702089485487293*
  z[154]*(z[1]*phi2p+z[2]*phi1p)*z[25] - 0.09056263069742684*z[49]*(z[1]*
  phi1p-z[2]*phi2p)*z[25] - 0.0194041789709746*z[146]*(z[1]*phi1p-z[2]*phi2p)*
  z[25] - 0.01486446347400122*z[22]*(z[1]*phi1p-z[2]*phi2p)*z[172] - 0.01486446347400122*
  z[50]*(z[1]*phi1p-z[2]*phi2p)*z[29] - 0.01043448822334082*(z[18]+1.732050807568878*
  z[20]+2.383507185188421*z[21])*theta3p*z[25] - 0.009702089485487295*z[19]*(
  z[1]*phi1p-z[2]*phi2p)*z[177] - 0.009702089485487293*z[19]*(z[1]*phi1p-z[2]*
  phi2p)*z[190] - 0.006024354584601798*z[19]*theta3p*(1.732050807568878*z[23]-
  z[13]*z[26]) - 0.03614612750761079*z[19]*(2*theta2p*z[25]-z[13]*theta3p*
  z[26]) - 0.01043448822334082*(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p*z[25] - 0.0180730637538054*(z[20]*theta3p+2*z[19]*
  theta2p)*(z[25]-1.376118514983941*z[29]) - 0.0180730637538054*(z[20]*theta3p+
  2*z[19]*theta2p)*(z[25]+1.376118514983941*z[29]) - 0.01080173205443332*(
  z[19]-1.376118514983941*z[22])*(z[1]*phi2p+z[2]*phi1p)*z[180] - 0.01080173205443332*
  z[155]*(z[1]*phi2p+z[2]*phi1p)*(z[25]-1.376118514983941*z[29]) - 0.01043448822334082*(
  z[11]*theta1p-z[18]*theta3p)*(z[25]-1.376118514983941*z[29]) - 0.01080173205443332*(
  z[19]+1.376118514983941*z[22])*(z[1]*phi1p-z[2]*phi2p)*z[192] - 0.01080173205443332*
  z[152]*(z[1]*phi1p-z[2]*phi2p)*(z[25]+1.376118514983941*z[29]) - 0.004012971037204969*
  z[22]*(theta2p*z[29]-1.19175359259421*theta3p*z[23]-z[13]*theta3p*z[28]) - 
  0.0180730637538054*(z[19]+1.376118514983941*z[22])*(2*theta2p*z[25]-z[13]*
  theta3p*z[26]) - 0.01807306375380539*(z[19]-1.376118514983941*z[22])*(2*
  theta2p*z[25]-z[13]*theta3p*z[26]) - 0.004311279179235319*(z[19]-1.376118514983941*
  z[22])*theta3p*(z[23]+1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*
  z[28]) - 0.00431127917923532*(z[19]+1.376118514983941*z[22])*theta3p*(
  1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*z[13]*z[28]) - 0.38985*
  z[19]*(2.712*z[13]*theta3p*z[26]+(z[1]*phi2p+z[2]*phi1p)*z[168]-(z[1]*phi1p-
  z[2]*phi2p)*z[169]) - 0.004311279179235319*(z[11]*theta1p-3.464101615137757*(
  z[19]-1.376118514983941*z[22])*theta2p-(z[18]+1.732050807568878*z[20]+
  2.383507185188421*z[21])*theta3p)*(z[25]+1.376118514983941*z[29]) - 0.001195618162641383*(
  z[22]+1.523089965228279*z[19])*(theta3p*z[23]+1.67819926235456*theta2p*
  z[29]+1.732050807568878*z[13]*theta3p*z[26]-1.732050807568878*theta2p*z[25]-
  1.67819926235456*z[13]*theta3p*z[28]) - 0.001195618162641383*(z[22]+1.52308996522828*
  z[19])*(theta3p*z[23]+1.678199262354561*theta2p*z[29]+1.732050807568878*
  z[13]*theta3p*z[26]-1.732050807568878*theta2p*z[25]-1.678199262354561*z[13]*
  theta3p*z[28]) - 0.004981742344339096*(1.032088886237957*z[19]-z[22])*(
  1.219516519893741*phi2p*(2.420276625461207*z[6]*theta1p+z[135])-1.678199262354559*
  theta2p*(z[29]+1.032088886237958*z[25])-1.704088191041847*phi1p*(1.732050807568878*
  z[121]-z[4]*theta2p-1.285575219373079*z[130])-theta3p*(z[23]+1.219516519893741*
  z[13]*z[26]-1.704088191041847*z[3]*z[13]*theta2p-2.190733550029694*z[13]*
  z[132]-1.678199262354559*z[13]*z[28])) - 0.001195618162641383*(1.67819926235456*
  z[21]*theta3p+4.550183731337183*z[11]*theta1p+4.564028229228534*(z[63]+
  1.347296355333861*z[5])*phi2p-1.732050807568878*z[19]*theta2p-1.732050807568878*
  z[20]*theta3p-1.67819926235456*z[22]*theta2p-z[18]*theta3p-3.496248463238667*(
  z[22]+1.758770483143635*z[19])*theta2p-3.550183731337182*(z[3]-1.732050807568878*
  z[14]-1.285575219373079*z[60])*phi1p-3.496248463238667*(1.015426611885745*
  z[18]+1.032088886237957*z[20]-z[21]-1.758770483143635*z[13]*z[16]-1.305407289332279*
  z[13]*z[65]-1.015426611885745*z[4]*z[13])*theta3p)*(1.523089965228279*z[25]-
  z[29]) - 0.001195618162641382*(1.678199262354561*z[21]*theta3p+4.550183731337183*
  z[11]*theta1p+4.564028229228534*(z[63]+1.347296355333861*z[5])*phi2p-1.732050807568878*
  z[19]*theta2p-1.732050807568878*z[20]*theta3p-1.678199262354561*z[22]*
  theta2p-z[18]*theta3p-3.496248463238667*(z[22]+1.758770483143635*z[19])*
  theta2p-3.550183731337182*(z[3]-1.732050807568878*z[14]-1.285575219373079*
  z[60])*phi1p-3.496248463238667*(1.015426611885745*z[18]+1.032088886237957*
  z[20]-z[21]-1.758770483143635*z[13]*z[16]-1.305407289332279*z[13]*z[65]-
  1.015426611885745*z[4]*z[13])*theta3p)*(1.523089965228279*z[25]-z[29]);
  z[346] = 1.359799259721123*T2*(z[3]-1.732050807568878*z[14]-1.285575219373079*
  z[60]) + 1.359799259721123*T3*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68]) + 0.07808986487874425*z[1]*z[47]*theta3p*(z[11]*theta1p-z[18]*theta3p) + 
  0.07808986487874425*z[2]*z[50]*theta3p*(z[11]*theta1p-z[18]*theta3p) + 
  0.009702089485487293*z[1]*z[148]*theta3p*(z[19]*theta2p+1.732050807568878*
  z[11]*theta1p-(1.732050807568878*z[18]-z[20])*theta3p) + 0.009702089485487293*
  z[2]*z[151]*theta3p*(z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*
  z[18]-z[20])*theta3p) + 0.006236382909341283*z[1]*z[149]*theta3p*(z[11]*
  theta1p-1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-(z[18]+
  1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p) + 0.006236382909341283*
  z[2]*z[152]*theta3p*(z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*
  z[22])*theta2p-(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*
  theta3p) + 0.006236382909341284*z[1]*z[155]*theta3p*(z[11]*theta1p+1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p) + 0.006236382909341284*z[2]*z[158]*theta3p*(z[11]*
  theta1p+1.732050807568878*(z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])*theta3p) + 0.14375*(z[46]*(z[1]*z[49]-
  z[2]*z[46])+z[47]*(z[1]*z[50]-z[2]*z[47])+z[48]*(z[1]*z[51]-z[2]*z[48]))*
  theta3p*(z[1]*phi1p-z[2]*phi2p) + 0.03578125*(z[1]+4.017467248908297*z[49]*(
  z[1]*z[49]-z[2]*z[46])+4.017467248908297*z[50]*(z[1]*z[50]-z[2]*z[47])+
  4.017467248908297*z[51]*(z[1]*z[51]-z[2]*z[48]))*theta3p*(z[1]*phi2p+z[2]*
  phi1p) + 0.07808986487874425*z[1]*z[18]*theta3p*z[172] + 0.07808986487874425*
  z[1]*z[50]*theta3p*z[23] + 0.01940417897097459*z[1]*(z[19]*theta2p+z[20]*
  theta3p)*z[185] + 0.09056263069742683*z[1]*(z[19]*theta2p+z[20]*theta3p)*
  z[169] + 0.07808986487874425*z[2]*(z[11]*theta1p-z[18]*theta3p)*z[171] + 
  0.008489328299801379*z[13]*(z[3]-1.732050807568878*z[14]-1.285575219373079*
  z[60])*theta3p*z[28] + 0.01940417897097459*z[2]*z[144]*(theta2p*z[25]-z[13]*
  theta3p*z[26]) + 0.09056263069742683*z[2]*z[46]*(theta2p*z[25]-z[13]*theta3p*
  z[26]) + 0.01486446347400122*z[1]*(z[21]*theta3p-5.253460040137192*z[11]*
  theta1p-z[22]*theta2p)*z[172] + 0.009702089485487293*z[1]*z[151]*(theta2p*
  z[25]+theta3p*(1.732050807568878*z[23]-z[13]*z[26])) + 0.009702089485487295*
  z[1]*z[157]*(theta2p*z[25]-theta3p*(1.732050807568878*z[23]+z[13]*z[26])) + 
  0.01486446347400122*z[2]*z[47]*(theta2p*z[29]-theta3p*(5.253460040137192*
  z[23]+z[13]*z[28])) + 0.008489328299801381*(1.52308996522828*z[19]*theta2p-
  z[21]*theta3p)*(z[4]*theta2p+1.285575219373079*z[122]+1.732050807568878*
  z[121]) + 0.01091367009134725*(z[56]+1.555723826860413*z[3])*(theta2p*z[29]-
  1.191753592594211*theta3p*z[23]-z[13]*theta3p*z[28]) + 0.009702089485487293*
  z[2]*(z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*
  z[18]-z[20])*theta3p)*z[179] + 0.009702089485487295*z[1]*(1.732050807568878*
  z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*z[18])*theta3p)*z[190] + 
  0.008489328299801379*(z[21]*theta3p+1.032088886237957*z[20]*theta3p-z[22]*
  theta2p)*(1.732050807568878*z[121]-z[4]*theta2p-1.285575219373079*z[130]) + 
  0.006236382909341283*z[2]*(z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*
  z[22])*theta2p-(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*
  theta3p)*z[180] + 0.006236382909341283*z[2]*z[149]*(1.732050807568878*
  theta2p*(z[25]+1.376118514983941*z[29])-theta3p*(z[23]+1.732050807568878*
  z[13]*z[26]+2.383507185188421*z[13]*z[28])) + 0.006236382909341284*z[2]*(
  z[11]*theta1p+1.732050807568878*(z[19]+1.376118514983941*z[22])*theta2p+(
  1.732050807568878*z[20]-2.38350718518842*z[21]-z[18])*theta3p)*z[187] + 
  0.006236382909341284*z[1]*z[158]*(1.732050807568878*theta2p*(z[25]-1.376118514983941*
  z[29])-theta3p*(1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*z[13]*
  z[28])) + 0.14375*(z[1]*z[51]-z[2]*z[48])*((z[1]*phi2p+z[2]*phi1p)*z[166]-(
  z[1]*phi1p-z[2]*phi2p)*z[167]) + 0.14375*(z[1]*z[50]-z[2]*z[47])*(2.712*
  theta3p*z[23]+(z[1]*phi2p+z[2]*phi1p)*z[171]-(z[1]*phi1p-z[2]*phi2p)*z[172]) + 
  0.14375*(z[1]*z[49]-z[2]*z[46])*(2.712*z[13]*theta3p*z[26]+(z[1]*phi2p+z[2]*
  phi1p)*z[168]-2.712*theta2p*z[25]-(z[1]*phi1p-z[2]*phi2p)*z[169]) + 0.14375*(
  z[48]*(z[1]*phi2p+z[2]*phi1p)-z[51]*(z[1]*phi1p-z[2]*phi2p))*(z[1]*z[167]-
  z[1]*z[48]*theta3p-z[2]*z[51]*theta3p-z[2]*z[166]) + 0.005058593749999997*(
  z[11]*theta1p+1.732050807568878*z[19]*theta2p-z[18]*theta3p-1.480225371641686*(
  1.347296355333861*z[5]-z[71])*phi2p-1.15141093989314*z[13]*(1.732050807568878*
  z[16]-1.285575219373078*z[73]-z[4])*theta3p)*(1.732050807568878*z[121]-z[4]*
  theta2p-1.285575219373079*z[130]) + 0.007374101413072468*(z[6]*phi2p+1.48*
  z[21]*theta3p+1.763795317039431*z[18]*theta3p+2.610814578664557*(z[56]+
  1.555723826860413*z[3])*phi1p-1.763795317039431*z[11]*theta1p-1.48*z[22]*
  theta2p-1.305407289332279*z[13]*(1.555723826860413*z[4]-z[58])*theta3p)*(
  1.555723826860413*z[4]*theta2p-z[117]) + 0.14375*(2.712*z[18]*theta3p+z[47]*(
  z[1]*phi2p+z[2]*phi1p)-2.712*z[11]*theta1p-z[50]*(z[1]*phi1p-z[2]*phi2p))*(
  z[1]*z[172]-z[1]*z[47]*theta3p-z[2]*z[50]*theta3p-z[2]*z[171]) + 0.14375*(
  2.712*z[19]*theta2p+2.712*z[20]*theta3p+z[46]*(z[1]*phi2p+z[2]*phi1p)-z[49]*(
  z[1]*phi1p-z[2]*phi2p))*(z[1]*z[169]-z[1]*z[46]*theta3p-z[2]*z[49]*theta3p-
  z[2]*z[168]) + 0.00132662349893787*(z[3]-1.732050807568878*z[14]-1.285575219373079*
  z[60])*(6.3991994010344*theta2p*(1.52308996522828*z[25]-z[29])-3.142013810582117*
  phi2p*(2.420276625461207*z[6]*theta1p-z[127])-theta3p*(5.627176957291838*
  z[23]-4.390484707144358*z[3]*z[13]*theta2p-z[13]*(z[26]+5.644298340541255*
  z[124]))) + 0.00416826935510556*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68])*(phi2p*(2.420276625461207*z[6]*theta1p+z[135])-2.036655402176232*
  theta2p*(z[29]+1.032088886237957*z[25])-2.794694722446772*phi1p*(1.732050807568878*
  z[121]-z[4]*theta2p-1.285575219373079*z[130])-1.213595696209966*theta3p*(
  z[23]-1.15141093989314*z[3]*z[13]*theta2p-1.480225371641685*z[13]*z[132])) + 
  0.005824520184225059*(1.281675562640063*z[18]*theta3p+1.457515474458068*
  z[22]*theta2p+1.504285522708015*z[20]*theta3p+2*(z[3]-1.732050807568878*
  z[14]-1.285575219373079*z[60])*phi1p-1.281675562640063*z[11]*theta1p-1.285575219373079*(
  z[63]+1.347296355333861*z[5])*phi2p-z[13]*(z[4]+1.285575219373079*z[65]+
  1.732050807568878*z[16])*theta3p)*(z[4]*theta2p+1.285575219373079*z[122]+
  1.732050807568878*z[121]) - 1.748124231619333*T1*(z[56]+1.555723826860413*
  z[3]) - 0.03578125*z[1]*z[2]*phi1p*theta3p - 0.03578125*pow(z[1],2)*phi2p*
  theta3p - 0.09056263069742683*z[1]*z[46]*theta3p*(z[19]*theta2p+z[20]*
  theta3p) - 0.09056263069742683*z[2]*z[49]*theta3p*(z[19]*theta2p+z[20]*
  theta3p) - 0.01940417897097459*z[1]*z[144]*theta3p*(z[19]*theta2p+z[20]*
  theta3p) - 0.01940417897097459*z[2]*z[146]*theta3p*(z[19]*theta2p+z[20]*
  theta3p) - 0.01486446347400122*z[1]*z[47]*theta3p*(z[21]*theta3p-z[22]*
  theta2p) - 0.01486446347400122*z[2]*z[50]*theta3p*(z[21]*theta3p-z[22]*
  theta2p) - 0.009702089485487295*z[1]*z[154]*theta3p*(1.732050807568878*
  z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*z[18])*theta3p) - 
  0.009702089485487295*z[2]*z[157]*theta3p*(1.732050807568878*z[11]*theta1p-
  z[19]*theta2p-(z[20]+1.732050807568878*z[18])*theta3p) - 0.09056263069742683*
  z[2]*(z[19]*theta2p+z[20]*theta3p)*z[168] - 0.01940417897097459*z[2]*(z[19]*
  theta2p+z[20]*theta3p)*z[181] - 0.01486446347400122*z[2]*(z[21]*theta3p-
  z[22]*theta2p)*z[171] - 0.09056263069742683*z[1]*z[49]*(theta2p*z[25]-z[13]*
  theta3p*z[26]) - 0.01940417897097459*z[1]*z[146]*(theta2p*z[25]-z[13]*
  theta3p*z[26]) - 0.01486446347400122*z[1]*z[50]*(theta2p*z[29]-z[13]*theta3p*
  z[28]) - 0.009702089485487295*z[2]*z[154]*(theta2p*z[25]-theta3p*(1.732050807568878*
  z[23]+z[13]*z[26])) - 0.009702089485487293*z[2]*z[148]*(theta2p*z[25]+
  theta3p*(1.732050807568878*z[23]-z[13]*z[26])) - 0.00132662349893787*z[13]*(
  z[3]+1.732050807568878*z[14]-1.285575219373079*z[68])*theta3p*(z[26]-6.399199401034403*
  z[28]) - 0.009702089485487295*z[2]*(1.732050807568878*z[11]*theta1p-z[19]*
  theta2p-(z[20]+1.732050807568878*z[18])*theta3p)*z[193] - 0.009702089485487293*
  z[1]*(z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*
  z[18]-z[20])*theta3p)*z[177] - 0.007374101413072465*(z[56]+1.555723826860413*
  z[3])*(z[5]*phi2p*theta1p-1.305407289332279*z[13]*theta3p*(1.555723826860412*
  z[3]*theta2p-z[114])) - 0.006236382909341284*z[1]*(z[11]*theta1p+1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p)*z[192] - 0.006236382909341283*z[1]*(z[11]*theta1p-
  1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-(z[18]+1.732050807568878*
  z[20]+2.383507185188421*z[21])*theta3p)*z[174] - 0.006236382909341283*z[1]*
  z[152]*(1.732050807568878*theta2p*(z[25]+1.376118514983941*z[29])-theta3p*(
  z[23]+1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*z[28])) - 
  0.006236382909341284*z[2]*z[155]*(1.732050807568878*theta2p*(z[25]-1.376118514983941*
  z[29])-theta3p*(1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*z[13]*
  z[28]));
  z[348] = 34.76619527278344*z[3]*z[6] + 0.07808986487874427*z[18]*z[230]*
  theta3p*(z[1]*phi2p+z[2]*phi1p) + 3.163736781660488*z[3]*z[5]*z[13]*theta3p*(
  z[20]*theta3p+1.022850274850387*z[19]*theta2p) + 0.0194041789709746*z[254]*(
  z[1]*phi2p+z[2]*phi1p)*(z[19]*theta2p+z[20]*theta3p) + 0.07808986487874425*
  z[231]*(z[1]*phi1p-z[2]*phi2p)*(z[11]*theta1p-z[18]*theta3p) + 0.00249343023490022*(
  z[11]*theta1p-z[18]*theta3p)*(z[5]*z[12]*theta2p+z[3]*z[6]*z[13]*theta3p) + 
  0.009702089485487293*z[154]*(z[1]*phi2p+z[2]*phi1p)*(z[6]*z[12]*theta2p-
  z[3]*z[5]*z[13]*theta3p) + 0.009702089485487295*z[148]*(z[1]*phi2p+z[2]*
  phi1p)*(z[6]*z[12]*theta2p-z[3]*z[5]*z[13]*theta3p) + 0.01043448822334082*(
  z[18]*theta3p+6.928203230275509*z[19]*theta2p)*(z[6]*z[12]*theta2p-z[3]*
  z[5]*z[13]*theta3p) + 0.01486446347400122*z[50]*(z[1]*phi1p-z[2]*phi2p)*(
  z[5]*z[12]*theta2p+z[3]*z[6]*z[13]*theta3p) + 0.01486446347400122*z[230]*(
  z[1]*phi2p+z[2]*phi1p)*(z[21]*theta3p-5.253460040137192*z[11]*theta1p-z[22]*
  theta2p) + 0.0194041789709746*z[146]*(z[1]*phi1p-z[2]*phi2p)*(z[6]*z[12]*
  theta2p-z[3]*z[5]*z[13]*theta3p) + 0.4804126306974268*z[49]*(z[1]*phi1p-
  z[2]*phi2p)*(z[6]*z[12]*theta2p-z[3]*z[5]*z[13]*theta3p) + 0.006123209044105501*
  z[18]*theta3p*(z[3]*z[13]*(z[5]+1.376118514983941*z[6])*theta3p+z[12]*(
  1.376118514983941*z[5]-z[6])*theta2p) + 0.009702089485487293*z[252]*(z[1]*
  phi2p+z[2]*phi1p)*(1.732050807568878*z[11]*theta1p-z[19]*theta2p-(z[20]+
  1.732050807568878*z[18])*theta3p) + 0.009702089485487295*z[245]*(z[1]*phi1p-
  z[2]*phi2p)*(z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*
  z[18]-z[20])*theta3p) + 0.01080173205443332*z[152]*(z[1]*phi1p-z[2]*phi2p)*(
  z[12]*(z[6]+1.376118514983941*z[5])*theta2p-z[3]*z[13]*(z[5]-1.376118514983941*
  z[6])*theta3p) + 0.01080173205443332*z[158]*(z[1]*phi1p-z[2]*phi2p)*(z[3]*
  z[13]*(z[5]+1.376118514983941*z[6])*theta3p+z[12]*(1.376118514983941*z[5]-
  z[6])*theta2p) + 0.00623638290934128*z[247]*(z[1]*phi1p-z[2]*phi2p)*(z[11]*
  theta1p-1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-(z[18]+
  1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p) + 0.006236382909341282*
  z[251]*(z[1]*phi1p-z[2]*phi2p)*(z[11]*theta1p+1.732050807568878*(z[19]+
  1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p) + 0.004311279179235319*(z[11]*theta1p+2.383507185188421*
  z[22]*theta2p-(z[18]+2.383507185188421*z[21])*theta3p)*(z[12]*(z[6]+1.376118514983941*
  z[5])*theta2p-z[3]*z[13]*(z[5]-1.376118514983941*z[6])*theta3p) + 0.14375*(
  z[48]*(z[1]*phi2p+z[2]*phi1p)-z[51]*(z[1]*phi1p-z[2]*phi2p))*(z[227]*(z[1]*
  phi2p+z[2]*phi1p)-z[228]*(z[1]*phi1p-z[2]*phi2p)) + 0.14375*(z[230]*(z[1]*
  phi2p+z[2]*phi1p)-z[231]*(z[1]*phi1p-z[2]*phi2p))*(2.712*z[18]*theta3p+
  z[47]*(z[1]*phi2p+z[2]*phi1p)-2.712*z[11]*theta1p-z[50]*(z[1]*phi1p-z[2]*
  phi2p)) + 0.002711466917030384*(2.083333333333333*z[5]*phi2p+2.083333333333333*
  z[4]*z[6]*phi1p-3.083333333333333*z[5]*z[12]*theta2p-z[3]*z[6]*z[13]*theta3p)*(
  z[6]*phi2p+1.48*z[21]*theta3p+1.763795317039431*z[18]*theta3p+1.305407289332278*(
  z[56]+1.555723826860413*z[3])*phi1p-1.763795317039431*z[11]*theta1p-1.48*
  z[22]*theta2p-1.305407289332279*z[13]*(1.555723826860413*z[4]-z[58])*theta3p) + 
  0.002753295664800447*(z[3]*z[6]*z[13]*theta3p-4.696194059453861*z[6]*z[12]*
  theta2p-2.083333333333334*(z[5]-1.032088886237957*z[6])*phi2p)*(1.281675562640064*
  z[18]*theta3p+1.457515474458068*z[22]*theta2p+1.504285522708015*z[20]*
  theta3p+2.219927193312019*z[19]*theta2p+(z[3]-1.732050807568878*z[14]-
  1.285575219373079*z[60])*phi1p-1.457515474458068*z[21]*theta3p-1.281675562640064*
  z[11]*theta1p-1.285575219373079*(z[63]+1.347296355333861*z[5])*phi2p-z[13]*(
  z[4]+1.285575219373079*z[65]+1.732050807568878*z[16])*theta3p) + 0.002841645856167687*(
  2.987468787278894*z[5]*z[12]*theta2p+z[3]*z[5]*z[13]*theta3p-2.018559991404659*
  z[4]*(z[6]+1.032088886237957*z[5])*phi1p)*(1.281675562640064*z[18]*theta3p+
  1.457515474458068*z[22]*theta2p+1.504285522708015*z[20]*theta3p+2.219927193312019*
  z[19]*theta2p+(z[3]-1.732050807568878*z[14]-1.285575219373079*z[60])*phi1p-
  1.457515474458068*z[21]*theta3p-1.281675562640064*z[11]*theta1p-1.285575219373079*(
  z[63]+1.347296355333861*z[5])*phi2p-z[13]*(z[4]+1.285575219373079*z[65]+
  1.732050807568878*z[16])*theta3p) + 0.001195618162641383*(1.032088886237957*
  z[3]*z[5]*z[13]*theta3p+2.083333333333333*(z[5]+1.032088886237957*z[6])*
  phi2p-3.182274065900367*z[6]*z[12]*theta2p-3.083333333333332*z[5]*z[12]*
  theta2p-z[3]*z[6]*z[13]*theta3p-2.083333333333332*z[4]*(1.032088886237957*
  z[5]-z[6])*phi1p)*(z[11]*theta1p+1.678199262354559*z[21]*theta3p+1.732050807568878*
  z[20]*theta3p+1.732050807568879*z[19]*theta2p-1.678199262354559*z[22]*
  theta2p-z[18]*theta3p-1.480225371641686*(1.347296355333861*z[5]-z[71])*
  phi2p-1.15141093989314*(z[3]+1.732050807568878*z[14]-1.285575219373079*
  z[68])*phi1p-1.15141093989314*z[13]*(1.732050807568878*z[16]-1.285575219373078*
  z[73]-z[4])*theta3p) + 0.001195618162641383*(1.032088886237957*z[3]*z[5]*
  z[13]*theta3p+2.083333333333334*(z[5]+1.032088886237957*z[6])*phi2p-3.182274065900367*
  z[6]*z[12]*theta2p-3.083333333333332*z[5]*z[12]*theta2p-z[3]*z[6]*z[13]*
  theta3p-2.083333333333333*z[4]*(1.032088886237957*z[5]-z[6])*phi1p)*(z[11]*
  theta1p+1.678199262354559*z[21]*theta3p+1.732050807568878*z[20]*theta3p+
  1.732050807568879*z[19]*theta2p-1.678199262354559*z[22]*theta2p-z[18]*
  theta3p-1.480225371641686*(1.347296355333861*z[5]-z[71])*phi2p-1.15141093989314*(
  z[3]+1.732050807568878*z[14]-1.285575219373079*z[68])*phi1p-1.15141093989314*
  z[13]*(1.732050807568878*z[16]-1.285575219373078*z[73]-z[4])*theta3p) + 
  0.0005481288729485916*z[11]*(6.604542582628186*phi2p*(1.15141093989314*z[6]*
  theta1p-z[135])-16.35109897583849*theta2p*z[25]-7.604542582628183*phi1p*(
  z[121]+1.560168553385352*z[130])-z[13]*theta3p*(z[26]+6.399199401034357*
  z[28]+11.86436820029631*z[132])) + 0.003507585955462265*z[11]*(2.840553250922431*
  z[5]*phi2p*theta1p+theta2p*z[29]-3.708078919490644*phi1p*(2.518613911745829*
  z[4]*theta2p-z[117])-3.708078919490644*theta3p*(2.518613911745828*z[3]*
  z[13]*theta2p-245.7459596035284*z[23]-z[13]*z[114])) + 0.006236382909341282*
  z[11]*((z[1]*phi2p+z[2]*phi1p)*z[180]+(z[1]*phi2p+z[2]*phi1p)*z[187]+2.694592710667723*(
  z[1]*phi2p+z[2]*phi1p)*z[179]+75.0338572344286*(z[1]*phi2p+z[2]*phi1p)*
  z[171]+2.694592710667723*(z[1]*phi1p-z[2]*phi2p)*z[190]-2.694592710667723*(
  z[1]*phi2p+z[2]*phi1p)*z[193]-75.0338572344286*(z[1]*phi1p-z[2]*phi2p)*
  z[172]-2.694592710667723*(z[1]*phi1p-z[2]*phi2p)*z[177]-(z[1]*phi1p-z[2]*
  phi2p)*z[174]-(z[1]*phi1p-z[2]*phi2p)*z[192]) - 0.4149407400227798*(T3+
  2.354015752003551*T2-2.409982687998053*Td1-2*T1)*z[11] - 3.236029036675709*
  z[6]*z[12]*z[19]*pow(theta2p,2) - 3.163736781660488*z[6]*z[12]*z[20]*theta2p*
  theta3p - 0.01043448822334082*z[11]*theta1p*(z[6]*z[12]*theta2p-z[3]*z[5]*
  z[13]*theta3p) - 0.0194041789709746*z[255]*(z[19]*theta2p+z[20]*theta3p)*(
  z[1]*phi1p-z[2]*phi2p) - 0.01486446347400122*z[231]*(z[1]*phi1p-z[2]*phi2p)*(
  z[21]*theta3p-z[22]*theta2p) - 0.1061409455596747*(z[21]*theta3p-z[22]*
  theta2p)*(z[5]*z[12]*theta2p+z[3]*z[6]*z[13]*theta3p) - 0.01486446347400122*
  z[47]*(z[1]*phi2p+z[2]*phi1p)*(z[5]*z[12]*theta2p+z[3]*z[6]*z[13]*theta3p) - 
  0.4804126306974268*z[46]*(z[1]*phi2p+z[2]*phi1p)*(z[6]*z[12]*theta2p-z[3]*
  z[5]*z[13]*theta3p) - 0.0194041789709746*z[144]*(z[1]*phi2p+z[2]*phi1p)*(
  z[6]*z[12]*theta2p-z[3]*z[5]*z[13]*theta3p) - 0.009702089485487295*z[151]*(
  z[1]*phi1p-z[2]*phi2p)*(z[6]*z[12]*theta2p-z[3]*z[5]*z[13]*theta3p) - 
  0.009702089485487293*z[157]*(z[1]*phi1p-z[2]*phi2p)*(z[6]*z[12]*theta2p-
  z[3]*z[5]*z[13]*theta3p) - 0.006236382909341283*z[11]*(2.694592710667723*
  z[157]-75.03385723442858*z[50]-2.694592710667723*z[151]-z[152]-z[158])*
  theta3p*(z[1]*phi2p+z[2]*phi1p) - 0.009702089485487295*z[244]*(z[1]*phi2p+
  z[2]*phi1p)*(z[19]*theta2p+1.732050807568878*z[11]*theta1p-(1.732050807568878*
  z[18]-z[20])*theta3p) - 0.006236382909341283*z[11]*(2.694592710667723*
  z[154]-75.03385723442858*z[47]-2.694592710667723*z[148]-z[149]-z[155])*
  theta3p*(z[1]*phi1p-z[2]*phi2p) - 0.009702089485487293*z[253]*(z[1]*phi1p-
  z[2]*phi2p)*(1.732050807568878*z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*
  z[18])*theta3p) - 0.01080173205443332*z[149]*(z[1]*phi2p+z[2]*phi1p)*(z[12]*(
  z[6]+1.376118514983941*z[5])*theta2p-z[3]*z[13]*(z[5]-1.376118514983941*
  z[6])*theta3p) - 0.01080173205443332*z[155]*(z[1]*phi2p+z[2]*phi1p)*(z[3]*
  z[13]*(z[5]+1.376118514983941*z[6])*theta3p+z[12]*(1.376118514983941*z[5]-
  z[6])*theta2p) - 0.006236382909341282*z[248]*(z[1]*phi2p+z[2]*phi1p)*(z[11]*
  theta1p+1.732050807568878*(z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])*theta3p) - 0.00623638290934128*z[246]*(
  z[1]*phi2p+z[2]*phi1p)*(z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*
  z[22])*theta2p-(z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*
  theta3p) - 0.006123209044105501*(z[11]*theta1p+1.678199262354559*z[21]*
  theta3p-1.678199262354559*z[22]*theta2p)*(z[3]*z[13]*(z[5]+1.376118514983941*
  z[6])*theta3p+z[12]*(1.376118514983941*z[5]-z[6])*theta2p) - 0.005342368970940251*
  z[11]*(phi2p*z[127]+1.796395140445148*phi1p*z[122]+1.796395140445148*z[13]*
  theta3p*z[124]);
  z[350] = Td2*z[20] + Td3*z[21] + 0.642787609686539*T3*z[21] + 0.6427876096865391*
  T2*z[21] + 0.6427876096865393*T1*z[21] + 0.6634139481689384*T3*z[20] + 
  0.766044443118978*T1*z[18] + 1.339140853513623*T1*(2.030853223771491*z[4]*
  z[13]-1.191753592594211*z[18]-z[21]-1.305407289332279*z[13]*z[58]) + 0.797962961582269*
  T3*(z[18]+2.951567327462619*z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*
  z[21]-2.190733550029694*z[13]*z[73]-1.704088191041847*z[4]*z[13]) + 1.339140853513623*
  T2*(1.015426611885745*z[18]+1.032088886237957*z[20]-z[21]-1.758770483143635*
  z[13]*z[16]-1.305407289332279*z[13]*z[65]-1.015426611885745*z[4]*z[13]) + 
  0.01940417897097459*z[146]*(z[1]*phi2p+z[2]*phi1p)*(z[19]*theta2p+z[20]*
  theta3p) + 0.01940417897097459*z[319]*(z[1]*phi2p+z[2]*phi1p)*(z[19]*theta2p+
  z[20]*theta3p) + 0.09056263069742683*z[49]*(z[1]*phi2p+z[2]*phi1p)*(z[19]*
  theta2p+z[20]*theta3p) + 0.09056263069742683*z[46]*(z[19]*theta2p+z[20]*
  theta3p)*(z[1]*phi1p-z[2]*phi2p) + 0.01247276581868257*z[50]*(z[1]*phi2p+
  z[2]*phi1p)*(z[11]*theta1p-1.19175359259421*z[22]*theta2p-(z[18]-1.19175359259421*
  z[21])*theta3p) + 0.01247276581868257*z[314]*(z[1]*phi2p+z[2]*phi1p)*(z[11]*
  theta1p-1.19175359259421*z[22]*theta2p-(z[18]-1.19175359259421*z[21])*
  theta3p) + 0.14375*(z[51]+z[313])*(z[1]*phi2p+z[2]*phi1p)*(z[48]*(z[1]*
  phi2p+z[2]*phi1p)-z[51]*(z[1]*phi1p-z[2]*phi2p)) + 0.14375*(z[50]+z[314])*(
  z[1]*phi2p+z[2]*phi1p)*(2.712*z[18]*theta3p+z[47]*(z[1]*phi2p+z[2]*phi1p)-
  2.712*z[11]*theta1p-z[50]*(z[1]*phi1p-z[2]*phi2p)) + 0.14375*(2.712*z[19]*
  theta2p+2.712*z[20]*theta3p+z[46]*(z[1]*phi2p+z[2]*phi1p)-z[49]*(z[1]*phi1p-
  z[2]*phi2p))*(z[49]*(z[1]*phi2p+z[2]*phi1p)+z[46]*(z[1]*phi1p-z[2]*phi2p)-
  z[2]*z[3]*(z[1]*phi2p+z[2]*phi1p)-z[1]*z[3]*(z[1]*phi1p-z[2]*phi2p)) + 
  0.006236382909341285*(z[1]*phi2p+z[2]*phi1p)*(1.555723826860413*z[157]*(
  1.732050807568878*z[11]*theta1p-z[19]*theta2p-(z[20]+1.732050807568878*
  z[18])*theta3p)+1.555723826860413*z[318]*(1.732050807568878*z[11]*theta1p-
  z[19]*theta2p-(z[20]+1.732050807568878*z[18])*theta3p)-z[158]*(z[11]*theta1p+
  1.732050807568878*(z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])*theta3p)-z[317]*(z[11]*theta1p+1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p)) + 0.092*z[21]*theta2p*z[29] + 2.163821127507611*
  z[20]*theta2p*z[25] + 0.06024354584601803*z[13]*z[19]*theta2p*z[26] + 
  0.09638967335362887*z[13]*z[20]*theta3p*z[26] + 0.006024354584601799*(z[20]+
  1.732050807568878*z[18])*theta2p*z[25] + 0.01043448822334082*(z[19]-1.376118514983941*
  z[22])*theta2p*z[23] + 0.01043448822334082*z[18]*theta2p*(z[25]-1.376118514983941*
  z[29]) + 0.02086897644668164*(z[20]+1.732050807568878*z[18])*theta3p*z[23] + 
  0.01807306375380541*z[13]*(z[19]+1.376118514983941*z[22])*theta2p*z[26] + 
  0.01807306375380541*z[13]*(z[19]-1.376118514983941*z[22])*theta2p*z[26] + 
  0.02086897644668164*(1.732050807568878*z[18]-z[20])*theta3p*z[23] + 0.02086897644668164*
  z[18]*theta3p*(1.732050807568878*z[23]+z[13]*z[26]) + 2.200967255015221*(
  z[11]*theta1p-2*z[18]*theta3p)*z[23] + 0.0120487091692036*(z[18]+1.732050807568878*
  z[20]+2.383507185188421*z[21])*theta3p*z[23] + 0.01940417897097459*z[20]*(
  z[1]*phi1p-z[2]*phi2p)*z[185] + 0.09056263069742683*z[18]*(z[1]*phi1p-z[2]*
  phi2p)*z[172] + 0.09056263069742683*z[20]*(z[1]*phi1p-z[2]*phi2p)*z[169] + 
  0.09056263069742683*z[50]*(z[1]*phi1p-z[2]*phi2p)*z[23] + 0.01940417897097459*
  z[13]*z[146]*(z[1]*phi1p-z[2]*phi2p)*z[26] + 0.09056263069742683*z[13]*
  z[49]*(z[1]*phi1p-z[2]*phi2p)*z[26] + 0.009702089485487295*(z[20]+1.732050807568878*
  z[18])*(z[1]*phi2p+z[2]*phi1p)*z[193] + 0.01247276581868257*(z[18]-1.19175359259421*
  z[21])*(z[1]*phi2p+z[2]*phi1p)*z[171] + 0.0287181848770424*(z[22]*theta2p+
  1.67819926235456*(z[18]-1.19175359259421*z[21])*theta3p)*z[23] + 0.004311279179235319*(
  z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*theta2p*(z[25]+
  1.376118514983941*z[29]) + 0.006024354584601801*(z[19]*theta2p+2*z[20]*
  theta3p)*(1.732050807568878*z[23]+z[13]*z[26]) + 0.009702089485487295*
  z[154]*(z[1]*phi2p+z[2]*phi1p)*(1.732050807568878*z[23]+z[13]*z[26]) + 
  0.01247276581868257*z[47]*(z[1]*phi2p+z[2]*phi1p)*(z[23]-1.19175359259421*
  z[13]*z[28]) + 0.0287181848770424*z[18]*(theta2p*z[29]+1.67819926235456*
  theta3p*(z[23]-1.19175359259421*z[13]*z[28])) + 0.00431127917923532*(1.732050807568878*
  z[20]-2.38350718518842*z[21]-z[18])*theta2p*(z[25]-1.376118514983941*z[29]) + 
  0.009702089485487293*(1.732050807568878*z[18]-z[20])*(z[1]*phi1p-z[2]*phi2p)*
  z[177] + 0.006236382909341283*(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*(z[1]*phi2p+z[2]*phi1p)*z[187] + 0.006236382909341283*(z[18]+
  1.732050807568878*z[20]+2.383507185188421*z[21])*(z[1]*phi1p-z[2]*phi2p)*
  z[174] + 0.009702089485487293*z[151]*(z[1]*phi1p-z[2]*phi2p)*(1.732050807568878*
  z[23]-z[13]*z[26]) + 0.01043448822334082*(z[19]*theta2p+2*z[20]*theta3p)*(
  z[23]+1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*z[28]) + 0.006024354584601801*(
  z[11]*theta1p-2*z[18]*theta3p)*(1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*
  z[13]*z[28]) + 0.006236382909341283*z[152]*(z[1]*phi1p-z[2]*phi2p)*(z[23]+
  1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*z[28]) + 0.006236382909341283*
  z[155]*(z[1]*phi2p+z[2]*phi1p)*(1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*
  z[13]*z[28]) + 0.01043448822334082*(z[19]*theta2p+2*z[20]*theta3p)*(1.732050807568878*
  z[13]*z[26]-z[23]-2.38350718518842*z[13]*z[28]) + 0.009956472778732566*(
  z[11]*theta1p-1.19175359259421*z[22]*theta2p-2*(z[18]-1.19175359259421*
  z[21])*theta3p)*(z[23]-1.19175359259421*z[13]*z[28]) + 0.006024354584601799*(
  1.732050807568878*z[11]*theta1p-z[19]*theta2p-2*(z[20]+1.732050807568878*
  z[18])*theta3p)*(1.732050807568878*z[23]+z[13]*z[26]) + 0.006024354584601798*(
  z[19]*theta2p+1.732050807568878*z[11]*theta1p-2*(1.732050807568878*z[18]-
  z[20])*theta3p)*(1.732050807568878*z[23]-z[13]*z[26]) + 0.002489118194683139*(
  z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-2*(
  z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p)*(z[23]+
  1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*z[28]) + 0.007374101413072466*(
  1.555723826860413*z[4]*z[13]-1.351145601417332*z[18]-1.133745775816087*
  z[21]-z[13]*z[58])*(z[5]*phi2p*theta1p-theta2p*z[29]-1.305407289332279*
  phi1p*(1.555723826860413*z[4]*theta2p-z[117])-theta3p*(2.030853223771491*
  z[3]*z[13]*theta2p-1.191753592594211*z[23]-1.305407289332279*z[13]*z[114]-
  z[13]*z[28])) + 0.003539568678274784*(z[21]*theta3p+1.19175359259421*z[18]*
  theta3p+2.083333333333334*z[6]*phi2p+2.719598519442247*(z[56]+1.555723826860413*
  z[3])*phi1p-3.674573577165482*z[11]*theta1p-3.083333333333334*z[22]*theta2p-
  2.083333333333333*(2.030853223771491*z[4]*z[13]-1.191753592594211*z[18]-
  z[21]-1.305407289332279*z[13]*z[58])*theta3p)*(1.555723826860412*z[3]*z[13]*
  theta2p-1.351145601417332*z[23]-1.133745775816087*z[13]*z[28]-z[13]*z[114]) + 
  0.002968504668122412*(z[18]+1.994302248285554*z[13]*z[16]-1.732050807568878*
  z[20]-1.678199262354559*z[21]-1.480225371641685*z[13]*z[73]-1.15141093989314*
  z[4]*z[13])*(1.219516519893741*phi2p*(2.420276625461207*z[6]*theta1p+z[135])-
  1.678199262354559*theta2p*(z[29]+1.032088886237958*z[25])-1.704088191041847*
  phi1p*(1.732050807568878*z[121]-z[4]*theta2p-1.285575219373079*z[130])-
  theta3p*(z[23]+1.219516519893741*z[13]*z[26]-1.704088191041847*z[3]*z[13]*
  theta2p-2.190733550029694*z[13]*z[132]-1.678199262354559*z[13]*z[28])) + 
  0.004168269355105559*(1.281675562640063*z[18]+1.504285522708015*z[20]-
  1.457515474458068*z[21]-1.732050807568878*z[13]*z[16]-1.285575219373079*
  z[13]*z[65]-z[4]*z[13])*(1.376118514983941*theta2p*(1.758770483143635*z[25]-
  z[29])+1.397347361223386*phi1p*(z[4]*theta2p+1.285575219373079*z[122]+
  1.732050807568878*z[121])-phi2p*(2.420276625461207*z[6]*theta1p-z[127])-
  theta3p*(1.397347361223386*z[23]-1.397347361223386*z[3]*z[13]*theta2p-z[13]*(
  z[26]+1.376118514983941*z[28]+1.796395140445148*z[124]))) + 0.000186838710237427*(
  1.67819926235456*z[21]*theta3p+1.732050807568878*z[19]*theta2p+1.732050807568878*
  z[20]*theta3p+3.083333333333334*z[11]*theta1p+3.496248463238665*(1.032088886237958*
  z[19]-z[22])*theta2p-1.67819926235456*z[22]*theta2p-z[18]*theta3p-4.564028229228534*(
  1.347296355333861*z[5]-z[71])*phi2p-3.550183731337182*(z[3]+1.732050807568878*
  z[14]-1.285575219373079*z[68])*phi1p-2.083333333333334*(z[18]+2.951567327462619*
  z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*z[21]-2.190733550029694*
  z[13]*z[73]-1.704088191041847*z[4]*z[13])*theta3p)*(3.813134437954735*z[23]+
  z[13]*z[26]-4.390484707144361*z[3]*z[13]*theta2p-6.399199401034402*z[13]*
  z[28]-5.644298340541257*z[13]*z[132]) + 0.0001868387102374271*(1.67819926235456*
  z[21]*theta3p+1.732050807568878*z[19]*theta2p+1.732050807568878*z[20]*
  theta3p+3.083333333333334*z[11]*theta1p+3.496248463238664*(1.032088886237958*
  z[19]-z[22])*theta2p-1.67819926235456*z[22]*theta2p-z[18]*theta3p-4.564028229228533*(
  1.347296355333861*z[5]-z[71])*phi2p-3.550183731337181*(z[3]+1.732050807568878*
  z[14]-1.285575219373079*z[68])*phi1p-2.083333333333334*(z[18]+2.951567327462619*
  z[13]*z[16]-1.732050807568878*z[20]-1.678199262354559*z[21]-2.190733550029694*
  z[13]*z[73]-1.704088191041847*z[4]*z[13])*theta3p)*(3.813134437954733*z[23]+
  z[13]*z[26]-4.390484707144358*z[3]*z[13]*theta2p-6.399199401034399*z[13]*
  z[28]-5.644298340541254*z[13]*z[132]) + 0.0003877680527485566*(1.678199262354561*
  z[21]*theta3p+4.550183731337183*z[11]*theta1p+4.564028229228534*(z[63]+
  1.347296355333861*z[5])*phi2p-1.732050807568878*z[19]*theta2p-1.732050807568878*
  z[20]*theta3p-1.678199262354561*z[22]*theta2p-z[18]*theta3p-3.496248463238667*(
  z[22]+1.758770483143635*z[19])*theta2p-3.550183731337182*(z[3]-1.732050807568878*
  z[14]-1.285575219373079*z[60])*phi1p-3.496248463238667*(1.015426611885745*
  z[18]+1.032088886237957*z[20]-z[21]-1.758770483143635*z[13]*z[16]-1.305407289332279*
  z[13]*z[65]-1.015426611885745*z[4]*z[13])*theta3p)*(2.711348904392406*z[23]+
  1.032088886237957*z[13]*z[26]-2.115472108095302*z[3]*z[13]*theta2p-z[13]*
  z[28]-1.513919993553495*z[13]*(z[26]+1.376118514983941*z[28]+1.796395140445148*
  z[124])) + 0.0003877680527485566*(1.67819926235456*z[21]*theta3p+4.550183731337183*
  z[11]*theta1p+4.564028229228534*(z[63]+1.347296355333861*z[5])*phi2p-1.732050807568878*
  z[19]*theta2p-1.732050807568878*z[20]*theta3p-1.67819926235456*z[22]*theta2p-
  z[18]*theta3p-3.496248463238667*(z[22]+1.758770483143635*z[19])*theta2p-
  3.550183731337182*(z[3]-1.732050807568878*z[14]-1.285575219373079*z[60])*
  phi1p-3.496248463238667*(1.015426611885745*z[18]+1.032088886237957*z[20]-
  z[21]-1.758770483143635*z[13]*z[16]-1.305407289332279*z[13]*z[65]-1.015426611885745*
  z[4]*z[13])*theta3p)*(2.711348904392406*z[23]+1.032088886237957*z[13]*z[26]-
  2.115472108095301*z[3]*z[13]*theta2p-z[13]*z[28]-1.513919993553494*z[13]*(
  z[26]+1.376118514983941*z[28]+1.796395140445148*z[124])) - Td1*z[18] - 
  0.6634139481689384*T2*z[20] - 0.383022221559489*T3*z[18] - 0.3830222215594888*
  T2*z[18] - 0.09056263069742683*z[2]*z[3]*(z[1]*phi2p+z[2]*phi1p)*(z[19]*
  theta2p+z[20]*theta3p) - 0.09056263069742683*z[50]*(z[1]*phi2p+z[2]*phi1p)*(
  z[11]*theta1p-z[18]*theta3p) - 0.09056263069742683*z[314]*(z[1]*phi2p+z[2]*
  phi1p)*(z[11]*theta1p-z[18]*theta3p) - 0.09056263069742683*z[1]*z[3]*(z[19]*
  theta2p+z[20]*theta3p)*(z[1]*phi1p-z[2]*phi2p) - 0.009702089485487293*
  z[151]*(z[1]*phi2p+z[2]*phi1p)*(z[19]*theta2p+1.732050807568878*z[11]*
  theta1p-(1.732050807568878*z[18]-z[20])*theta3p) - 0.009702089485487293*
  z[315]*(z[1]*phi2p+z[2]*phi1p)*(z[19]*theta2p+1.732050807568878*z[11]*
  theta1p-(1.732050807568878*z[18]-z[20])*theta3p) - 0.006236382909341283*
  z[152]*(z[1]*phi2p+z[2]*phi1p)*(z[11]*theta1p-1.732050807568878*(z[19]-
  1.376118514983941*z[22])*theta2p-(z[18]+1.732050807568878*z[20]+2.383507185188421*
  z[21])*theta3p) - 0.006236382909341283*z[316]*(z[1]*phi2p+z[2]*phi1p)*(
  z[11]*theta1p-1.732050807568878*(z[19]-1.376118514983941*z[22])*theta2p-(
  z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*theta3p) - 0.006236382909341283*(
  3.111447653720826*z[20]*z[146]+77.03385723442858*z[18]*z[50]+77.03385723442858*
  z[20]*z[49]+1.555723826860412*z[151]*(1.732050807568878*z[18]-z[20])+z[152]*(
  z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])-2*z[50]*(z[18]-
  1.19175359259421*z[21])-1.555723826860413*z[157]*(z[20]+1.732050807568878*
  z[18])-z[158]*(1.732050807568878*z[20]-2.38350718518842*z[21]-z[18]))*
  theta3p*(z[1]*phi2p+z[2]*phi1p) - 0.006236382909341283*(3.111447653720826*
  z[20]*z[144]+77.03385723442858*z[18]*z[47]+77.03385723442858*z[20]*z[46]+
  1.555723826860412*z[148]*(1.732050807568878*z[18]-z[20])+z[149]*(z[18]+
  1.732050807568878*z[20]+2.383507185188421*z[21])-2*z[47]*(z[18]-1.19175359259421*
  z[21])-1.555723826860413*z[154]*(z[20]+1.732050807568878*z[18])-z[155]*(
  1.732050807568878*z[20]-2.38350718518842*z[21]-z[18]))*theta3p*(z[1]*phi1p-
  z[2]*phi2p) - 0.07229225501522164*z[11]*theta1p*z[23] - 0.01807306375380541*
  z[20]*theta2p*(z[25]-1.376118514983941*z[29]) - 0.01807306375380541*z[20]*
  theta2p*(z[25]+1.376118514983941*z[29]) - 0.01186566220362099*(z[18]-1.19175359259421*
  z[21])*theta2p*z[29] - 0.01043448822334082*(z[19]+1.376118514983941*z[22])*
  theta2p*z[23] - 0.01043448822334082*z[18]*theta2p*(z[25]+1.376118514983941*
  z[29]) - 0.09056263069742683*z[18]*(z[1]*phi2p+z[2]*phi1p)*z[171] - 0.09056263069742683*
  z[20]*(z[1]*phi2p+z[2]*phi1p)*z[168] - 0.09056263069742683*z[47]*(z[1]*
  phi2p+z[2]*phi1p)*z[23] - 0.02409741833840722*z[11]*theta1p*(z[23]-1.19175359259421*
  z[13]*z[28]) - 0.01940417897097459*z[20]*(z[1]*phi2p+z[2]*phi1p)*z[181] - 
  0.01043448822334082*z[11]*theta1p*(1.732050807568878*z[23]+z[13]*z[26]) - 
  2.224064673353629*z[13]*(z[19]*theta2p+2*z[20]*theta3p)*z[26] - 0.09056263069742683*
  z[13]*z[46]*(z[1]*phi2p+z[2]*phi1p)*z[26] - 0.01940417897097459*z[13]*
  z[144]*(z[1]*phi2p+z[2]*phi1p)*z[26] - 0.0120487091692036*z[13]*(1.732050807568878*
  z[18]-z[20])*theta3p*z[26] - 0.0120487091692036*z[20]*theta3p*(1.732050807568878*
  z[23]-z[13]*z[26]) - 0.006024354584601798*z[19]*theta2p*(1.732050807568878*
  z[23]-z[13]*z[26]) - 0.092*z[13]*(2*z[21]*theta3p-z[22]*theta2p)*z[28] - 
  0.0120487091692036*(1.732050807568878*z[20]-2.38350718518842*z[21]-z[18])*
  theta3p*z[23] - 0.01247276581868257*(z[18]-1.19175359259421*z[21])*(z[1]*
  phi1p-z[2]*phi2p)*z[172] - 0.009702089485487295*(z[20]+1.732050807568878*
  z[18])*(z[1]*phi1p-z[2]*phi2p)*z[190] - 0.009702089485487293*(1.732050807568878*
  z[18]-z[20])*(z[1]*phi2p+z[2]*phi1p)*z[179] - 0.0060243545846018*(z[20]+
  1.732050807568878*z[18])*(theta2p*z[25]-2*z[13]*theta3p*z[26]) - 0.01247276581868257*
  z[50]*(z[1]*phi1p-z[2]*phi2p)*(z[23]-1.19175359259421*z[13]*z[28]) - 0.01043448822334082*(
  z[11]*theta1p-2*z[18]*theta3p)*(1.732050807568878*z[23]-z[13]*z[26]) - 
  0.009702089485487295*z[157]*(z[1]*phi1p-z[2]*phi2p)*(1.732050807568878*
  z[23]+z[13]*z[26]) - 0.009702089485487293*z[148]*(z[1]*phi2p+z[2]*phi1p)*(
  1.732050807568878*z[23]-z[13]*z[26]) - 0.006236382909341283*(z[18]+1.732050807568878*
  z[20]+2.383507185188421*z[21])*(z[1]*phi2p+z[2]*phi1p)*z[180] - 0.01043448822334082*(
  z[18]+1.732050807568878*z[20]+2.383507185188421*z[21])*(theta2p*z[25]-2*
  z[13]*theta3p*z[26]) - 0.01043448822334082*(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*(theta2p*z[25]-2*z[13]*theta3p*z[26]) - 0.006236382909341283*(
  1.732050807568878*z[20]-2.38350718518842*z[21]-z[18])*(z[1]*phi1p-z[2]*
  phi2p)*z[192] - 0.006236382909341283*z[149]*(z[1]*phi2p+z[2]*phi1p)*(z[23]+
  1.732050807568878*z[13]*z[26]+2.383507185188421*z[13]*z[28]) - 0.006024354584601798*(
  z[11]*theta1p-2*z[18]*theta3p)*(z[23]+1.732050807568878*z[13]*z[26]+2.383507185188421*
  z[13]*z[28]) - 0.38985*z[18]*((z[1]*phi2p+z[2]*phi1p)*z[171]-(z[1]*phi1p-
  z[2]*phi2p)*z[172]) - 0.006236382909341283*z[158]*(z[1]*phi1p-z[2]*phi2p)*(
  1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*z[13]*z[28]) - 0.38985*
  z[20]*((z[1]*phi2p+z[2]*phi1p)*z[168]-2.712*theta2p*z[25]-(z[1]*phi1p-z[2]*
  phi2p)*z[169]) - 0.003539568678274785*(1.555723826860413*z[4]*z[13]-1.351145601417332*
  z[18]-1.133745775816087*z[21]-z[13]*z[58])*(theta2p*z[29]-1.19175359259421*
  theta3p*z[23]-z[13]*theta3p*z[28]) - 0.0004621239699563536*(z[18]-1.732050807568878*
  z[20])*(theta3p*z[23]+1.67819926235456*theta2p*z[29]+1.732050807568878*
  theta2p*z[25]-1.732050807568878*z[13]*theta3p*z[26]-1.67819926235456*z[13]*
  theta3p*z[28]) - 0.38985*(5.424*z[18]*theta3p+z[47]*(z[1]*phi2p+z[2]*phi1p)-
  2.712*z[11]*theta1p-z[50]*(z[1]*phi1p-z[2]*phi2p))*z[23] - 0.38985*z[13]*(
  2.712*z[19]*theta2p+5.424*z[20]*theta3p+z[46]*(z[1]*phi2p+z[2]*phi1p)-z[49]*(
  z[1]*phi1p-z[2]*phi2p))*z[26] - 0.00248911819468314*(z[11]*theta1p+1.732050807568878*(
  z[19]+1.376118514983941*z[22])*theta2p+2*(1.732050807568878*z[20]-2.38350718518842*
  z[21]-z[18])*theta3p)*(1.732050807568878*z[13]*z[26]-z[23]-2.38350718518842*
  z[13]*z[28]) - 0.000962758270742404*(z[18]+2.951567327462619*z[13]*z[16]-
  2.483734908284747*z[21]-1.732050807568878*z[20]-2.190733550029694*z[13]*
  z[73]-1.704088191041847*z[4]*z[13])*(theta3p*z[23]+1.67819926235456*theta2p*
  z[29]+1.732050807568878*theta2p*z[25]-1.732050807568878*z[13]*theta3p*z[26]-
  1.67819926235456*z[13]*theta3p*z[28]) - 0.0008203124999999993*(1.281675562640063*
  z[18]+1.504285522708015*z[20]-1.457515474458068*z[21]-1.732050807568878*
  z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13])*(theta3p*z[23]+1.67819926235456*
  theta2p*z[29]+1.732050807568878*z[13]*theta3p*z[26]-1.732050807568878*
  theta2p*z[25]-1.67819926235456*z[13]*theta3p*z[28]) - 0.0008203124999999993*(
  1.281675562640063*z[18]+1.504285522708015*z[20]-1.457515474458068*z[21]-
  1.732050807568878*z[13]*z[16]-1.285575219373079*z[13]*z[65]-z[4]*z[13])*(
  theta3p*z[23]+1.678199262354561*theta2p*z[29]+1.732050807568878*z[13]*
  theta3p*z[26]-1.732050807568878*theta2p*z[25]-1.678199262354561*z[13]*
  theta3p*z[28]);
  z[447] = (z[413]*z[347]+z[433]*z[349]-z[394]*z[346]-z[422]*z[348]-z[442]*
  z[350])/z[381];
  phi1pp = -z[447];
  z[448] = (z[417]*z[347]+z[437]*z[349]-z[401]*z[346]-z[423]*z[348]-z[443]*
  z[350])/z[381];
  phi2pp = z[448];
  z[449] = (z[419]*z[347]+z[439]*z[349]-z[404]*z[346]-z[424]*z[348]-z[444]*
  z[350])/z[381];
  theta1pp = -z[449];
  z[450] = (z[420]*z[347]+z[440]*z[349]-z[405]*z[346]-z[425]*z[348]-z[445]*
  z[350])/z[381];
  theta2pp = z[450];
  z[451] = (z[421]*z[347]+z[441]*z[349]-z[406]*z[346]-z[426]*z[348]-z[446]*
  z[350])/z[381];
  theta3pp = -z[451];
  q1pp = z[138] + z[95]*theta3pp + z[96]*phi1pp + 0.6427876096865393*z[97]*
  theta1pp + 0.766044443118978*z[98]*theta2pp - 0.766044443118978*z[99]*
  phi2pp;
  q2pp = z[139] + z[100]*phi1pp + z[101]*theta3pp + z[102]*theta2pp + z[103]*
  phi2pp - 0.4999999999999997*z[104]*theta1pp;
  q3pp = z[140] + z[105]*phi1pp + z[106]*theta3pp + z[107]*theta2pp + z[108]*
  phi2pp - 0.3213938048432694*z[109]*theta1pp;
  q1dd = q1pp;
  q2dd = q2pp;
  q3dd = q3pp;
  abx = z[11]*theta1pp - z[24] - z[18]*theta3pp;
  aby = z[27] + z[19]*theta2pp + z[20]*theta3pp;
  abz = z[30] + z[21]*theta3pp - z[22]*theta2pp;

}

/* ................................ OUTPUT ............................. */
void     output (FILE *Fptr[] )
{
int      i1;

/* Write output to screen and to output file(s) */

  Encode[0] = phi1pp;
  Encode[1] = phi2pp;
  Encode[2] = theta1pp;
  Encode[3] = theta2pp;
  Encode[4] = theta3pp;
  Encode[5] = wbx;
  Encode[6] = wby;
  Encode[7] = wbz;
  Encode[8] = abx;
  Encode[9] = aby;
  Encode[10] = abz;
  Encode[11] = q1d;
  Encode[12] = q2d;
  Encode[13] = q3d;
  Encode[14] = q1dd;
  Encode[15] = q2dd;
  Encode[16] = q3dd;

}

/*................................... READF ................................*/
void  readf( FILE *Fp, double *next, ... )
{
va_list args;                                    /* Variable argument list  */
for( va_start(args,next);  next;  next=va_arg(args,double *) )
  pgets(Fp,next);
va_end(args);                          /* Help function make normal return  */
pgets(Fp,NULL);                        /* Always get a newline at the end   */
}

/*................................... PGETS ................................*/
void  pgets( FILE *Fp, double *x )
{
static long  lineNumber = 0;
char         line[256];

lineNumber++;
if( !fgets(line,256,Fp) )
{
   printf("\n Unable to read line %ld of input file."
          "\n Premature end of file found while reading input file\n", lineNumber);
   exit(0);
}
if( !x ) return;
if( strlen(line) >= 60 )
{
   char *endOfNumber;
   *x = strtod(line+59,&endOfNumber);
   while( isspace(*endOfNumber) )  endOfNumber++;
   if( !*endOfNumber ) return;
}
printf("\n An error occured while reading line %ld of the input file."
       "\n The program was expecting to find one double precision number"
       "\n beginning with the 60th character in the following line:\n\n%s\n",
           lineNumber, line );
exit(0);
}

/* .................................. WRITEF .............................. */
void  writef( FILE *Fp, char format[], ... )
{
va_list  args;                                   /* Variable argument list  */
double   next;                                   /* Current place in list   */

va_start(args,format);                           /* args start after format */
while( (next=va_arg(args,double)) != _NAN )  fprintf(Fp, format, next);
va_end(args);                                    /* End of variable list    */
fprintf(Fp, "\n");                               /* End with newline        */
}