Problem: Notice: unusual memory limit!

After the war, destroyed cities in the neutral zone were restored. And children went back to school.

The war changed the world, as well as education. In those hard days, a new math concept was created.

As we all know, logarithm function can be described as: $$$ log(p_1^{a_1}p_2^{a_2}...p_k^{a_2}) = a_1 log p_1 + a_2 log p_2 + ... + a_k log p_k  Where p_1^{a_1}p_2^{a_2}...p_k^{a_2}$$$ is the prime factorization of a integer. A problem is that the function uses itself in the definition. That is why it is hard to calculate.

So, the mathematicians from the neutral zone invented this: $$$ exlog_f(p_1^{a_1}p_2^{a_2}...p_k^{a_2}) = a_1 f(p_1) + a_2 f(p_2) + ... + a_k f(p_k) $$$

Notice that exlog_f(1) is always equal to 0.

This concept for any function f was too hard for children. So teachers told them that f can only be a polynomial of degree no more than 3 in daily uses (i.e., f(x) = Ax^3+Bx^2+Cx+D).

"Class is over! Don't forget to do your homework!" Here it is: $$$ ∑_{i=1}^n exlog_f(i) $$$

Help children to do their homework. Since the value can be very big, you need to find the answer modulo 2^{32}.

Input

The only line contains five integers n, A, B, C, and D (1 ≤ n ≤ 3 ⋅ 10^8, 0 ≤ A,B,C,D ≤ 10^6).

Output

Print the answer modulo 2^{32}.

Examples

Input

12 0 0 1 0


Output

63


Input

4 1 2 3 4


Output

136

Note

In the first sample:

exlog_f(1) = 0

exlog_f(2) = 2

exlog_f(3) = 3

exlog_f(4) = 2 + 2 = 4

exlog_f(5) = 5

exlog_f(6) = 2 + 3 = 5

exlog_f(7) = 7

exlog_f(8) = 2 + 2 + 2 = 6

exlog_f(9) = 3 + 3 = 6

exlog_f(10) = 2 + 5 = 7

exlog_f(11) = 11

exlog_f(12) = 2 + 2 + 3 = 7

 ∑_{i=1}^{12} exlog_f(i)=63 

In the second sample:

exlog_f(1) = 0

exlog_f(2) = (1 × 2^3 + 2 × 2^2 + 3 × 2 + 4) = 26

exlog_f(3) = (1 × 3^3 + 2 × 3^2 + 3 × 3 + 4) = 58

exlog_f(4) = 2 × exlog_f(2) = 52

 ∑_{i=1}^4 exlog_f(i)=0+26+58+52=136 

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
unsigned int tab0[] = {
    0,          1059501,    2152465,    3256790,    4368256,    5484949,
    6605707,    7729832,    8856766,    9986203,    11117795,   12251315,
    13386601,   14523448,   15661803,   16801511,   17942462,   19084578,
    20227820,   21372074,   22517334,   23663501,   24810557,   25958418,
    27107125,   28256577,   29406747,   30557650,   31709201,   32861411,
    34014232,   35167667,   36321686,   37476268,   38631393,   39787032,
    40943207,   42099848,   43256986,   44414600,   45572678,   46731177,
    47890129,   49049487,   50209274,   51369460,   52530015,   53690971,
    54852301,   56013984,   57176045,   58338447,   59501190,   60664269,
    61827699,   62991435,   64155471,   65319823,   66484509,   67649465,
    68814710,   69980278,   71146107,   72312233,   73478631,   74645277,
    75812213,   76979400,   78146847,   79314542,   80482483,   81650679,
    82819115,   83987785,   85156690,   86325858,   87495204,   88664801,
    89834602,   91004634,   92174917,   93345365,   94516021,   95686907,
    96858017,   98029311,   99200802,   100372489,  101544373,  102716443,
    103888691,  105061170,  106233785,  107406608,  108579647,  109752807,
    110926163,  112099737,  113273441,  114447319,  115621391,  116795600,
    117969993,  119144537,  120319289,  121494147,  122669214,  123844417,
    125019776,  126195246,  127370936,  128546747,  129722713,  130898825,
    132075127,  133251543,  134428127,  135604798,  136781646,  137958638,
    139135746,  140313054,  141490444,  142667987,  143845654,  145023480,
    146201428,  147379504,  148557678,  149736058,  150914494,  152093096,
    153271812,  154450652,  155629626,  156808703,  157987937,  159167280,
    160346738,  161526331,  162706054,  163885832,  165065794,  166245836,
    167425989,  168606281,  169786679,  170967173,  172147809,  173328519,
    174509405,  175690354,  176871377,  178052540,  179233829,  180415229,
    181596681,  182778288,  183959974,  185141831,  186323718,  187505763,
    188687870,  189870088,  191052382,  192234772,  193417275,  194599919,
    195782620,  196965429,  198148346,  199331335,  200514438,  201697645,
    202880894,  204064296,  205247767,  206431290,  207614956,  208798744,
    209982518,  211166507,  212350554,  213534665,  214718836,  215903123,
    217087515,  218271966,  219456526,  220641148,  221825854,  223010668,
    224195550,  225380564,  226565639,  227750809,  228935987,  230121314,
    231306735,  232492237,  233677762,  234863390,  236049107,  237234906,
    238420803,  239606743,  240792796,  241978915,  243165129,  244351384,
    245537749,  246724177,  247910686,  249097225,  250283919,  251470627,
    252657483,  253844344,  255031326,  256218361,  257405438,  258592618,
    259779839,  260967167,  262154594,  263342041,  264529576,  265717183,
    266904884,  268092665,  269280466,  270468376,  271656320,  272844332,
    274032454,  275220597,  276408871,  277597166,  278785581,  279973972,
    281162504,  282351033,  283539712,  284728402,  285917183,  287106057,
    288294923,  289483928,  290672931,  291862059,  293051234,  294240455,
    295429754,  296619109,  297808512,  298997996,  300187541,  301377153,
    302566841,  303756572,  304946346,  306136215,  307326135,  308516108,
    309706163,  310896231,  312086397,  313276674,  314466933,  315657234,
    316847636,  318038075,  319228578,  320419177,  321609821,  322800543,
    323991242,  325182040,  326372958,  327563862,  328754826,  329945903,
    331136978,  332328132,  333519377,  334710587,  335901934,  337093323,
    338284718,  339476204,  340667758,  341859351,  343051005,  344242708,
    345434455,  346626253,  347818141,  349010077,  350202014,  351394078,
    352586180,  353778270,  354970447,  356162662,  357354949,  358547293,
    359739691,  360932093,  362124655,  363317189,  364509801,  365702467,
    366895173,  368087894,  369280708,  370473575,  371666460,  372859390,
    374052439,  375245470,  376438532,  377631756,  378824975,  380018178,
    381211505,  382404839,  383598227,  384791689,  385985178,  387178705,
    388372283,  389565954,  390759625,  391953375,  393147122,  394340957,
    395534863,  396728774,  397922734,  399116755,  400310826,  401504916,
    402699073,  403893252,  405087550,  406281819,  407476166,  408670556,
    409864937,  411059430,  412253965,  413448506,  414643148,  415837786,
    417032485,  418227251,  419422009,  420616871,  421811705,  423006647,
    424201570,  425396609,  426591635,  427786737,  428981886,  430177067,
    431372259,  432567488,  433762867,  434958229,  436153602,  437349078,
    438544544,  439740046,  440935570,  442131229,  443326837,  444522563,
    445718261,  446914045,  448109889,  449305737,  450501618,  451697560,
    452893517,  454089561,  455285636,  456481739,  457677821,  458874032,
    460070259,  461266504,  462462802,  463659150,  464855496,  466051941,
    467248423,  468444937,  469641528,  470838054,  472034670,  473231283,
    474428023,  475624763,  476821502,  478018324,  479215208,  480412034,
    481609018,  482806005,  484002963,  485200053,  486397097,  487594213,
    488791376,  489988551,  491185784,  492383052,  493580327,  494777696,
    495975105,  497172526,  498369953,  499567443,  500764984,  501962547,
    503160121,  504357755,  505555444,  506753150,  507950861,  509148695,
    510346499,  511544370,  512742270,  513940218,  515138139,  516336140,
    517534183,  518732270,  519930352,  521128492,  522326670,  523524881,
    524723117,  525921403,  527119731,  528318077,  529516480,  530714921,
    531913332,  533111806,  534310343,  535508891,  536707478,  537906097,
    539104757,  540303482,  541502239,  542700984,  543899790,  545098627,
    546297528,  547496385,  548695336,  549894279,  551093281,  552292284,
    553491347,  554690453,  555889594,  557088788,  558287990,  559487240,
    560686456,  561885747,  563085099,  564284426,  565483811,  566683232,
    567882700,  569082190,  570281647,  571481271,  572680844,  573880501,
    575080119,  576279748,  577479529,  578679248,  579879056,  581078813,
    582278671,  583478570,  584678469,  585878388,  587078353,  588278373,
    589478381,  590678434,  591878556,  593078662,  594278814,  595478971,
    596679241,  597879465,  599079719,  600280020,  601480428,  602680768,
    603881158,  605081563,  606282026,  607482502,  608683007,  609883550,
    611084155,  612284712,  613485429,  614686046,  615886773,  617087454,
    618288237,  619489053,  620689849,  621890665,  623091564,  624292430,
    625493372,  626694386,  627895347,  629096342,  630297416,  631498465,
    632699608,  633900762,  635101889,  636303078,  637504314,  638705544,
    639906823,  641108131,  642309469,  643510839,  644712215,  645913630,
    647115094,  648316523,  649518047,  650719598,  651921176,  653122777,
    654324372,  655526024,  656727709,  657929419,  659131137,  660332895,
    661534619,  662736461,  663938250,  665140169,  666342061,  667543974,
    668745939,  669947853,  671149893,  672351915,  673553974,  674756042,
    675958178,  677160268,  678362473,  679564646,  680766895,  681969126,
    683171358,  684373692,  685575992,  686778352,  687980754,  689183112,
    690385577,  691588049,  692790543,  693993040,  695195560,  696398127,
    697600707,  698803320,  700005920,  701208595,  702411303,  703614003,
    704816760,  706019522,  707222342,  708425191,  709627977,  710830887,
    712033729,  713236635,  714439624,  715642590,  716845609,  718048615,
    719251678,  720454762,  721657841,  722860989,  724064160,  725267339,
    726470534,  727673784,  728877000,  730080253,  731283542,  732486906,
    733690214,  734893575,  736096968,  737300445,  738503898,  739707330,
    740910846,  742114356,  743317894,  744521467,  745725071,  746928714,
    748132353,  749336006,  750539738,  751743421,  752947131,  754150904,
    755354717,  756558541,  757762390,  758966232,  760170094,  761374058,
    762577984,  763781900,  764985903,  766189926,  767393932,  768597929,
    769802040,  771006130,  772210235,  773414359,  774618575,  775822773,
    777026999,  778231219,  779435511,  780639776,  781844092,  783048435,
    784252792,  785457152,  786661535,  787866020,  789070451,  790274882,
    791479401,  792683894,  793888440,  795092932,  796297569,  797502196,
    798706863,  799911466,  801116133,  802320805,  803525573,  804730239,
    805935063,  807139838,  808344615,  809549472,  810754330,  811959179,
    813164107,  814369015,  815573938,  816778934,  817983908,  819188941,
    820393939,  821598997,  822804050,  824009175,  825214306,  826419428,
    827624584,  828829793,  830034986,  831240177,  832445455,  833650712,
    834856031,  836061355,  837266710,  838471955,  839677374,  840882809,
    842088228,  843293666,  844499163,  845704608,  846910165,  848115704,
    849321291,  850526802,  851732363,  852937975,  854143648,  855349273,
    856554948,  857760651,  858966367,  860172099,  861377858,  862583663,
    863789460,  864995291,  866201156,  867407017,  868612866,  869818762,
    871024719,  872230698,  873436619,  874642675,  875848689,  877054725,
    878260746,  879466858,  880672925,  881879041,  883085232,  884291379,
    885497496,  886703646,  887909871,  889116121,  890322294,  891528633,
    892734982,  893941252,  895147631,  896353989,  897560342,  898766718,
    899973119,  901179568,  902386000,  903592518,  904799071,  906005581,
    907212071,  908418635,  909625215,  910831805,  912038451,  913245061,
    914451765,  915658410,  916865085,  918071775,  919278555,  920485291,
    921692062,  922898870,  924105637,  925312501,  926519396,  927726238,
    928933170,  930140075,  931346991,  932553942,  933760912,  934967918,
    936174911,  937381934,  938588888,  939796020,  941003081,  942210205,
    943417305,  944624440,  945831581,  947038803,  948246029,  949453230,
    950660464,  951867667,  953074975,  954282261,  955489550,  956696846,
    957904227,  959111610,  960319004,  961526385,  962733815,  963941278,
    965148758,  966356172,  967563725,  968771226,  969978775,  971186285,
    972393875,  973601456,  974809086,  976016717,  977224323,  978432053,
    979639723,  980847395,  982055148,  983262860,  984470613,  985678365,
    986886134,  988093916,  989301771,  990509609,  991717490,  992925367,
    994133285,  995341225,  996549132,  997757068,  998965036,  1000173026,
    1001381057, 1002589092, 1003797143, 1005005204, 1006213289, 1007421390,
    1008629495, 1009837637, 1011045736, 1012253913, 1013462088, 1014670377,
    1015878529, 1017086795, 1018295026, 1019503328, 1020711648, 1021919950,
    1023128258, 1024336554, 1025544890, 1026753343, 1027961769, 1029170131,
    1030378582, 1031587026, 1032795518, 1034003980, 1035212499, 1036421026,
    1037629530, 1038838128, 1040046672, 1041255257, 1042463822, 1043672466,
    1044881094, 1046089735, 1047298468, 1048507175, 1049715881, 1050924547,
    1052133334, 1053342114, 1054550877, 1055759631, 1056968438, 1058177282,
    1059386126, 1060595014, 1061803891, 1063012732, 1064221663, 1065430609,
    1066639574, 1067848543, 1069057527, 1070266527, 1071475521, 1072684559,
    1073893603, 1075102631, 1076311713, 1077520797, 1078729992, 1079939108,
    1081148212, 1082357431, 1083566588, 1084775766, 1085984978, 1087194204,
    1088403433, 1089612695, 1090821975, 1092031278, 1093240601, 1094449924,
    1095659222, 1096868604, 1098077938, 1099287386, 1100496815, 1101706188,
    1102915685, 1104125101, 1105334584, 1106544063, 1107753564, 1108963115,
    1110172648, 1111382220, 1112591786, 1113801388, 1115010909, 1116220556,
    1117430173, 1118639886, 1119849483, 1121059153, 1122268842, 1123478617,
    1124688342, 1125898073, 1127107883, 1128317637, 1129527441, 1130737245,
    1131947019, 1133156916, 1134366721, 1135576633, 1136786515, 1137996389,
    1139206314, 1140416251, 1141626219, 1142836166, 1144046176, 1145256144,
    1146466146, 1147676212, 1148886242, 1150096251, 1151306366, 1152516476,
    1153726560, 1154936692, 1156146810, 1157357042, 1158567162, 1159777291,
    1160987597, 1162197769, 1163407934, 1164618217, 1165828459, 1167038707,
    1168249021, 1169459354, 1170669652, 1171879954, 1173090280, 1174300693,
    1175511078, 1176721515, 1177931930, 1179142309, 1180352784, 1181563215,
    1182773718, 1183984132, 1185194705, 1186405219, 1187615774, 1188826316,
    1190036879, 1191247448, 1192458069, 1193668678, 1194879240};
unsigned int tab1[] = {
    0,          2167784989, 2914984389, 1562261789, 2125099636, 4265370305,
    3642609402, 153564667,  2259199318, 1182451890, 1247181211, 2474666668,
    47404320,   3403540479, 3004122242, 3513574090, 336840358,  2708089709,
    1261785331, 267832542,  27689054,   691252631,  1661420066, 3812241132,
    1459707896, 4218533371, 3127999546, 2504029609, 2550783476, 3096400129,
    16316239,   965795156,  2547822922, 42596136,   1843052024, 863311925,
    3830664958, 3212927486, 2063802958, 2152314295, 2004652246, 2153080083,
    2679790783, 3520132323, 3285095859, 4071787386, 1758181593, 3037012161,
    925838148,  2027982398, 3658243291, 1408323449, 3197329793, 1936085553,
    3253592214, 1790866305, 298015782,  4066072767, 1724351935, 1209152981,
    720381673,  2224016865, 474277344,  3387503205, 1884132851, 579812194,
    3286238277, 2334852631, 4210218494, 3336522696, 1929101980, 1026541260,
    3552524418, 2896815428, 764818544,  1473883333, 259180348,  27144277,
    2228577353, 867997735,  2030239581, 1281915661, 3266109907, 1679090707,
    2123983951, 2655199738, 478496490,  2314407575, 2813540090, 771957299,
    2306453581, 1708737415, 541636363,  600521953,  3897863245, 1303026860,
    2318267774, 4156775499, 48441859,   3836772527, 3520924137, 687585903,
    4099117463, 3700335780, 3044601628, 1371773786, 3162684966, 1111042200,
    3298664683, 1902858266, 3807591322, 224285325,  2593913732, 3919310516,
    4036013339, 964922016,  4120200277, 494503505,  659861014,  3347500653,
    2911481537, 395319507,  3718239299, 2757401110, 2742597135, 2817031804,
    3975342164, 19192165,   4272097366, 1951338613, 986520719,  1440623703,
    3065132156, 2659607698, 47324773,   4015706234, 1349708988, 1681419153,
    2344940172, 1620126510, 3900877371, 423348096,  2401992539, 645227872,
    67130276,   88312059,   726907138,  513047921,  4128500439, 3738571562,
    2323957240, 1866456265, 2399916041, 569990679,  2389663569, 4089210002,
    1692664148, 1988756645, 2217211047, 4078799455, 1599468398, 2583375250,
    212080390,  3780657866, 3224348436, 4279622574, 3851401955, 3900797359,
    2928340558, 130491559,  2237983501, 2013796708, 353609398,  1184945061,
    1756669412, 2331307932, 2555137124, 3081819689, 1197084280, 807213582,
    1995150116, 2543796683, 3210844859, 139701942,  405961350,  3426612437,
    1805405656, 2104659570, 2397435928, 3187741002, 3889207975, 3030529110,
    2712878697, 4261806502, 1773786437, 1221857156, 981034813,  1456378622,
    335729727,  4239984474, 489708392,  928135521,  4210059410, 3284672663,
    1535617413, 2682409151, 3195393383, 1436059412, 3798368120, 1337832855,
    3852996132, 2471716227, 1649160534, 1323256071, 893990642,  2954069751,
    1525104062, 3611385238, 4253990882, 627259311,  3056363148, 888757235,
    4021665801, 1452330527, 68871881,   1247976184, 1240613635, 2478039839,
    435005804,  1839175118, 754813135,  617618334,  2740427870, 2854947205,
    2055656205, 2826660724, 4263006135, 1085831696, 1357889236, 629188022,
    2939197919, 3939987880, 2103615497, 1028655553, 1007801722, 2713450820,
    2433277550, 15685359,   3126894420, 3182359926, 1491178414, 1871405019,
    1118055558, 3571387553, 698900493,  1807727486, 35321681,   376998343,
    223666428,  3456929579, 802913263,  1092124584, 3668320462, 3800152313,
    2029544359, 4096848837, 3578030279, 34244373,   663937980,  1247126582,
    294308187,  3372111240, 2229492321, 506961315,  1176085830, 966500286,
    1879566344, 3805781189, 2393396437, 2224612988, 2900376567, 2642076002,
    469010874,  1507459380, 2682657990, 3966772391, 422475278,  2507440323,
    61087289,   3170650599, 750960308,  2390726078, 3642339356, 2469210925,
    3048923111, 347719892,  4218708775, 3522229571, 1683195737, 190851172,
    1908465587, 4115313901, 2515344562, 2024998330, 1220894965, 3362962390,
    1359288970, 2870223665, 4247792875, 2869253936, 863459670,  1809767665,
    812316372,  4170371642, 645170729,  45359873,   2263372361, 2095613280,
    1442693131, 3347224443, 1328963544, 2494836570, 357526118,  2387934036,
    219176061,  2973229151, 1786021037, 894442213,  2409452472, 2009909922,
    3980642097, 766842017,  1713139049, 4289554972, 2226918418, 2282438319,
    2368464493, 3686590531, 1228691148, 3074297221, 4250217345, 4120273650,
    1376531030, 4107547109, 1776094350, 2918812658, 272538890,  1603695234,
    4206537135, 329621868,  24186473,   1127905348, 1979057165, 4290512998,
    4178643768, 3379807875, 2500537621, 287084083,  2930390535, 3207426999,
    2313879876, 4237346489, 4081759755, 2447254712, 1178859543, 2849750229,
    3460104288, 1561056973, 2783043465, 1396969827, 1949074984, 787929419,
    1734913565, 2479001522, 3338905042, 2479584173, 2965412295, 1728938929,
    3816218951, 1842514342, 1156077554, 146526268,  1868788372, 518906144,
    3827095712, 980339178,  2157540526, 3528600707, 3173366203, 1171602384,
    823398462,  188679712,  2845412460, 2429885988, 1303929496, 3383082718,
    3325465311, 4291995588, 1856191977, 1819652719, 1092580680, 576213374,
    3055655318, 397398209,  1064275237, 4220671111, 1671677033, 2164314159,
    1357380128, 4121181366, 3328859531, 1411263269, 1841355764, 488868403,
    632393657,  2663548206, 1707865595, 32760177,   570880870,  3395096106,
    394027592,  683248258,  970624027,  706400288,  618776344,  2117305437,
    1089256743, 4042679579, 463888111,  308496071,  737082005,  226118661,
    1140854298, 957998118,  861279944,  682144877,  2988435159, 2399925943,
    2899032369, 3067849623, 1064796382, 3991420307, 297860751,  2801083622,
    2740959863, 3932530160, 668166723,  338535443,  1730014543, 2559568423,
    1577784751, 2014402049, 4259948294, 4169270410, 2804685282, 575999726,
    1217565465, 3730776208, 2000065916, 3089308207, 1142915907, 4089151884,
    2568650078, 2212109095, 1980789530, 1572541461, 523606334,  1970118946,
    2950856306, 2376211396, 3396845517, 3186101052, 4138496118, 1213770736,
    1341370530, 3501233678, 3513872758, 845241187,  1350483477, 4093601821,
    3062288027, 1946426848, 2810542170, 1050017105, 1082878285, 1606892616,
    4015579010, 1917810396, 1357123804, 1919427741, 2069479843, 1685607748,
    2717847630, 3137171096, 2801056264, 551682607,  2960465770, 387749525,
    2489290632, 528134977,  895942584,  681718105,  3562408650, 1496370646,
    2724984961, 258801149,  825594183,  2154585700, 3712023585, 2455688828,
    4116397416, 3725004412, 3627999354, 3360506704, 2791631821, 1924389220,
    345117974,  3429701233, 3958200344, 606805604,  1233743326, 3001159840,
    1523937922, 361921924,  224566152,  2948461161, 1055823261, 2565625831,
    1765911376, 1809327483, 1456121097, 455840721,  1641361866, 3893103187,
    3157090035, 787588384,  563112896,  1307566823, 3676276902, 1682659073,
    1238027954, 3801633242, 3295556822, 4120637264, 1875528770, 783541411,
    968871132,  1705914045, 1917694180, 3110761489, 2933842491, 3211006539,
    2235422006, 2442554925, 2642019390, 1825981154, 2113583604, 2457282695,
    3864322117, 598120232,  3941795203, 656206062,  3044902048, 2349544780,
    3664856027, 3162658445, 2078747349, 993713524,  3612089307, 815155766,
    3731500254, 1875847122, 2971768473, 458545277,  3954338947, 2030610453,
    3884191053, 2520695440, 2180299939, 332997767,  664416500,  2313940617,
    3985224400, 565840692,  1568213058, 931990721,  190691201,  949980088,
    567167819,  1769361780, 3267956703, 3330598390, 2833483521, 1164043035,
    3390630034, 2452776926, 810542157,  1511190788, 1476939855, 1643614180,
    3020141776, 2002712739, 3128040519, 110370985,  2282964800, 1995313833,
    1145581002, 2157688632, 1480672753, 762207780,  1220661737, 995260397,
    1637852337, 2760491300, 3431363448, 1994088838, 1881186710, 2039188655,
    134423957,  3319813486, 1241325769, 2239361492, 1367509856, 1172116893,
    2099942533, 4283862894, 786690534,  3400227986, 1115938656, 3917704999,
    2985547679, 1926713860, 2305550427, 1570102033, 2553219269, 3113878297,
    1913868497, 2658660291, 2372274695, 2696613394, 318723526,  352693924,
    3651875690, 3715147289, 534008122,  2837412217, 1375038286, 1197607382,
    361607668,  4037332830, 1825446199, 1938321221, 4113447953, 1952712416,
    3362525083, 3155995470, 3783757153, 1503351117, 1024312477, 1917223843,
    1266040810, 704331393,  3092126998, 1530787663, 2142452007, 2107319789,
    854462110,  4163065681, 1875099420, 1504429604, 2413454243, 2259690449,
    4045989353, 3070160533, 3326541038, 2418454871, 862852783,  4074609117,
    1677067589, 2682580496, 847767474,  3803171028, 1553210036, 170302838,
    3564509164, 4147894738, 885484843,  1942172338, 2940779352, 744488752,
    805998606,  2380465137, 3835341694, 1598251602, 275777204,  531106639,
    2789100822, 4215125391, 1463315900, 3648482357, 3548575831, 1518600049,
    1576893973, 1867795229, 3730954035, 3431641120, 1541990814, 3985121348,
    2909249775, 1735916397, 16649747,   762940207,  2759421413, 816049391,
    2043706007, 2912640315, 3874689965, 1223547040, 2637478428, 1376066937,
    565929914,  1756910659, 1662421627, 1436383564, 64800246,   3622934327,
    2958734719, 1355977787, 126993673,  3238927719, 3048753944, 260571700,
    3779229728, 2267713056, 2552239980, 4250828381, 4148360239, 874340779,
    3813190896, 1543734096, 2479567343, 2907360590, 1645018597, 1060060171,
    2080865629, 2250838847, 3154767003, 2344229281, 2141419382, 2273827925,
    539815190,  4009712064, 4075490949, 64094450,   2820123624, 2807130798,
    3464318117, 28771457,   4176721445, 3033044750, 1804769456, 2547650497,
    690504930,  1122166898, 1877931473, 3972919717, 1443630179, 1980555161,
    3479161564, 2805266102, 3166854910, 2060274557, 2791297441, 2683510525,
    1823855182, 2625011887, 1268942615, 2290430373, 3058677352, 895616027,
    3262377477, 778669753,  1596744055, 1601689409, 3138043154, 609011060,
    1315052505, 1140945645, 410646844,  944926878,  716178866,  1665812324,
    1542714101, 1496981855, 575824804,  3942821458, 2426162706, 3833688714,
    1370187065, 1991168858, 82550077,   1821395060, 718696553,  3331097464,
    386364230,  3495201812, 2034857470, 2828530344, 3761879094, 514341298,
    214345749,  235319205,  2860579662, 2450208093, 3189440172, 734338348,
    3410474093, 1961970375, 4187964555, 134987183,  1481324779, 2126053872,
    3044827815, 2948174405, 1030557039, 2634226415, 2797212079, 2104919640,
    3243050759, 3566133292, 4162145590, 1663015845, 2629324973, 707585578,
    3364643782, 87889788,   1774553791, 357928178,  2160199438, 1457582463,
    1338332460, 4015424271, 3122644327, 2488190205, 24719851,   2404571452,
    1457149872, 948282141,  964741260,  722945834,  3346228686, 3121478659,
    280833647,  3150067823, 705695686,  3214555428, 1936224955, 552818390,
    1155754603, 3030770154, 2112965270, 3946099232, 999899039,  1195633834,
    3320768901, 4289725938, 1679515142, 176490435,  686796469,  2823001452,
    930000605,  2541376640, 351047876,  1440871193, 1269423485, 4199297495,
    1313995132, 2907047330, 1708594897, 3670842684, 2359328499, 2860762305,
    1432887089, 2150845805, 1977826270, 1332182986, 3940365415, 3666895239,
    719926820,  3895499126, 2372235848, 3369453298, 3124212575, 174817710,
    1914727256, 2700283873, 1641372986, 7301144,    3015054379, 40974759,
    1581245930, 1234478174, 1093787592, 3241896453, 475531171,  3182010005,
    3568092867, 695199548,  722674252,  3830791103, 2900585615, 2371820977,
    138262473,  3437649528, 72872589,   3158249210, 2440846498, 259311059,
    2385353281, 2944426346, 2914872855, 2757715984, 2085544536, 1985184155,
    402933327,  2848316315, 1926521242, 4056566605, 1277484898, 572696979,
    2699145490, 716248946,  1710544303, 2134862587, 2432678727, 2152815962,
    793066456,  3779415104, 2930416862, 3473090890, 62819361,   4045090865,
    3278680942, 3666031339, 3344036503, 1031768454, 657387813,  3177583829,
    3316100517, 423270124,  1877636892, 3761115173, 4176342242, 2528116673,
    1666721359, 2061620245, 2325111773, 1054056027, 1271425865, 3950118783,
    1073269225, 3893601106, 862581924,  2470159193, 4194258877, 212386585,
    244100474,  688136200,  1933764191, 1397816452, 592459941,  2817466439,
    115543864,  4207489181, 3543739522, 3960419815, 3303891706, 1258818126,
    3199195758, 3564796972, 1640838179, 4257503237, 1920624475, 2820813160,
    1530470301, 3787899583, 3709058084, 2515152142, 416198351,  3261954541,
    2886475937, 3961806000, 1225993958, 633665316,  1851565122, 1000991407,
    609087310,  504765033,  4151812512, 3895138237, 2157335784};
unsigned int tab2[] = {
    0,          3751857741, 3084627665, 4286741021, 911447680,  3810154023,
    2538542194, 269590969,  1030670590, 3216049472, 2395872277, 3826968912,
    4264553232, 1249750749, 3941831836, 3434607906, 3915535934, 183453009,
    2471031921, 3386039070, 1552222408, 2669364963, 2239798394, 4029012090,
    1857680412, 3171126843, 2245771232, 490328177,  2320882242, 1528830161,
    3483136115, 3821836656, 1631060118, 3980427712, 1662206576, 1868014941,
    423136620,  1017622740, 2829994414, 1309355613, 2551823416, 3270407655,
    4027535431, 3843105185, 2245083383, 1904052322, 3948996775, 2483332693,
    428838516,  3144574658, 14234567,   231402659,  2352197515, 1266618873,
    1879162674, 1593223087, 3962230784, 1194200761, 4014122347, 2517131897,
    1199583121, 2347099421, 422941912,  1324425895, 3340273319, 319915052,
    3020569129, 2353039471, 629449198,  1781887484, 1609939160, 2786927722,
    1500882352, 2527754784, 895370366,  1444410825, 1216610488, 2703849779,
    911946271,  4205580559, 779797495,  2745482729, 1141545683, 4191628297,
    3768487447, 3533613356, 1971230164, 1172949897, 726345906,  1788081391,
    3761253825, 3127866389, 3614806913, 3500847271, 1203092569, 2327185356,
    1136594938, 1565858701, 1366315235, 2764213787, 1736724649, 712042929,
    1555079933, 241892100,  952206014,  3519859522, 717090858,  2203113242,
    2867093119, 907409404,  1550548284, 2996356047, 869641610,  3670574094,
    1373468417, 1677871662, 3161315821, 2117083477, 2615809390, 3741250347,
    4282772317, 1252437269, 3569940691, 1678325048, 2456719219, 3487054050,
    1088048434, 2737379293, 1694258798, 982319033,  4182236205, 3935252881,
    2794633400, 2045380302, 2556059777, 2856923696, 2446210992, 1900657967,
    3933159264, 1338026530, 1495148203, 3678478266, 1172165461, 219678494,
    2397103754, 560412573,  2129601390, 190530527,  1462801933, 2107342396,
    1357041828, 826697713,  4185964901, 885665243,  729001815,  592411314,
    2463633278, 3556823143, 2307100219, 3079826107, 3752162936, 2986654022,
    3596699954, 1262075068, 3867237244, 2179057842, 442420841,  3520413157,
    1985873746, 2628676313, 604732167,  87013230,   1889507000, 341928267,
    3093786718, 2194436280, 3264180884, 3755865043, 2811219808, 4232403484,
    2962853508, 1971088471, 3289082717, 3585122136, 2290960700, 2504945513,
    1306523218, 504310190,  1123547880, 3256694526, 2662622147, 754647846,
    1767251589, 2718475724, 4017789467, 2979184738, 1318044277, 2040145814,
    1808839955, 3676077686, 2256600220, 4249210101, 2564760532, 1073810335,
    937445495,  614098739,  2569261735, 3999003154, 324228750,  3150051811,
    2942757620, 2824010205, 1379149226, 3256915677, 2007472904, 1511712557,
    3661329674, 2379166836, 2363676620, 2375794307, 989447490,  216580467,
    1647413875, 81105731,   3216765395, 3965626914, 1912985549, 1166150851,
    3358849278, 251043510,  1213024329, 3264957370, 1616635022, 2139601907,
    296578877,  341393790,  3086406151, 2995786546, 3399508682, 3156411092,
    1508431075, 3240092122, 2827837847, 1234826785, 21679814,   689577222,
    1849648592, 1077737711, 178350336,  3264082412, 869717740,  2464570989,
    2200743768, 1963034061, 658652429,  1967776950, 2458146965, 2942164301,
    1532668376, 2090492387, 2144217625, 1320457766, 3481254848, 39114301,
    2583952423, 663123267,  486400207,  1559698809, 1283248124, 1471488198,
    3323921509, 237483416,  2104186545, 168235989,  2975871164, 3835509632,
    4273414840, 3619661909, 174058021,  1968345698, 3492215023, 61131876,
    1316710116, 2323684632, 1388995876, 2429173715, 618419744,  3712795507,
    3593716467, 4098197023, 982939362,  1002738718, 1385378612, 105846951,
    2456316945, 2123934956, 3670315401, 1494458851, 3033780787, 1351636194,
    414300555,  2533060991, 1623710830, 3426563464, 1705324761, 2226544734,
    3692297130, 1346812971, 1457050465, 3903607254, 1947209918, 4125558143,
    170561210,  154399954,  70300891,   1522501675, 812547569,  2199860706,
    1552189483, 3874266995, 899988918,  1791368452, 2755438354, 153240886,
    55577893,   2330314607, 3380090983, 1121281381, 3204489400, 2647293160,
    2676377017, 1402868043, 1933172471, 1010082152, 1706026632, 1251913521,
    3512990469, 3609351429, 1958520178, 388003087,  1916957751, 4023125152,
    2139165192, 91553351,   3554758704, 522236930,  1895623364, 172331014,
    4189393801, 4034858586, 3995936253, 1269264090, 21088905,   3468203874,
    4038557150, 3127654919, 2654433197, 245130299,  1592637021, 1937484165,
    2696605744, 2418988749, 1059817823, 646053556,  3617443137, 2975557415,
    3224202450, 1558555467, 2963389371, 301129729,  4186991096, 2953672765,
    3725875927, 2267048044, 1397766274, 242069025,  3358734543, 2347081345,
    531308119,  640693558,  96582918,   1934554574, 3481100492, 2806927844,
    107599348,  2167398914, 421359132,  3160579233, 905378513,  1743818838,
    3835928412, 1048702512, 664827284,  365461632,  3735576412, 2667716794,
    1941498699, 3334106184, 1492566273, 1974099389, 2956855688, 2791029244,
    1582545326, 404797439,  2954186687, 2441955519, 2047456333, 3942326833,
    2555699950, 729916130,  2635957903, 2154360961, 3799447476, 3431499439,
    491322335,  1264303520, 816531133,  516733433,  2520969746, 800633070,
    2155902432, 3549309532, 993665421,  3487462482, 1136845764, 3160245355,
    864552109,  3548033039, 4102317293, 3630012393, 42243447,   1593976245,
    2839862978, 168339922,  769565338,  426759059,  1817998857, 1271447253,
    1271453009, 212044911,  1783930548, 4031680351, 891291767,  181937148,
    3488183009, 299352420,  8772183,    2587505323, 3887929777, 2718061565,
    184820317,  560549185,  2600419500, 2327426866, 2765086330, 2614460030,
    1939442047, 798026944,  3714728444, 1796795573, 1142995205, 755331946,
    4108529594, 1292544571, 1342528246, 3214350305, 1955554632, 523271142,
    3738565962, 2190903436, 3997552931, 3574207604, 2536727638, 3625442684,
    2293386652, 1832748930, 3477651976, 2141146183, 2981530691, 2050891227,
    3637362599, 2735918188, 501932400,  3620258365, 4159489891, 3512299564,
    316458662,  3269618048, 2940823920, 140535739,  1288389037, 2350220734,
    994032468,  846838308,  3732260284, 2140955613, 3975041902, 1401467577,
    2504033870, 2043931667, 1683497830, 2638260735, 1219922276, 747095140,
    1132447975, 1446395901, 458281455,  3451341390, 3765623481, 2174398992,
    3435272752, 3847826208, 156348458,  1738489114, 329729771,  1020837748,
    4126041946, 3066933321, 3641959260, 2905930706, 2924478820, 3203927322,
    1050693724, 241368436,  3380431746, 110673131,  2121912893, 2259216421,
    2324909488, 1538476355, 3275687407, 2973412953, 2278842074, 2631072309,
    2571263599, 3809710498, 2475174536, 39896797,   2923203854, 135442383,
    332726936,  3943969232, 2639209882, 2247775974, 1125934246, 4081562355,
    143356002,  1684022939, 1485107390, 210195887,  4022601817, 3480435381,
    403608770,  3635355323, 772700474,  755438924,  3891762632, 3371150743,
    2088758279, 290698696,  3230903279, 4268359126, 950311874,  678030520,
    272655845,  3939770937, 2309498681, 3752496352, 3352009033, 597151454,
    63344090,   4210393904, 1821416539, 3045988809, 2687467895, 3304928177,
    3211596835, 255642704,  3756671179, 3172124273, 2093449350, 3171256937,
    590566608,  3159716024, 312951814,  908673467,  3570433115, 1500181680,
    3386568061, 784683546,  2876288159, 205014440,  4075300755, 3478614175,
    3633462622, 1360249038, 1269067483, 3740975432, 2695187693, 2628825124,
    4018183368, 109573065,  1686114697, 1967458267, 1079737992, 2117387571,
    4236754400, 2243245580, 3786311813, 2420012256, 419831361,  688749739,
    1271157573, 1077441694, 2307865302, 1927382770, 18544776,   5684617,
    1522417559, 2322325502, 2053480797, 1577130582, 4091437942, 3516190979,
    2359055923, 3583068576, 3652832290, 3027928852, 3062432358, 3422104965,
    2559643301, 540297874,  2274870319, 3269565153, 3668648063, 1896943497,
    3612674737, 3371897691, 4225865867, 682417740,  2704358560, 1727648936,
    939065304,  2916683313, 411220210,  2080202725, 3648112032, 1655733458,
    3847751852, 3116221648, 1508271779, 3148386937, 3349667107, 1036503758,
    525940595,  67679332,   3787542613, 2411471563, 1551257779, 2566856495,
    695678070,  760249609,  3230567624, 2825851479, 1884061345, 2622099889,
    252445202,  969413223,  1027886478, 830816994,  3059450517, 4221298351,
    3098179301, 2295247003, 3177650884, 2741226217, 2564944137, 3270469419,
    3217251507, 3040088912, 3063656052, 3495984598, 529243782,  4124342130,
    2532464402, 1852583234, 1651604757, 2652416072, 1940153238, 1463281264,
    521915354,  2989944609, 2770159696, 378594702,  2485681324, 4293857333,
    1813143720, 2627864687, 1225154814, 1487886839, 3120622975, 1099164911,
    2204407711, 926086379,  3424936851, 2060717934, 1373170086, 1405739384,
    2509898333, 2960436811, 300815695,  3196262545, 972658953,  2862598965,
    1589099135, 22049391,   3773430319, 3026514454, 2973797966, 2513394149,
    2068323794, 2402655673, 2614922507, 4016373340, 377854542,  95319021,
    1219518839, 2582313035, 1355157063, 1626178715, 534060638,  1286638642,
    778995774,  4012566470, 908025718,  4148941555, 197754937,  3529782301,
    313620118,  312613410,  1145106387, 723612990,  2732929911, 1007383207,
    941146639,  2849896983, 458258669,  1710935937, 2916208550, 3933253933,
    777103210,  1539816074, 2549397897, 207537330,  3480425780, 4085157008,
    2882254177, 2010107287, 372368617,  4021922186, 2779488292, 2977349323,
    4158694028, 1944412236, 4081731737, 2462779187, 1891239327, 4018218129,
    1540973276, 3494459838, 2679192134, 3285844765, 3066097715, 2925340575,
    1002519124, 1048507425, 37789241,   4045296123, 1495739626, 4063813267,
    2567180379, 1593188737, 2835507831, 2216391833, 3138619026, 966265154,
    1473309201, 2115659069, 25704556,   3369928520, 1830276094, 2506703788,
    859756413,  3351075775, 1472351484, 4270609580, 290361814,  2831547582,
    1589037031, 4099797464, 3437556409, 953846224,  2318306487, 945292334,
    2598792538, 2299076634, 1018079680, 3560529890, 2811248760, 2478835374,
    2574403617, 3691375555, 3558161074, 3790291403, 3432799590, 2781611612,
    32922183,   703650837,  3331194251, 3665968145, 3004478399, 254355080,
    2964068055, 2229136417, 3385322487, 3546411227, 2233207167, 2464029254,
    52875589,   556886498,  885040260,  2851510971, 455950071,  2844871706,
    1375259378, 3972956372, 1166101879, 2429105502, 3707328666, 1196244983,
    330709920,  590914437,  435509541,  886204621,  3784785429, 3593081034,
    3418368150, 2307698023, 837229876,  2818499948, 3752530400, 3285256719,
    3831322805, 3023072759, 3105876006, 3230201188, 2208067929, 4141023570,
    581123853,  1875246294, 742618020,  533253648,  2951341095, 367533114,
    2305505365, 1779615788, 3415324478, 1262030453, 311920175,  3115917978,
    3438801683, 1944304630, 364116030,  1777922415, 3068490743, 1239235037,
    1794224048, 1474710434, 359555525,  2494983188, 2859361261, 3460836729,
    3368978537, 2462902907, 2652703814, 1831014410, 523240129,  4144541829,
    683033346,  1232375412, 1968760892, 3906276628, 2677435779, 3193288358,
    2724387748, 3103375383, 2541784936, 2688680428, 312920309,  892198465,
    4249906892, 3161562838, 704008068,  3709170655, 2109658157, 1343511347,
    411364715,  2273175568, 2809709600, 976589865,  585883647,  549294817,
    2431403507, 942994718,  1156453821, 1237128872, 1251056886, 4010926099,
    1794106483, 3397683976, 2699879977, 2651654650, 1254488054, 3999417791,
    2632007079, 464961781,  1661879890, 1326165529, 355122602,  3137182745,
    4213073634, 878251976,  3284377937, 3252504687, 1405371431, 3461086830,
    4271690196, 32997698,   3878960226, 3484008880, 245132499,  2872940765,
    100405846,  1659626085, 499628683,  2608146816, 608550053,  3745853257,
    752354927,  1050929248, 745811568,  1146150225, 1192433008, 594107433,
    3443377159, 4094889973, 2309135819, 3245238917, 1697442427, 649598511,
    2868302269, 119327186,  402285024,  2861237573, 4278989951, 657218043,
    2995248838, 30729022,   400372817,  32720312,   1373156881, 2159811799,
    1855026556, 2590308955, 1538267994, 3428348613, 1040509170, 2924136388,
    2869446152, 3963334010, 4252944881, 3886428001, 212328105,  4022838596,
    3093357035, 1830832969, 620552308,  2217280434, 1758758471, 3354210467,
    3926176351, 1249806670, 2966472622, 3413277572, 618995794,  2629457735,
    2812941360, 3949321419, 2175149094, 1091430487, 1323819666};
unsigned int tab3[] = {
    0,          1761927349, 2874015853, 3298691251, 3460079036, 3643839605,
    1130121216, 2527464125, 3835280526, 2772115756, 2433557679, 4226593054,
    3623985254, 1574909657, 625271284,  2592860448, 1711934494, 148825387,
    4222658717, 1354370894, 721953186,  3279496443, 731573044,  1549865724,
    1054220142, 2248565559, 3467712852, 1450645735, 1196468886, 3580963661,
    27759669,   3393271718, 2105336498, 3917693528, 3752506310, 2024421759,
    1007156632, 571673750,  3024274174, 1111506961, 460643786,  1330539447,
    3909709891, 1265273655, 85738901,   386146094,  2488477545, 575964253,
    2611988730, 3172247810, 965253159,  2254053001, 2969386571, 985684377,
    2180117268, 1102192545, 2155653112, 444670907,  789533755,  1093577117,
    1123713663, 2625354423, 2077718946, 1560792289, 1965763947, 871518000,
    836722357,  359703485,  1561384188, 3918199788, 234877782,  3017273210,
    1189267228, 2233429754, 3829858712, 4110142427, 1439224748, 1860050329,
    1406699715, 2161554737, 3237447745, 2545478941, 2102565623, 2919241751,
    3029493747, 2534715852, 3924208878, 1819181167, 1842219996, 1956515219,
    2752114353, 3609190581, 3765756235, 523629991,  2882685721, 3961987734,
    1073792548, 2667217355, 4004834743, 3756491535, 4204919285, 3628841001,
    4272334375, 306800642,  3251651830, 3088129336, 2026705598, 707866218,
    3395853737, 4053448638, 2161520794, 226396429,  4125940966, 3591001758,
    3069796727, 3664513958, 3329644625, 3293818503, 1810556718, 2634994095,
    2009634375, 774443417,  3014349769, 697647856,  722142737,  1468920104,
    689606640,  2090687799, 2620215214, 4096553299, 2725155629, 2919479161,
    2807997308, 1737857174, 1612453611, 2139795364, 2230651450, 1124306239,
    269969296,  2740552372, 3233943445, 354139044,  1831826041, 226676084,
    3869876126, 226033195,  302758824,  448383389,  232644607,  1505637060,
    719113246,  2388178487, 3534893017, 3596423029, 873109957,  1082209756,
    4267895118, 1095311083, 3535270657, 3868417231, 4027239282, 3285975192,
    2168271926, 3046956890, 2511879800, 2215326242, 434420295,  1699987675,
    811988786,  3391026215, 3967121759, 3596265962, 3155670634, 3994267577,
    3956196460, 2871143332, 736540134,  1566078539, 976491816,  2134125934,
    2869832920, 4271510931, 377803545,  865175876,  1537119446, 975966033,
    9741742,    3916819962, 565851444,  2816474462, 555945009,  1459992466,
    253732591,  1388130590, 2560168661, 2319601958, 3237560241, 338158286,
    1684811823, 56712300,   935932868,  2497590887, 1805549852, 1542047169,
    1543308901, 3121836423, 2435910165, 4086349490, 3012669842, 3531438997,
    2039646434, 3225669611, 3645900606, 2507747223, 793070692,  2846954099,
    3041823548, 3862731742, 3076132934, 3497866011, 1816550396, 1682228853,
    3009811785, 2733025471, 482194267,  728804378,  402549853,  4075568271,
    3316444376, 2947964080, 399803093,  2898591394, 3045980266, 3131389099,
    1208169907, 1261443446, 4100547103, 3298109968, 338172166,  3020461566,
    1711499093, 2673692338, 1554187151, 3500896351, 1639899184, 568111510,
    2373347832, 416325813,  2875066326, 1946878768, 1258496986, 2339717575,
    3282012146, 1119907009, 1643714975, 3516840474, 3729212201, 3386830831,
    2754555594, 1404026369, 2809492285, 949147734,  4273249648, 3755616387,
    4084442663, 425714285,  2204790651, 390956139,  2747069314, 3452598374,
    858308661,  2819213962, 4159329551, 886092091,  3149127956, 4248432408,
    3649306380, 2738116919, 2931297163, 2715245588, 1722369201, 705696380,
    195916638,  3458513860, 1408279268, 3788066791, 4049984290, 3081183891,
    740576755,  342536189,  130840596,  3425623732, 1562461154, 256043715,
    2542918291, 2535972754, 4170272815, 1176336863, 2977735027, 3737748628,
    3885869193, 2661723319, 4175499008, 3448281838, 1027031541, 2675017408,
    1271727032, 697833397,  80812175,   86594474,   2524603168, 1839569033,
    3415528062, 3158887202, 1234416815, 554152049,  2027170643, 1262506752,
    2785382955, 2818905253, 1448187884, 663597666,  3536011180, 2222499844,
    2752309117, 1669209399, 2343578669, 2880183949, 3412786844, 2409718520,
    595186757,  386045747,  105077613,  1664789310, 2713711726, 1527830559,
    2222823633, 764388369,  41379436,   2002993261, 4119647363, 3822114250,
    777122348,  1865654003, 3794677106, 1835905912, 3641572990, 2479034222,
    16912503,   4146525516, 3535719425, 3990505372, 2236841375, 2353570254,
    519570666,  661172835,  2068865509, 2629044979, 3742917943, 196667067,
    581175272,  1988160385, 3028272227, 3964184270, 409376485,  2264717741,
    4157251742, 2918079835, 2494298761, 4012775883, 3249744612, 4143320273,
    36012979,   272123894,  1774136314, 2473971053, 4132600003, 1717414757,
    3931450123, 1149107336, 3814456524, 755654214,  3441558784, 578148648,
    3755452214, 1241913116, 2137863686, 422330863,  258389595,  3923557788,
    2923410048, 700569672,  1290555440, 51755224,   247066728,  3117585832,
    789073679,  585230882,  1323035147, 831028245,  4172406356, 2369611152,
    959243116,  2148763713, 853255279,  3258579349, 3357941219, 2812786285,
    369531664,  471809704,  2259558499, 387992557,  3692759394, 1355723135,
    787624743,  3012473232, 2577154677, 3135470619, 2249253108, 1615205870,
    2467566566, 1110492646, 1564209731, 985648862,  2489267696, 3987099237,
    2150486455, 2212106075, 2298816849, 1778652773, 1400826753, 163847481,
    2580932840, 1384221446, 3201872640, 907504079,  2772735275, 2467822537,
    1923530637, 2619614977, 1020321534, 1988303673, 1851204561, 1241593972,
    1448255143, 1299661602, 3766640259, 2408402151, 154643921,  1206909367,
    1717501409, 1110981727, 3298772544, 3297052768, 1685999714, 4274425264,
    3321740325, 190972444,  2576365854, 1034483713, 611111193,  1872844130,
    4045389714, 353622275,  4276505686, 382942737,  1167033124, 3697726894,
    3159867048, 3157952602, 587786623,  188253540,  378828750,  277693072,
    2982347666, 3650560876, 3582373624, 2108698357, 3366593005, 1411946643,
    794880657,  2156168084, 1255634500, 1509397437, 2451595715, 3010066190,
    2181462592, 2564304740, 3652028018, 3468429947, 1713523749, 1119663982,
    1694499912, 771469860,  2091739870, 1256990161, 3525194652, 3363440645,
    553635682,  3411177835, 2178309764, 3632785307, 3878990774, 606736008,
    787960973,  3017715933, 4085141271, 3224640432, 2495608307, 4077901428,
    3764888996, 2015891334, 3133773922, 3205053840, 1961659637, 3202347632,
    1738185348, 1233725627, 3065376942, 2104621796, 1983279052, 2312574504,
    3829668720, 661241706,  3142993450, 797290909,  2552271847, 1382036621,
    3965856240, 2256008357, 2522124017, 2041208263, 2331988958, 2301181491,
    3901254969, 1220130272, 4094994374, 3059969293, 1841118774, 546795463,
    2414447628, 1513937052, 846823224,  410230206,  40602272,   388884517,
    2718564756, 932968733,  1281893922, 1549988603, 1833056373, 2647863235,
    2958030378, 2831276019, 3432231936, 2453024252, 3065750506, 218158159,
    941105661,  1714398134, 3175437293, 440096048,  3075829802, 4036894240,
    733235295,  818329205,  583207317,  202433982,  501354793,  378541254,
    4229229614, 2831358802, 528327613,  2883851379, 4115525171, 4256243355,
    1912359271, 1533344272, 704234201,  1512931713, 3328721908, 1923966227,
    1529867062, 2733290042, 3566599432, 62250543,   222615303,  4018619234,
    3670180647, 825675816,  1621622749, 245937248,  237124297,  787781987,
    1955381198, 193952726,  2211470023, 1954274814, 739640831,  1263730710,
    2198762102, 2367551399, 2213051057, 1505496491, 2848349742, 3938439409,
    1847441934, 2668353724, 1702466209, 511399098,  3893994259, 3080032125,
    1964092751, 1452407824, 2929742940, 1817932280, 1515702090, 1611132397,
    909156527,  3439701396, 3009855171, 1790337494, 3466829736, 1553808231,
    826617647,  3458924742, 945553518,  21713044,   4015422070, 170841861,
    1238179471, 2602351436, 3562963941, 1373986641, 3374923813, 1851271235,
    3624322225, 3545322487, 1566852433, 2544013426, 4250182026, 1688379592,
    1796178002, 2182730379, 1529920928, 2540089543, 598285886,  119876456,
    2564735940, 3761642290, 1296297423, 3672473529, 3111514641, 3386516226,
    3029205363, 3403320424, 501670229,  275113131,  669090643,  1634620203,
    2661550254, 2678276051, 2724232984, 806891813,  2477897755, 778065371,
    3485388416, 1182950427, 2931356664, 2990536088, 868216531,  3645153263,
    2561361133, 2592260911, 2253341804, 1576527191, 2668586047, 2504628853,
    3277294205, 1839939908, 1700463140, 2012886224, 1597876588, 4112624284,
    1879851042, 1140366288, 1026026313, 1619581862, 631176716,  812084678,
    4272525972, 751858777,  797147506,  4099391128, 3357111552, 393074793,
    916755838,  2492412835, 539479180,  859257137,  585455471,  4277041591,
    3854151773, 4037538405, 2356287333, 4217972094, 2467241990, 1966440178,
    919573201,  1556664815, 3033276259, 2537987129, 145335829,  190148857,
    3144870727, 1307220909, 292461981,  2099493054, 3748994208, 271552801,
    287902478,  591525751,  4293409155, 2544947566, 2033007662, 449404059,
    2277751861, 1346992891, 1707585287, 4256402043, 385610112,  81149028,
    3120398270, 1126566088, 2309400058, 4198402245, 2185685807, 10780307,
    3975426088, 869114680,  3215907035, 1223208064, 2167363243, 1550169675,
    1735981715, 3670996257, 2414651359, 1622712921, 43473854,   2297115285,
    3002611334, 4230378732, 4123963249, 1483070812, 1777197580, 3861180354,
    4144014361, 525312103,  3803275415, 3488516110, 1897254586, 488929253,
    3813120764, 4170509164, 1997477933, 2023315937, 1153530299, 4089639361,
    3108965954, 2717026902, 559931632,  1226247233, 3199810281, 2354527149,
    14738746,   3194763357, 1824079719, 221712641,  3994776708, 2954934637,
    2552486951, 2616065909, 3735713039, 1111502463, 1170710998, 441277892,
    142686653,  1904990747, 2279775820, 701340398,  3423253212, 2839632578,
    315206149,  3952348901, 1464200226, 1569746820, 2177434084, 3452743202,
    363518687,  2084143316, 191742953,  365725250,  1924049003, 35324248,
    1836619724, 2849042468, 392122686,  930604130,  3579775728, 350713218,
    3596507347, 2861914379, 4269932904, 635649207,  946524746,  3455565114,
    434708381,  4249263001, 72614157,   2375754559, 2078739395, 1053111814,
    1714187455, 1556413801, 1526808685, 608639613,  1795327019, 968419914,
    2911789445, 1133758520, 983095672,  4278567945, 1204753767, 943671216,
    1809808336, 3930797914, 1549826125, 2119217406, 3049863490, 2840544649,
    2964758922, 1202581753, 3109540411, 841191759,  3359878451, 64731380,
    2359970638, 1952877521, 40952852,   3010309328, 1160008454, 841221999,
    1245139343, 566880647,  2112298870, 4293204868, 3797837613, 3439846598,
    2936867961, 2347090594, 4161159266, 1640577626, 3578710147, 3373669408,
    1051556563, 3009665238, 2442675462, 544645621,  1066321469, 3302543268,
    3921999007, 2572506060, 375687512,  2373317653, 2665149359, 3338916309,
    3887569320, 3690213184, 1329400747, 89904246,   940960467,  763446189,
    3779383047, 3767156351, 1774337504, 960618712,  3651229077, 630502781,
    4226107860, 1721913674, 3646674922, 3376306250, 335836495,  2588167344,
    3559325852, 1822564529, 4132532812, 1152445018, 3993477963, 631856219,
    1696218316, 2630632780, 1909611654, 3141186249, 4167801213, 3827833427,
    1313461865, 4256856734, 157193420,  104417325,  2880677537, 1997526923,
    2902760565, 2407004814, 411343977,  2899816950, 2116072356, 339488209,
    2827868739, 50011954,   204070861,  1088424600, 2710840734, 3952999353,
    3161267123, 1793611947, 223817334,  699155065,  2563716174, 2097211767,
    1172727566, 1189055578, 2103943973, 1561814241, 2383661491, 166961518,
    1972824718, 90974656,   2334913844, 4214636824, 31760083,   1115224049,
    1390922486, 4102284691, 2336724143, 4059034372, 2376241061, 2657523037,
    3564717637, 2967114628, 1465635322, 3176877189, 2890217604, 931977105,
    2426951217, 556327505,  298152821,  632104793,  1149026383, 3745538541,
    186049279,  2361122150, 3569620360, 2432797957, 3074120983, 3160341975,
    2574517782, 1434546772, 36787237,   3857422032, 3739579,    3822638927,
    1975283286, 3961385569, 962792122,  12353007,   4093210592, 478500472,
    2900300492, 1635554404, 3600089125, 1512756963, 3197444261, 3018415190,
    1087460039, 509248899,  2322549904, 1145624992, 3168504917, 2067620189,
    2656748387, 494977756,  871996376,  2610758750, 3082302498, 772301885,
    4132405096, 2231564015, 3848391594, 2317142135, 2682007236};
vector<int> P;
long long A, B, C, D;
long long n;
long long mod = 1;
long long stala = 300000;
long long odp[] = {0, 0, 0, 0};
void pre() {
  for (int i = 2; i < 18000; i++) {
    bool czy_ok = true;
    for (int j = 2; j * j <= i; j++)
      if ((i % j) == 0) czy_ok = false;
    if (czy_ok == true) P.push_back(i);
  }
  mod = (1ll << 32);
}
void rob(long long a) {
  if (a < 2) return;
  odp[0]++;
  odp[1] += a;
  odp[2] += a * a;
  odp[3] += ((a * a) % mod) * a;
  for (int i = 0; i < 4; i++) odp[i] = odp[i] % mod;
}
void sito(int pierwszy, int ostatni) {
  vector<vector<int> > dzielniki(ostatni - pierwszy + 1);
  vector<int> wartosci;
  for (int i = pierwszy; i <= ostatni; i++) wartosci.push_back(i);
  for (int i = 0; i < P.size(); i++) {
    int p = P[i];
    int start = (pierwszy) / p;
    start = start * p;
    if ((pierwszy % p) != 0) start += p;
    for (int j = start; j <= ostatni; j = j + p) {
      while ((wartosci[j - pierwszy] % p) == 0) {
        wartosci[j - pierwszy] = wartosci[j - pierwszy] / p;
        dzielniki[j - pierwszy].push_back(p);
      }
    }
  }
  for (int i = 0; i < dzielniki.size(); i++) {
    dzielniki[i].push_back(wartosci[i]);
    for (int j = 0; j < dzielniki[i].size(); j++) rob(dzielniki[i][j]);
  }
}
int main() {
  pre();
  cin >> n >> A >> B >> C >> D;
  odp[0] = tab0[n / stala];
  odp[1] = tab1[n / stala];
  odp[2] = tab2[n / stala];
  odp[3] = tab3[n / stala];
  sito((n / stala) * stala + 1, n);
  for (int i = 0; i < 4; i++) odp[i] = odp[i] % mod;
  cout << ((odp[0] * D + odp[1] * C + odp[2] * B + odp[3] * A) % mod) << endl;
}