hdu 5453 Dividing This Product(分块打表)

题目链接:hdu 5453 Dividing This Product

解题思路

分块打表,按照1e7的长度,先用程序打出一张 ans[300][50] 的表。然后对于每组数据,最多在用素数筛选法求一遍1e7即可。

还有一个用记忆化搜索的在线做法,复杂度为 o(n0.75) ,但是因为用了map维护dp,所以TLE了。连接

代码

  • AC代码
#include 
#include 
#include 

using namespace std;

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

const int part = 1e7;
const int maxn = 5 * 1e8;
const int maxm = 3 * 1e4;

int N, M, C, P[maxm], vis[part+5];

void init () {
    C = 0;
    memset(vis, 0, sizeof(vis));

    for (int i = 2; i * i <= maxn; i++) {
        if (vis[i]) continue;
        P[C++] = i;
        for (int j = i + i; j * j <= maxn; j += i)
            vis[j] = 1;
    }
}

int main () {
    init();
    int cas, bw = 1;
    scanf("%d", &cas);
    for (int kcas = 1; kcas <= cas; kcas++) {
        scanf("%d%d", &N, &M);
        int u = 0;
        while (prime[u] < M) u++;
        int ret = ans[u][N/part];
        int s = N / part * part;

        bw++;
        for (int i = 0; i < C; i++) {
            int l = s / P[i] * P[i];
            while (l < s || l <= P[i]) l += P[i];
            for (int j = l; j <= N; j += P[i])
                vis[j-s] = bw;
        }
        for (int i = max(2, s); i <= N; i++)
            if (vis[i-s] != bw && i != M)
                ret = 1LL * ret * i % M;
        printf("Case #%d: %d\n", kcas, ret);
    }
    return 0;
}
  • TLE代码
#include 
#include 
#include 
#include 
#include 
#include 

using namespace std;
const int maxn = 5 * 1e8;
const int maxm = 3 * 1e4;
typedef pair<int,int> pii;

int N, M, C, P[maxm];
bool vis[maxm];
map<int, pii> dp[maxm];

void init () {
    C = 0;
    P[C++] = 1;
    memset(vis, false, sizeof(vis));
    for (int i = 2; i * i <= maxn; i++) {
        if (vis[i]) continue;
        P[C++] = i;
        for (int j = i + i; j * j <= maxn; j += i)
            vis[j] = true;
    }
}

int pow_mod(int x, int n) {
    int ret = 1;
    while (n) {
        if (n&1) ret = ret * x % M;
        x = x * x % M;
        n >>= 1;
    }
    return ret;
}

int fac(int n) {
    int t = n / M, k = n % M, ret = 1;
    for (int i = 1; i < M; i++)
        ret = ret * i % M;
    ret = pow_mod(ret, t);

    for (int i = 1; i <= k; i++)
        ret = ret * i % M;
    return ret;
}

int solve (int i, int v) {
    if (dp[i].count(v)) return dp[i][v].first;

    if (P[i] * P[i] > v || P[i] == M) {
        int tmp = solve(i-1, v);
        dp[i][v] = dp[i-1][v];
        return tmp;
    }
    if (i == 0) {
        int tmp = fac(v);
        dp[i][v] = make_pair(tmp, v - v / M);
        return tmp;
    }

    int ret = solve(i-1, v) * solve(i-1, P[i-1]) % M;
    int div = solve(i-1, v / P[i]);
    int c = dp[i-1][v/P[i]].second - dp[i-1][P[i-1]].second;
    int pri = P[i] == M ? 1 : pow_mod(P[i], c);

    ret = ret * pow_mod(div * pri % M, M-2) % M;

    dp[i][v] = make_pair(ret, dp[i-1][v].second - c);
    return ret;
}

int main () {
    init();
    int cas;
    scanf("%d", &cas);
    for (int kcas = 1; kcas <= cas; kcas++) {
        scanf("%d%d", &N, &M);
        int m = sqrt(N), n = 0;
        while (P[n] < m && n < C - 1) n++;
        for (int i = 0; i <= n; i++) dp[i].clear();
        printf("Case #%d: %d\n", kcas, solve(n, N));
    }
    return 0;
}

你可能感兴趣的:(HDU,GRADE:C,算法设计-高效算法)