Egyptian Cartouche and Hieroglyphs.
Write your own name!
Log in to post a comment.
// LL 2021 const name = "Turtletoy"; // Input your name here Canvas.setpenopacity(Math.sign(Math.random()-0.5)); const tt = new Turtle(); function walk(i) { const name_ = name ? name : randomWord(); const glyphs = []; for (var j=0; j<name_.length; ) { var c = name_.charAt(j++).toUpperCase(); if (name_.charAt(j).toUpperCase()=='H' && (c=='T'||c=='S'||c=='C'||c=='K')) c+='H', j++; glyphs.push(getHieroglyph(c)); } const layout = getLayout(glyphs, -48, -80, 48, 45, 0.1); glyphs.forEach((g,id) => { drawPoints(g, layout[id][0], layout[id][1], layout[id][2]); }); drawPoints(getBezier(datac), -45, -90, 0.1); return false; } function drawPoints(points, x, y, scale) { for (tv=0.; tv<=0.2; tv+=.1) { for (th=0; th<=0.2; th+=.1) { for (var i=0; i<points.length; i+=2) { i%11 ? tt.down() : tt.up(); tt.goto(points[i]*scale+x+th, points[i+1]*scale+y+tv); } } } } function getLayout(glyphs, x1, y1, x2, y2, scale) { const layout = Array.from({length:glyphs.length}, ()=>[]); const bounds = Array.from({length:glyphs.length}, (_,id) => getBounds(glyphs[id])); const row_counts = []; for (var count = Math.floor(Math.random()*2)+1, total=0; total<glyphs.length; total+=count) row_counts.push(count=Math.min(2-count+1,glyphs.length-total)); var index=0; const rows = Array.from({length:row_counts.length}, (_,id)=>Array.from({length:row_counts[id]}, (_)=>index++)); do { loop=false; for (var r=0; r<rows.length && !loop; r++) { if (rows[r].length>row_counts[r]) { loop=true; if (r+1<rows.length) rows[r+1].unshift(rows[r].pop()); else rows[r+1] = [rows[r].pop()]; } } } while (loop); const stepy=(y2-y1)/(rows.length+1); var y=y1+stepy; rows.forEach(r => { const stepx=(x2-x1)/(r.length+1); var x=x1+stepx; var scale_ = scale * (r.length>1?1.1:1.5); r.forEach(id => { layout[id][0]=x-(bounds[id][2]-bounds[id][0])/2*scale_; layout[id][1]=y-(bounds[id][3]-bounds[id][1])/2*scale_; layout[id][2]=scale_; x+=stepx; }); y+=stepy*scale_/scale; }); for (var tr=0; tr<100; tr++) { for (var r1=0; r1<rows.length; r1++) { rows[r1].forEach(id => { var miny=y1, maxy=y2; if (r1>0) rows[r1-1].forEach(id2 => { miny=Math.max(miny, layout[id2][1]+(bounds[id2][3]-bounds[id2][1])*layout[id2][2]); }); if (r1<rows.length-1) rows[r1+1].forEach(id2 => { maxy=Math.min(maxy, layout[id2][1]); }); var diff_top = layout[id][1] - miny; var diff_bottom = maxy - (layout[id][1]+(bounds[id][3]-bounds[id][1])*layout[id][2]); layout[id][1] += (diff_top>diff_bottom)?-0.1:0.1; }) } } return layout; } function randomWord() { const name_ = []; var len = Math.floor(Math.random()*3) + 5; while (len--) { name_.push(String.fromCharCode(65+Math.floor(26*Math.random()))); } return name_.join(''); } function getHieroglyph(char) { var index=15; const dict={ 'TH': 26, 'SH': 27, 'CH': 28, 'KH': 29 }; if (char in dict) index=dict[char]; else { var c=char.charCodeAt(0); if (c>=65 && c-65<26) index=c-65; } const points=getPoints(index), bounds=getBounds(points); return points.map((p,id)=>p-bounds[id&1]); } function getPoints(index) { const points=[]; const x=(index%5)*345; const y=Math.floor(index/5)*342; for (var i=0; i<datal.length; i+=6) { if (datal[i]>x&&datal[i]<x+345&&datal[i+1]>y&&datal[i+1]<y+342) { [datal[i]-x,datal[i+1]-y,datal[i+2]-x,datal[i+3]-y,datal[i+4]-x,datal[i+5]-y].forEach(p=>points.push(p)); } } return getBezier(points); } function getBezier(points) { const bezier=[]; for (i=0; i<points.length; i+=6) { for (t=0; t<=1; t+=.1) [ (1-t)*((1-t)*points[i+0]+t*points[i+2])+t*((1-t)*points[i+2]+t*points[i+4]), (1-t)*((1-t)*points[i+1]+t*points[i+3])+t*((1-t)*points[i+3]+t*points[i+5]) ].map(p=>bezier.push(p)); } return bezier; } function getBounds(points) { var minx=points[0], maxx=points[0], miny=points[1], maxy=points[1]; points.forEach((p,id) => { (id&1) ? miny=Math.min(miny,p) : minx=Math.min(minx,p); (id&1) ? maxy=Math.max(maxy,p) : maxx=Math.max(maxx,p); }); return [minx,miny,maxx,maxy]; } const datal = [571,67,554,229,567,288,956,1885,907,1886,762,1885,1524,1713,1367,1754,1525,1748,220,152,358,296,209,206,1206,515,1219,390,1183,390,1223,443,1222,529,1221,615,147,833,347,827,287,845,952,910,897,873,841,822,1144,1265,1141,1155,1144,1059,609,913,619,911,419,912,1571,1202,1463,1204,1406,1201,1480,1593,1484,1514,1487,1384,780,430,905,429,949,431,761,1169,819,1117,892,1127,1595,1395,1601,1428,1597,1567,634,560,625,583,534,590,432,1248,570,1248,615,1247,116,1086,117,1173,116,1249,422,1866,460,1856,582,1860,1537,878,1603,779,1570,733,1588,1746,1633,1804,1602,1867,1614,1806,1574,1807,1466,1807,1431,1524,1443,1464,1464,1376,1187,391,1177,439,1154,544,437,564,466,538,478,436,1507,1918,1634,1898,1464,1905,615,1235,613,1146,614,1095,1587,1386,1582,1541,1580,1592,1496,1563,1506,1391,1487,1389,865,1543,1041,1552,921,1515,781,584,781,478,780,430,1451,1826,1522,1825,1606,1826,762,1180,839,1236,904,1215,428,889,530,908,515,823,581,1837,498,1837,450,1837,1110,1428,1232,1429,1287,1428,115,1087,158,1086,278,1087,1613,1846,1555,1845,1434,1846,776,167,962,166,953,169,1163,1071,1164,1116,1163,1265,279,1086,279,1154,279,1250,1427,1865,1451,1864,1578,1865,133,137,147,190,210,257,505,439,590,438,621,438,538,235,538,178,529,69,1439,1884,1496,1886,1589,1884,233,1440,278,1527,305,1545,889,768,953,894,966,906,1566,1372,1556,1396,1530,1524,459,1469,469,1516,569,1486,107,859,162,916,239,891,1631,1202,1616,1139,1567,1117,1154,1853,1274,1874,1297,1860,869,943,890,890,789,787,610,1779,544,1778,462,1779,1157,1835,1209,1826,1288,1821,465,1801,632,1798,600,1811,458,1209,538,1189,567,1107,811,581,810,517,811,461,1584,446,1613,460,1622,618,596,440,594,496,625,557,1420,1787,1509,1786,1602,1788,947,182,907,245,823,230,163,1529,112,1492,130,1430,790,1772,990,1770,955,1780,235,531,134,565,111,521,896,1886,895,1825,896,1778,938,1500,902,1420,853,1420,836,1532,781,1489,803,1429,791,1169,858,1131,909,1153,1591,1768,1519,1767,1464,1768,93,482,148,548,212,516,808,1185,876,1219,938,1176,945,565,944,467,945,429,1182,167,1077,152,1129,227,934,1887,935,1877,934,1781,1208,510,1205,579,1204,614,509,558,599,585,532,487,565,285,381,305,494,273,1439,773,1458,850,1484,727,1272,209,1220,230,1136,225,1444,1746,1400,1796,1424,1859,1411,231,1486,235,1602,212,851,584,974,590,941,571,1090,1437,1116,1488,1179,1495,135,1250,211,1247,280,1250,1468,445,1531,438,1569,439,1575,465,1558,449,1461,467,516,1517,576,1493,624,1520,230,284,233,284,130,283,876,1776,876,1848,875,1885,153,1580,122,1578,243,1579,1562,1115,1491,1095,1440,1137,1531,1747,1635,1756,1531,1716,196,60,167,118,219,145,169,1531,206,1550,306,1542,1279,1446,1246,1492,1188,1495,912,1579,843,1577,823,1580,817,1877,818,1748,817,1774,956,1771,955,1859,956,1883,778,1883,777,1763,778,1771,913,459,926,585,880,550,177,1484,205,1528,270,1516,757,1772,757,1835,757,1885,260,545,370,549,268,532,1578,469,1590,476,1599,572,225,246,220,187,265,285,845,1471,860,1517,915,1519,1206,1136,1235,1182,1225,1059,1491,790,1536,820,1508,857,134,87,46,96,173,59,454,854,495,803,474,763,797,1775,797,1799,797,1882,856,1882,857,1843,856,1776,630,906,631,816,540,843,579,1485,659,1525,659,1511,974,1171,944,1142,896,1128,170,1813,117,1816,90,1813,796,940,866,952,815,883,1500,159,1317,183,1467,174,797,1431,770,1404,810,1372,757,167,769,211,820,229,528,591,444,581,441,563,609,842,600,776,640,785,1444,1134,1413,1164,1409,1204,837,1775,835,1831,837,1878,915,1775,915,1848,915,1887,1265,1552,1301,1576,1222,1574,219,1815,304,1812,300,1815,1205,1131,1220,1039,1165,1068,209,204,153,170,161,148,1082,1848,1086,1790,1139,1801,1454,412,1373,387,1389,420,853,585,847,596,851,501,506,554,530,497,537,483,1640,188,1604,137,1572,188,1165,153,1229,141,1243,181,479,773,435,797,438,834,809,728,779,676,789,780,1146,1060,1170,1029,1216,1051,100,1410,148,1346,173,1394,1304,869,1280,832,1252,868,892,891,925,954,950,924,811,459,894,461,916,458,1464,867,1425,839,1456,796,1154,1574,1066,1576,1112,1552,1564,727,1530,697,1492,722,1318,852,1275,807,1249,843,610,1857,631,1840,622,1794,970,1179,939,1205,898,1217,152,178,153,188,175,273,458,1799,413,1823,412,1782,873,759,832,752,835,811,820,900,818,872,817,822,1088,843,1116,807,1141,842,852,760,851,684,827,730,1506,1717,1420,1730,1556,1728,1508,164,1518,195,1571,185,1202,1595,1213,1564,1168,1575,1197,869,1168,832,1143,868,1412,227,1372,180,1454,190,1455,205,1353,204,1442,221,264,280,319,311,274,245,490,1519,379,1458,455,1492,416,1859,402,1829,439,1827,1114,845,1085,883,1057,839,176,1397,172,1418,228,1436,143,833,80,825,107,854,849,509,888,479,877,557,488,274,521,259,535,237,1201,1555,1206,1506,1229,1556,1155,1554,1084,1553,1099,1555,1223,821,1195,854,1170,819,853,1416,837,1364,808,1374,1531,1523,1547,1528,1582,1554,270,527,241,511,193,522,1171,199,1076,193,1140,215,1581,1866,1622,1860,1566,1902,1468,790,1512,805,1453,765,1170,182,1161,182,1116,181,287,842,289,857,243,890,894,941,852,940,807,941,857,1578,883,1538,842,1533,1427,1864,1453,1906,1500,1915,1138,1888,1078,1882,1089,1854,134,129,164,102,139,95,219,1824,171,1832,206,1799,1481,1555,1459,1535,1432,1523,1584,1400,1533,1350,1584,1384,1154,541,1204,565,1205,580,103,520,57,504,118,483,572,893,558,862,579,851,1546,862,1528,896,1534,938,1248,867,1221,833,1201,865,1447,459,1440,404,1408,427,516,825,510,785,469,772,1575,221,1641,186,1644,184,290,862,321,874,307,843,455,1780,424,1758,414,1782,1248,180,1279,169,1271,204,1279,1457,1316,1474,1297,1437,1473,772,1507,747,1506,786,451,438,495,439,540,439,619,788,651,823,643,791,1629,1202,1643,1204,1574,1202,612,1092,602,1082,571,1104,1414,1808,1462,1805,1471,1807,1484,1401,1439,1348,1482,1383,452,1467,396,1479,459,1454,1202,396,1222,419,1222,444,1203,1552,1161,1562,1171,1532,577,890,523,889,538,913,948,194,974,213,970,182,789,1417,740,1401,789,1397,529,68,541,67,570,68,91,1404,121,1429,118,1396,823,757,824,799,800,746,1464,866,1493,875,1511,855,1305,1852,1312,1833,1284,1824,456,892,446,887,462,828,1136,838,1141,847,1169,820,1275,1554,1240,1552,1220,1555,433,1242,441,1210,487,1197,1495,1597,1499,1572,1498,1509,1172,1590,1148,1606,1151,1573,943,1173,897,1143,917,1159,284,227,329,271,288,243,186,1829,148,1813,187,1799,1596,1570,1604,1595,1583,1597,1622,578,1638,641,1597,560,935,1500,975,1522,937,1515,585,1836,606,1843,602,1817,187,1498,171,1474,171,1447,1084,839,1069,819,1059,836,1454,1826,1392,1820,1429,1847,161,147,180,129,196,125,853,894,881,884,835,907,199,1541,191,1576,182,1580,1132,212,1122,213,1171,212,1139,1880,1165,1869,1154,1860,1139,1808,1166,1816,1154,1830,903,881,887,901,873,900,221,250,202,251,208,279,201,64,156,55,186,74,1221,1576,1228,1599,1208,1594,1115,847,1157,876,1132,861,1251,842,1237,832,1224,821,1152,1532,1141,1563,1161,1532,1426,1769,1481,1765,1455,1768,1455,413,1462,429,1465,443,416,913,410,905,426,892,232,1550,215,1594,227,1569,572,911,642,913,627,909,812,584,784,585,780,585,551,1507,520,1520,486,1516,205,536,244,531,262,542,904,1544,888,1607,899,1559,843,1448,841,1460,851,1488,221,1810,218,1796,190,1805,610,1854,600,1862,567,1858,825,1193,774,1166,795,1172,945,179,957,163,972,186,172,252,195,233,206,248,1272,1454,1283,1424,1297,1438,1143,1427,1119,1430,1090,1428,1454,219,1399,218,1408,228,1611,489,1609,548,1615,567,1276,821,1328,851,1307,864,600,1515,650,1523,649,1510,450,837,430,841,459,830,1502,163,1447,156,1450,164,756,1771,775,1771,795,1771,1212,432,1203,409,1182,394,131,1437,101,1394,121,1426,117,498,135,535,160,527,523,841,553,840,605,836,203,1423,246,1448,258,1486,911,804,889,765,869,757,788,706,804,728,825,730,916,536,918,562,909,556,116,1249,188,1247,129,1249,1162,158,1193,170,1114,166,566,555,549,521,538,487,260,1493,280,1512,285,1514,620,1790,581,1769,616,1786,601,1491,582,1486,533,1491,978,1543,939,1547,975,1539,949,925,945,903,966,908,93,94,135,58,134,93,1398,425,1422,429,1390,421,429,1451,462,1476,471,1484,1567,221,1577,221,1519,220,1608,483,1596,451,1571,439,1483,464,1453,469,1443,452,831,749,841,740,834,754,1408,204,1398,205,1400,178,1221,227,1252,205,1272,215,834,802,842,826,863,842,1142,1260,1139,1267,1162,1264,761,179,751,164,778,167,1598,1760,1563,1715,1518,1717,826,760,812,797,814,756,1171,1573,1168,1602,1171,1593,1610,160,1605,149,1584,177,1121,1882,1106,1900,1102,1874,140,1397,134,1389,142,1393,424,1828,438,1824,448,1836,1121,1803,1107,1785,1102,1811,1509,231,1439,232,1449,231,479,1248,573,1248,611,1249,1440,778,1459,761,1444,770,104,1400,149,1385,91,1404,1277,1573,1208,1572,1224,1573,781,585,780,530,782,457,788,776,809,818,857,864,966,907,942,866,915,824,1227,1145,1227,1134,1226,1077,171,285,172,277,173,241,1478,766,1481,804,1448,795,836,1771,943,1772,951,1771,1473,766,1474,742,1495,721,447,1801,565,1801,502,1801,1498,1593,1476,1601,1481,1584,1572,1748,1503,1747,1480,1748,1066,850,1118,889,1054,841,286,228,252,186,213,143,1211,616,1194,609,1217,615,1501,766,1517,779,1492,795,614,1208,614,1262,614,1242,814,1511,836,1534,877,1543,304,1542,251,1505,272,1519,843,709,847,696,851,747,188,87,183,118,189,129,808,1208,760,1182,760,1173,857,1775,856,1842,857,1886,133,67,159,58,169,63,1582,1547,1582,1530,1585,1445,1275,1867,1307,1859,1307,1843,880,502,868,503,849,502,1225,1062,1215,1046,1191,1041,529,1779,454,1778,447,1779,1482,1826,1554,1826,1545,1827,1207,1145,1206,1138,1207,1076,270,1249,147,1249,157,1249,1144,1191,1144,1112,1143,1072,599,1800,584,1800,524,1801,946,585,899,585,856,585,817,1785,818,1902,817,1882,1156,1853,1191,1860,1269,1867,1537,1767,1611,1768,1602,1766,1481,1579,1483,1507,1485,1456,909,1518,972,1521,933,1496,1087,1851,1070,1845,1091,1830,812,1395,804,1393,814,1392,1612,1790,1600,1785,1524,1787,139,153,127,125,151,112,620,856,596,832,614,795,1183,410,1174,450,1160,516,452,1858,432,1873,420,1862,956,1808,955,1850,957,1886,543,1156,525,1184,486,1197,447,1858,568,1859,526,1860,88,514,93,519,110,516,279,1249,278,1197,279,1150,530,911,498,912,427,911,1629,1203,1559,1202,1502,1203,99,835,88,830,134,833,1157,1532,1175,1529,1170,1554,794,1885,877,1886,925,1885,288,859,287,847,266,875,556,1836,516,1837,483,1836,221,1818,210,1838,195,1818,944,579,945,551,944,498,1569,187,1559,186,1520,187,1579,786,1586,756,1565,728,936,166,868,169,814,167,1597,1552,1600,1422,1598,1456,1142,1487,1176,1496,1198,1494,1267,1822,1217,1825,1159,1834,1586,479,1595,510,1595,557,258,1087,212,1086,147,1087,1149,1572,1089,1574,1099,1573,166,1383,179,1401,182,1421,468,581,507,593,581,587,1202,1532,1237,1533,1214,1533,1164,1161,1162,1210,1162,1240,297,289,272,235,264,236,1494,1866,1568,1865,1603,1864,1143,1428,1218,1428,1266,1429,1499,1503,1497,1514,1500,1418,1459,1846,1512,1845,1578,1845,778,1883,779,1851,778,1786,634,565,606,523,613,530,502,288,611,288,512,287,876,1779,875,1861,876,1885,561,238,562,145,564,156,1587,1417,1566,1333,1556,1407,836,1790,837,1824,836,1881,502,266,481,280,449,288,1277,846,1292,859,1306,867,1217,225,1124,224,1134,224,537,190,532,107,532,122,896,1814,895,1844,896,1885,943,430,911,430,846,430,1171,846,1128,876,1156,857,1568,1884,1533,1885,1479,1885,563,154,567,140,569,72,290,831,263,834,210,832,448,792,480,781,470,764,1441,1473,1458,1401,1461,1374,1222,531,1223,500,1222,426,519,834,512,886,495,888,1478,445,1544,435,1571,440,1462,1748,1432,1753,1469,1726,1169,150,1214,152,1224,154,757,1779,756,1837,757,1878,915,534,914,509,915,459,1210,435,1208,492,1207,527,437,563,447,555,460,524,859,838,876,854,917,884,915,1780,915,1844,915,1880,259,235,236,224,194,195,275,1544,224,1547,183,1538,244,888,210,902,175,897,273,547,332,550,268,530,85,484,100,481,98,496,523,439,572,438,595,439,787,708,787,699,786,765,1515,1917,1422,1900,1518,1905,1497,1787,1447,1786,1420,1787,594,454,611,539,612,526,849,509,851,614,849,557,902,223,867,238,831,231,1475,1729,1548,1727,1537,1730,1546,1111,1501,1104,1465,1120,1163,1184,1164,1129,1163,1075,865,1579,824,1577,818,1580,1220,823,1181,854,1205,834,92,1815,138,1813,167,1814,852,1145,833,1148,796,1168,935,1784,934,1854,935,1882,116,1118,118,1161,115,1206,1538,1806,1501,1807,1475,1806,1453,189,1425,190,1400,189,1549,1767,1489,1768,1440,1767,195,283,251,283,144,283,942,932,919,940,908,915,798,1777,798,1788,797,1847,811,492,810,415,811,521,1226,847,1227,842,1204,862,659,1512,608,1506,605,1495,1457,1403,1448,1442,1434,1508,865,1125,900,1126,932,1141,262,1518,228,1521,201,1509,1557,1401,1548,1440,1535,1500,789,1147,827,1128,861,1125,1567,460,1542,452,1496,461,1114,1469,1094,1450,1090,1428,1597,1594,1595,1603,1598,1551,453,541,469,510,477,440,915,555,915,556,883,555,1241,178,1284,179,1270,179,1204,1572,1196,1599,1223,1593,810,574,811,531,810,513,552,1139,534,1177,562,1117,1143,1872,1144,1873,1135,1890,1494,1202,1452,1203,1422,1202,1097,1811,1081,1811,1088,1822,1143,1188,1143,1274,1142,1252,943,1172,916,1152,874,1145,1589,1390,1597,1409,1600,1428,1394,402,1405,395,1426,407,1529,1916,1566,1905,1585,1889,255,1813,170,1815,298,1814,436,830,435,820,446,809,1115,820,1146,849,1149,835,187,1538,162,1531,141,1509,1613,163,1614,165,1637,181,927,1207,978,1178,972,1170,1618,1163,1601,1138,1583,1126,483,1514,464,1512,451,1486,780,431,803,429,842,430,1158,1814,1142,1815,1134,1795,126,878,158,895,177,897,1112,171,1111,168,1117,199,799,1380,789,1399,762,1405,867,1579,939,1578,903,1580,1433,1826,1470,1825,1499,1826,764,186,776,207,807,224,1614,1826,1541,1826,1557,1826,921,1209,876,1225,844,1218,1116,181,1145,181,1169,182,512,1497,479,1500,472,1489,1529,1807,1573,1806,1603,1806,530,497,508,548,513,541,1255,839,1285,814,1274,824,1216,1491,1241,1485,1266,1463,109,517,119,538,149,546,852,1412,839,1376,823,1374,1428,1153,1447,1128,1470,1118,238,232,251,257,262,277,595,1091,576,1096,564,1114,909,460,896,460,850,459,1171,198,1153,197,1121,198,876,899,871,891,872,935,902,873,931,895,950,909,448,891,419,892,416,903,1222,540,1221,591,1222,612,562,558,547,564,521,562,595,1779,496,1778,507,1779,880,504,880,574,879,518,295,864,304,872,312,858,613,1203,614,1122,613,1155,945,439,944,480,945,496,1544,865,1567,832,1579,794,278,1154,278,1119,279,1088,199,127,217,146,238,171,817,828,818,821,818,878,203,538,162,552,135,541,890,941,869,940,812,940,587,1506,567,1503,547,1509,1101,832,1088,848,1066,825,539,212,541,238,515,259,894,227,914,219,934,202,630,902,629,873,618,854,942,188,960,208,968,199,190,235,181,226,163,201,841,1197,871,1204,904,1193,174,1826,195,1829,196,1814,802,1430,796,1453,798,1476,216,253,231,244,225,219,157,80,152,72,155,81,1471,1807,1454,1806,1423,1807,1277,1450,1286,1465,1296,1463,1087,1854,1090,1851,1087,1873,125,1462,128,1501,152,1520,1535,1524,1557,1534,1578,1553,1615,1815,1613,1858,1588,1885,205,520,235,512,261,522,510,439,482,438,451,438,206,832,96,832,150,833,854,1537,894,1547,935,1544,1430,1522,1459,1535,1483,1556,931,1491,922,1464,900,1440,623,1797,627,1838,621,1846,904,1517,881,1515,862,1500,614,1101,613,1140,614,1155,1489,1865,1441,1866,1427,1864,142,1372,122,1378,115,1405,1206,557,1208,532,1204,609,1487,1418,1481,1388,1469,1385,1196,1043,1174,1040,1154,1051,834,930,840,901,826,904,280,245,306,248,290,233,193,1579,262,1578,235,1579,641,789,620,773,615,797,481,794,473,778,498,787,850,762,833,777,834,800,936,1178,899,1198,877,1200,539,1836,549,1837,587,1837,1583,1787,1530,1787,1494,1788,540,69,526,62,532,112,1581,1594,1581,1546,1582,1563,487,1248,438,1248,433,1247,449,290,499,297,495,291,159,207,161,229,168,239,1543,712,1516,706,1496,720,503,791,513,807,517,830,162,527,174,526,200,520,1427,1845,1490,1846,1507,1845,1439,174,1489,177,1447,172,124,874,116,869,100,843,1151,1595,1151,1559,1150,1593,860,459,814,461,816,459,600,1858,556,1860,538,1859,1222,1540,1214,1558,1253,1553,1513,852,1523,834,1515,815,204,202,179,184,166,170,1464,439,1455,403,1434,407,152,108,148,94,116,87,182,67,184,89,199,61,1586,1415,1585,1463,1584,1494,1192,839,1171,814,1156,831,172,1448,173,1480,177,1477,1562,1114,1524,1106,1490,1112,453,880,446,898,487,889,814,167,746,167,760,168,896,1812,896,1749,895,1803,564,281,567,272,561,243,1417,425,1427,414,1439,428,860,891,859,880,854,859,312,851,299,832,289,839,761,1168,792,1144,815,1135,470,581,439,570,439,564,1431,1148,1411,1182,1409,1200,160,160,160,143,184,129,544,892,563,892,577,891,1605,1771,1618,1805,1614,1812,1557,1400,1546,1448,1532,1516,1197,867,1180,855,1173,848,861,1573,865,1557,870,1547,531,912,609,912,569,912,839,1218,790,1201,825,1214,798,1814,798,1868,798,1880,1479,870,1497,868,1508,857,1172,213,1125,212,1145,213,832,1772,744,1772,758,1771,1151,1553,1116,1554,1100,1554,125,1087,203,1087,174,1086,957,1513,933,1513,964,1535,1412,205,1474,206,1420,205,1454,1884,1444,1885,1502,1884,1622,619,1629,602,1620,573,1117,848,1098,855,1094,864,1628,1189,1616,1159,1603,1143,1161,546,1153,537,1198,568,956,1829,955,1861,955,1782,411,1792,420,1809,435,1809,1202,1536,1210,1558,1171,1553,1519,182,1517,173,1504,163,1205,609,1206,552,1207,517,1537,879,1530,907,1533,939,534,438,582,440,607,438,1599,1418,1598,1433,1598,1491,464,833,482,818,480,798,885,1429,911,1448,922,1470,524,1836,493,1836,454,1837,800,753,798,741,802,749,298,289,258,284,279,286,1443,1747,1421,1772,1416,1802,1461,865,1441,848,1442,833,1224,846,1233,856,1249,864,1120,1474,1132,1483,1160,1492,937,1144,964,1161,966,1164,1215,1492,1179,1497,1166,1492,1463,768,1473,788,1505,801,1155,539,1159,516,1170,472,1188,1062,1206,1065,1207,1078,274,547,265,543,244,536,893,1435,878,1423,852,1419,798,1477,803,1497,813,1509,795,1428,787,1415,770,1409,296,1544,274,1544,229,1545,597,1836,604,1834,602,1813,1442,824,1449,805,1464,792,1598,209,1660,176,1620,197,622,572,593,585,575,586,782,585,825,585,803,584,573,439,494,439,520,438,1241,178,1225,151,1229,161,1202,1572,1182,1574,1170,1572,1418,231,1463,231,1453,232,1124,217,1117,224,1136,225,1271,180,1272,169,1271,215,117,1240,116,1193,116,1208,1607,1846,1588,1845,1568,1846,908,916,889,888,884,899,183,247,189,230,195,239,936,1779,934,1852,936,1842,1213,1145,1222,1142,1215,1146,1415,1826,1481,1826,1517,1826,972,195,976,178,943,166,1255,864,1258,861,1279,847,839,233,816,228,796,218,1436,1877,1421,1855,1416,1836,433,1243,438,1229,443,1220,438,1489,426,1487,425,1473,1523,1767,1473,1768,1444,1767,1303,1445,1280,1424,1280,1441,193,1539,203,1538,189,1571,230,1087,310,1086,259,1087,847,1199,819,1192,795,1177,636,806,620,784,614,791,1248,839,1210,810,1232,828,846,708,811,745,833,721,1301,1833,1288,1823,1268,1822,1502,1904,1536,1904,1563,1904,1156,1853,1154,1880,1157,1871,796,941,824,940,854,941,1605,1845,1558,1845,1524,1846,116,1112,116,1084,117,1095,531,105,536,161,537,185,129,1486,125,1472,128,1440,172,214,140,162,146,170,1498,1578,1497,1532,1498,1593,837,1793,837,1847,836,1882,567,878,566,862,573,855,474,912,443,912,413,911,206,257,208,273,206,283,192,1421,167,1420,198,1422,876,1879,876,1854,876,1833,1485,1476,1485,1440,1486,1415,538,223,540,200,535,163,459,1454,443,1455,459,1456,432,1867,416,1866,412,1849,1483,1382,1458,1365,1459,1374,608,823,601,849,609,803,509,546,500,557,519,561,191,1804,183,1799,174,1803,1484,870,1461,869,1449,854]; const datac = [336,1718,535,1721,735,1719,848,884,850,764,849,648,785,547,788,357,783,252,39,934,40,1064,39,1222,104,1433,101,1334,102,1175,786,1104,786,978,786,849,785,1145,787,1252,786,1377,102,873,102,1040,102,1173,107,1719,307,1719,335,1718,103,594,102,742,102,858,39,532,38,715,39,858,786,550,787,705,786,847,543,23,456,23,303,23,849,293,848,445,849,566,849,981,850,1119,848,1216,103,251,102,406,102,551,649,1646,773,1600,824,1503,493,87,308,79,244,105,39,482,39,371,39,269,274,1666,234,1666,34,1667,635,1667,835,1664,857,1669,849,1218,848,1298,849,1427,775,116,703,49,600,27,725,155,636,83,527,86,219,1640,120,1594,72,1517,260,1587,170,1552,130,1491,291,28,214,40,133,97,728,1527,785,1466,786,1396,39,1229,38,1320,40,1448,555,1598,667,1588,724,1530,41,267,45,207,92,140,803,148,852,225,849,301,614,1591,616,1744,614,1713,862,1679,894,1730,744,1719,272,1589,274,1732,271,1718,316,1706,315,1605,317,1595,529,1720,529,1662,529,1597,360,1704,348,1537,402,1633,239,108,147,147,110,236,519,1597,477,1610,488,1714,572,1603,572,1674,572,1720,485,1513,429,1483,387,1530,25,1677,4,1731,101,1718,781,245,743,157,714,153,849,867,848,922,849,978,510,1597,523,1549,490,1518,491,1624,453,1653,406,1631,382,1601,334,1601,264,1588,401,1625,402,1687,401,1721,849,664,849,643,849,573,444,1644,444,1733,445,1718,74,1519,45,1466,42,1430,848,1413,850,1442,825,1501,40,863,38,883,39,927,385,1532,367,1566,378,1597,126,1487,103,1430,107,1435,95,137,119,109,152,85,226,1640,198,1633,273,1656,537,23,549,21,606,29,39,532,39,482,39,459,103,536,101,567,103,600,763,107,789,130,812,163,786,1106,786,1122,786,1205,645,1647,589,1663,632,1667,478,87,495,85,521,86,516,1600,588,1593,534,1598,103,271,115,218,111,240,786,1373,786,1400,784,1424,393,1719,241,1719,285,1718,284,29,311,24,321,25,102,837,103,877,101,866,830,1720,859,1721,865,1702,39,884,39,855,39,954,31,1672,23,1678,39,1668,315,1719,317,1701,316,1714,359,1694,359,1724,359,1709,358,86,341,84,288,92,572,1594,573,1724,572,1672,102,1198,102,1128,102,1105,861,1674,863,1677,847,1667,849,584,849,522,849,532,776,234,788,271,786,300,849,1019,848,980,849,955,416,1719,459,1719,526,1719,760,1720,714,1720,694,1720,102,997,102,980,102,941,337,1599,364,1597,358,1617,849,1289,850,1449,849,1382,39,1410,39,1405,39,1348,786,677,786,709,786,724,849,1260,850,1152,849,1186,39,696,39,727,39,763,487,1649,490,1622,472,1635,786,619,786,587,786,540,615,1638,615,1663,615,1702,39,807,39,855,39,872,406,86,466,86,438,86,849,759,849,791,849,830,849,1021,850,1057,849,1085,348,23,420,22,398,23,849,338,849,385,849,412,39,670,40,636,39,615,316,1617,316,1628,316,1663,39,1039,39,1014,39,1083,39,1134,39,1174,39,1213,627,100,595,91,567,87,273,1655,272,1626,274,1600,102,634,102,684,102,716,39,403,39,366,39,346,850,515,848,502,849,466,504,23,480,22,453,23,39,327,39,302,39,284,174,1616,148,1600,127,1583,102,374,102,323,102,300,102,1073,102,1048,102,1033,102,523,102,554,102,458,102,451,101,425,102,405,102,1327,102,1368,103,1379,615,1634,616,1586,613,1591,786,765,786,737,786,712,102,782,102,815,102,840,357,86,421,86,393,86,786,996,787,908,786,979,703,1667,726,1667,756,1667,607,1720,562,1719,538,1719,438,1719,409,1719,360,1719,444,1718,444,1708,444,1659,849,1175,849,1156,849,1140,786,535,786,493,786,458,125,1720,138,1720,62,1720,102,1308,102,1282,102,1241,786,921,786,874,786,864,359,1676,359,1634,359,1624,39,544,39,632,39,614,102,719,102,755,102,774,39,521,40,476,39,494,849,645,849,626,849,581,786,1241,787,1268,786,1297,658,1574,646,1580,623,1588,487,1650,487,1689,487,1711,775,1719,835,1718,818,1719,786,833,786,791,786,778,39,1008,39,940,39,955,39,1209,39,1246,39,1260,849,965,849,942,849,920,273,1658,273,1722,273,1690,786,1062,786,1113,786,1081,786,1048,786,1032,786,1018,844,240,851,285,849,314,39,1126,39,1100,39,1085,39,459,39,381,39,420,109,1444,103,1420,102,1396,786,378,787,410,786,454,233,1576,203,1562,176,1541,477,1510,489,1515,504,1534,102,858,103,887,102,909,359,1719,320,1720,310,1719,39,1306,40,1288,39,1278,522,86,556,86,561,87,755,1588,721,1615,696,1626,254,36,220,47,198,57,786,368,786,350,786,313,786,638,786,666,786,676,386,1610,373,1592,374,1563,675,50,655,42,611,30,231,1720,284,1718,304,1719,564,23,544,23,509,23,849,1096,848,1068,849,1130,207,1720,161,1721,146,1720,834,207,843,234,842,234,513,1557,516,1578,511,1593,758,195,731,161,738,170,400,1718,402,1701,401,1654,727,1528,706,1548,677,1564,757,102,746,90,714,70,849,935,849,858,849,906,849,711,849,695,849,664,61,190,75,164,94,138,102,1255,102,1181,102,1205,60,195,55,199,45,239,849,819,849,883,849,854,168,151,173,148,206,125,309,1595,282,1592,260,1587,470,86,513,86,432,86,786,1345,787,1270,786,1329,846,1434,841,1461,837,1470,654,110,676,121,696,133,487,1627,501,1614,509,1599,807,1530,790,1555,769,1574,579,1593,605,1592,618,1590,102,613,102,571,102,581,836,1474,832,1483,819,1511,377,1719,272,1719,324,1718,788,1667,797,1665,840,1666,316,1666,316,1732,316,1701,393,1719,344,1719,309,1719,384,1535,377,1545,375,1561,39,1311,38,1366,39,1337,76,1666,89,1666,126,1666,472,1506,447,1500,437,1501,849,396,848,441,850,457,133,1495,110,1454,115,1463,849,704,849,722,849,753,55,1481,37,1425,58,1488,169,1535,138,1503,145,1510,129,199,142,179,154,166,39,766,38,828,39,783,572,1715,572,1677,572,1697,849,1291,849,1254,849,1269,94,139,95,137,119,111,102,311,101,293,103,275,395,1719,335,1719,283,1718,786,1090,786,1137,786,1124,102,946,102,941,102,906,102,352,102,365,102,409,781,1441,770,1471,755,1496,252,103,217,117,237,109,529,1676,529,1659,529,1640,228,1642,229,1643,269,1654,441,1718,461,1720,488,1719,786,1233,786,1224,786,1205,832,203,827,191,812,164,273,1718,273,1697,273,1684,130,1666,154,1666,183,1666,786,1349,786,1409,786,1375,242,1666,204,1667,192,1666,624,1653,634,1651,675,1636,201,1631,167,1613,162,1609,433,1503,417,1503,397,1519,786,928,786,955,786,911,39,1276,38,1237,39,1303,38,1719,61,1719,61,1719,39,352,38,329,40,326,660,1719,609,1719,614,1718,403,1629,425,1642,443,1641,255,102,262,100,283,94,671,1666,706,1667,694,1667,81,1530,64,1505,61,1494,102,1113,102,1108,102,1074,444,1661,444,1634,444,1646,436,23,421,23,406,23,849,318,849,348,849,345,757,193,762,201,774,230,102,1298,102,1311,102,1330,119,1575,126,1583,99,1554,736,1519,754,1500,728,1526,529,1623,530,1637,529,1609,282,1718,250,1719,312,1718,668,1666,636,1666,623,1666,251,37,273,32,274,31,849,466,849,523,849,528,102,1014,103,1036,102,1043,781,1666,767,1668,761,1667,155,82,161,78,193,59,529,1713,529,1693,529,1680,615,1711,614,1694,615,1669,573,24,597,28,588,26,664,1720,679,1718,691,1720,224,1719,216,1719,202,1719,266,1666,243,1666,259,1666,331,1719,301,1719,278,1718,22,1701,19,1690,24,1679,864,1681,869,1691,866,1700,201,1630,217,1637,220,1638,102,1392,102,1368,102,1366,45,236,46,237,39,279,701,63,684,55,682,53,275,1719,344,1718,329,1718,102,581,102,562,102,545,567,1595,577,1595,562,1595,316,1625,316,1605,317,1598,393,1719,405,1719,433,1719,701,137,718,149,708,142,39,674,39,686,39,700,786,636,786,608,786,629,39,1005,40,1024,39,1039,462,1638,472,1637,454,1640,786,1011,786,1000,786,990,401,1651,401,1625,401,1643,109,245,112,229,118,220,276,1718,330,1719,292,1718,407,1631,385,1613,385,1609,327,24,346,23,365,23,40,1413,41,1438,40,1413,786,1122,786,1140,786,1149,786,854,786,836,786,824,615,1610,615,1623,615,1653,498,1719,518,1719,457,1719,64,1666,57,1665,46,1667,786,335,787,355,786,369,394,1719,370,1719,333,1719,481,23,472,23,437,23,39,544,39,531,39,499,316,1637,317,1617,316,1604,39,1101,40,1108,39,1149,555,87,553,86,514,86,258,1585,252,1584,238,1578,797,143,777,119,781,124,785,775,787,777,786,751,460,86,492,85,512,86];