Consider an array that has no prime numbers, and none of its elements has any prime digit. It would start with: `[1,4,6,8,9,10,14,16,18,..]`. 

`12` and `15` are not in the list because `2` and `5` are primes.

You will be given an integer `n` and your task will be return the number at that index in the array. 
For example:
```
solve(0) = 1
solve(2) = 6
``` 

More examples in the test cases.

Good luck!

If you like Prime Katas, you will enjoy this Kata: [Simple Prime Streaming](https://www.codewars.com/kata/5a908da30025e995880000e3)

Difficulty: introductory

Starter code:

def solve(n):
	

Solutions:
n,forbid = 100000, set("2357")
sieve, notPrimes = [0]*(n+1), [1]
for i in range(2, n+1):
    if sieve[i]:
        if not (forbid & set(str(i))): notPrimes.append(i)
    else:
        for j in range(i**2, n+1, i):  sieve[j] = 1

def solve(n): return notPrimes[n]

solve=lambda n: [1,4,6,8,9,10,14,16,18,40,44,46,48,49,60,64,66,68,69,80,81,84,86,88,90,91,94,96,98,99,100,104,106,108,110,111,114,116,118,119,140,141,144,146,148,160,161,164,166,168,169,180,184,186,188,189,190,194,196,198,400,404,406,408,410,411,414,416,418,440,441,444,446,448,460,464,466,468,469,480,481,484,486,488,489,490,494,496,498,600,604,606,608,609,610,611,614,616,618,640,644,646,648,649,660,664,666,668,669,680,681,684,686,688,689,690,694,696,698,699,800,801,804,806,808,810,814,816,818,819,840,841,844,846,848,849,860,861,864,866,868,869,880,884,886,888,889,890,891,894,896,898,899,900,901,904,906,908,909,910,914,916,918,940,944,946,948,949,960,961,964,966,968,969,980,981,984,986,988,989,990,994,996,998,999,1000,1001,1004,1006,1008,1010,1011,1014,1016,1018,1040,1041,1044,1046,1048,1060,1064,1066,1068,1080,1081,1084,1086,1088,1089,1090,1094,1096,1098,1099,1100,1101,1104,1106,1108,1110,1111,1114,1116,1118,1119,1140,1141,1144,1146,1148,1149,1160,1161,1164,1166,1168,1169,1180,1184,1186,1188,1189,1190,1191,1194,1196,1198,1199,1400,1401,1404,1406,1408,1410,1411,1414,1416,1418,1419,1440,1441,1444,1446,1448,1449,1460,1461,1464,1466,1468,1469,1480,1484,1486,1488,1490,1491,1494,1496,1498,1600,1604,1606,1608,1610,1611,1614,1616,1618,1640,1641,1644,1646,1648,1649,1660,1661,1664,1666,1668,1680,1681,1684,1686,1688,1689,1690,1691,1694,1696,1698,1800,1804,1806,1808,1809,1810,1814,1816,1818,1819,1840,1841,1844,1846,1848,1849,1860,1864,1866,1868,1869,1880,1881,1884,1886,1888,1890,1891,1894,1896,1898,1899,1900,1904,1906,1908,1909,1910,1911,1914,1916,1918,1919,1940,1941,1944,1946,1948,1960,1961,1964,1966,1968,1969,1980,1981,1984,1986,1988,1989,1990,1991,1994,1996,1998,4000,4004,4006,4008,4009,4010,4011,4014,4016,4018,4040,4041,4044,4046,4048,4060,4061,4064,4066,4068,4069,4080,4081,4084,4086,4088,4089,4090,4094,4096,4098,4100,4101,4104,4106,4108,4109,4110,4114,4116,4118,4119,4140,4141,4144,4146,4148,4149,4160,4161,4164,4166,4168,4169,4180,4181,4184,4186,4188,4189,4190,4191,4194,4196,4198,4199,4400,4401,4404,4406,4408,4410,4411,4414,4416,4418,4419,4440,4444,4446,4448,4449,4460,4461,4464,4466,4468,4469,4480,4484,4486,4488,4489,4490,4491,4494,4496,4498,4499,4600,4601,4604,4606,4608,4609,4610,4611,4614,4616,4618,4619,4640,4641,4644,4646,4648,4660,4661,4664,4666,4668,4669,4680,4681,4684,4686,4688,4689,4690,4694,4696,4698,4699,4800,4804,4806,4808,4809,4810,4811,4814,4816,4818,4819,4840,4841,4844,4846,4848,4849,4860,4864,4866,4868,4869,4880,4881,4884,4886,4888,4890,4891,4894,4896,4898,4899,4900,4901,4904,4906,4908,4910,4911,4914,4916,4918,4940,4941,4944,4946,4948,4949,4960,4961,4964,4966,4968,4980,4981,4984,4986,4988,4989,4990,4991,4994,4996,4998,6000,6001,6004,6006,6008,6009,6010,6014,6016,6018,6019,6040,6041,6044,6046,6048,6049,6060,6061,6064,6066,6068,6069,6080,6081,6084,6086,6088,6090,6094,6096,6098,6099,6100,6104,6106,6108,6109,6110,6111,6114,6116,6118,6119,6140,6141,6144,6146,6148,6149,6160,6161,6164,6166,6168,6169,6180,6181,6184,6186,6188,6189,6190,6191,6194,6196,6198,6400,6401,6404,6406,6408,6409,6410,6411,6414,6416,6418,6419,6440,6441,6444,6446,6448,6460,6461,6464,6466,6468,6480,6484,6486,6488,6489,6490,6494,6496,6498,6499,6600,6601,6604,6606,6608,6609,6610,6611,6614,6616,6618,6640,6641,6644,6646,6648,6649,6660,6664,6666,6668,6669,6680,6681,6684,6686,6688,6690,6694,6696,6698,6699,6800,6801,6804,6806,6808,6809,6810,6811,6814,6816,6818,6819,6840,6844,6846,6848,6849,6860,6861,6864,6866,6868,6880,6881,6884,6886,6888,6889,6890,6891,6894,6896,6898,6900,6901,6904,6906,6908,6909,6910,6914,6916,6918,6919,6940,6941,6944,6946,6948,6960,6964,6966,6968,6969,6980,6981,6984,6986,6988,6989,6990,6994,6996,6998,6999,8000,8001,8004,8006,8008,8010,8014,8016,8018,8019,8040,8041,8044,8046,8048,8049,8060,8061,8064,8066,8068,8080,8084,8086,8088,8090,8091,8094,8096,8098,8099,8100,8104,8106,8108,8109,8110,8114,8116,8118,8119,8140,8141,8144,8146,8148,8149,8160,8164,8166,8168,8169,8180,8181,8184,8186,8188,8189,8190,8194,8196,8198,8199,8400,8401,8404,8406,8408,8409,8410,8411,8414,8416,8418,8440,8441,8444,8446,8448,8449,8460,8464,8466,8468,8469,8480,8481,8484,8486,8488,8489,8490,8491,8494,8496,8498,8499,8600,8601,8604,8606,8608,8610,8611,8614,8616,8618,8619,8640,8644,8646,8648,8649,8660,8661,8664,8666,8668,8680,8684,8686,8688,8690,8691,8694,8696,8698,8800,8801,8804,8806,8808,8809,8810,8811,8814,8816,8818,8840,8841,8844,8846,8848,8860,8864,8866,8868,8869,8880,8881,8884,8886,8888,8889,8890,8891,8894,8896,8898,8899,8900,8901,8904,8906,8908,8909,8910,8911,8914,8916,8918,8919,8940,8944,8946,8948,8949,8960,8961,8964,8966,8968,8980,8981,8984,8986,8988,8989,8990,8991,8994,8996,8998,9000,9004,9006,9008,9009,9010,9014,9016,9018,9019,9040,9044,9046,9048,9060,9061,9064,9066,9068,9069,9080,9081,9084,9086,9088,9089,9090,9094,9096,9098,9099,9100,9101,9104,9106,9108,9110,9111,9114,9116,9118,9119,9140,9141,9144,9146,9148,9149,9160,9164,9166,9168,9169,9180,9184,9186,9188,9189,9190,9191,9194,9196,9198,9400,9401,9404,9406,9408,9409,9410,9411,9414,9416,9418,9440,9441,9444,9446,9448,9449,9460,9464,9466,9468,9469,9480,9481,9484,9486,9488,9489,9490,9494,9496,9498,9499,9600,9604,9606,9608,9609,9610,9611,9614,9616,9618,9640,9641,9644,9646,9648,9660,9664,9666,9668,9669,9680,9681,9684,9686,9688,9690,9691,9694,9696,9698,9699,9800,9801,9804,9806,9808,9809,9810,9814,9816,9818,9819,9840,9841,9844,9846,9848,9849,9860,9861,9864,9866,9868,9869,9880,9881,9884,9886,9888,9889,9890,9891,9894,9896,9898,9899,9900,9904,9906,9908,9909,9910,9911,9914,9916,9918,9919,9940,9944,9946,9948,9960,9961,9964,9966,9968,9969,9980,9981,9984,9986,9988,9989,9990,9991,9994,9996,9998,9999,10000,10001,10004,10006,10008,10010,10011,10014,10016,10018,10019,10040,10041,10044,10046,10048,10049,10060,10064,10066,10068,10080,10081,10084,10086,10088,10089,10090,10094,10096,10098,10100,10101,10104,10106,10108,10109,10110,10114,10116,10118,10119,10140,10144,10146,10148,10149,10160,10161,10164,10166,10168,10180,10184,10186,10188,10189,10190,10191,10194,10196,10198,10199,10400,10401,10404,10406,10408,10409,10410,10411,10414,10416,10418,10419,10440,10441,10444,10446,10448,10449,10460,10461,10464,10466,10468,10469,10480,10481,10484,10486,10488,10489,10490,10491,10494,10496,10498,10600,10604,10606,10608,10609,10610,10611,10614,10616,10618,10619,10640,10641,10644,10646,10648,10649,10660,10661,10664,10666,10668,10669,10680,10681,10684,10686,10688,10689,10690,10694,10696,10698,10699,10800,10801,10804,10806,10808,10809,10810,10811,10814,10816,10818,10819,10840,10841,10844,10846,10848,10849,10860,10864,10866,10868,10869,10880,10881,10884,10886,10888,10890,10894,10896,10898,10899,10900,10901,10904,10906,10908,10910,10911,10914,10916,10918,10919,10940,10941,10944,10946,10948,10960,10961,10964,10966,10968,10969,10980,10981,10984,10986,10988,10989,10990,10991,10994,10996,10998,10999,11000,11001,11004,11006,11008,11009,11010,11011,11014,11016,11018,11019,11040,11041,11044,11046,11048,11049,11060,11061,11064,11066,11068,11080,11081,11084,11086,11088,11089,11090,11091,11094,11096,11098,11099,11100,11101,11104,11106,11108,11109,11110,11111,11114,11116,11118,11140,11141,11144,11146,11148,11160,11164,11166,11168,11169,11180,11181,11184,11186,11188,11189,11190,11191,11194,11196,11198,11199,11400,11401,11404,11406,11408,11409,11410,11414,11416,11418,11419,11440,11441,11444,11446,11448,11449,11460,11461,11464,11466,11468,11469,11480,11481,11484,11486,11488,11490,11494,11496,11498,11499,11600,11601,11604,11606,11608,11609,11610,11611,11614,11616,11618,11619,11640,11641,11644,11646,11648,11649,11660,11661,11664,11666,11668,11669,11680,11684,11686,11688,11690,11691,11694,11696,11698,11800,11804,11806,11808,11809,11810,11811,11814,11816,11818,11819,11840,11841,11844,11846,11848,11849,11860,11861,11864,11866,11868,11869,11880,11881,11884,11886,11888,11889,11890,11891,11894,11896,11898,11899,11900,11901,11904,11906,11908,11910,11911,11914,11916,11918,11919,11940,11944,11946,11948,11949,11960,11961,11964,11966,11968,11980,11984,11986,11988,11989,11990,11991,11994,11996,11998,11999,14000,14001,14004,14006,14008,14010,14014,14016,14018,14019,14040,14041,14044,14046,14048,14049,14060,14061,14064,14066,14068,14069,14080,14084,14086,14088,14089,14090,14091,14094,14096,14098,14099,14100,14101,14104,14106,14108,14109,14110,14111,14114,14116,14118,14119,14140,14141,14144,14146,14148,14160,14161,14164,14166,14168,14169,14180,14181,14184,14186,14188,14189,14190,14191,14194,14196,14198,14199,14400,14404,14406,14408,14409,14410,14414,14416,14418,14440,14441,14444,14446,14448,14460,14464,14466,14468,14469,14480,14481,14484,14486,14488,14490,14491,14494,14496,14498,14499,14600,14601,14604,14606,14608,14609,14610,14611,14614,14616,14618,14619,14640,14641,14644,14646,14648,14649,14660,14661,14664,14666,14668,14680,14681,14684,14686,14688,14689,14690,14691,14694,14696,14698,14800,14801,14804,14806,14808,14809,14810,14811,14814,14816,14818,14819,14840,14841,14844,14846,14848,14849,14860,14861,14864,14866,14868,14880,14881,14884,14886,14888,14889,14890,14894,14896,14898,14899,14900,14901,14904,14906,14908,14909,14910,14911,14914,14916,14918,14919,14940,14941,14944,14946,14948,14949,14960,14961,14964,14966,14968,14980,14981,14984,14986,14988,14989,14990,14991,14994,14996,14998,14999,16000,16004,16006,16008,16009,16010,16011,16014,16016,16018,16019,16040,16041,16044,16046,16048,16049,16060,16064,16066,16068,16080,16081,16084,16086,16088,16089,16090,16094,16096,16098,16099,16100,16101,16104,16106,16108,16109,16110,16114,16116,16118,16119,16140,16144,16146,16148,16149,16160,16161,16164,16166,16168,16169,16180,16181,16184,16186,16188,16190,16191,16194,16196,16198,16199,16400,16401,16404,16406,16408,16409,16410,16414,16416,16418,16419,16440,16441,16444,16446,16448,16449,16460,16461,16464,16466,16468,16469,16480,16484,16486,16488,16489,16490,16491,16494,16496,16498,16499,16600,16601,16604,16606,16608,16609,16610,16611,16614,16616,16618,16640,16641,16644,16646,16648,16660,16664,16666,16668,16669,16680,16681,16684,16686,16688,16689,16690,16694,16696,16698,16800,16801,16804,16806,16808,16809,16810,16814,16816,16818,16819,16840,16841,16844,16846,16848,16849,16860,16861,16864,16866,16868,16869,16880,16881,16884,16886,16888,16890,16891,16894,16896,16898,16899,16900,16904,16906,16908,16909,16910,16911,16914,16916,16918,16919,16940,16941,16944,16946,16948,16949,16960,16961,16964,16966,16968,16969,16980,16984,16986,16988,16989,16990,16991,16994,16996,16998,16999,18000,18001,18004,18006,18008,18009,18010,18011,18014,18016,18018,18019,18040,18044,18046,18048,18060,18064,18066,18068,18069,18080,18081,18084,18086,18088,18090,18091,18094,18096,18098,18099,18100,18101,18104,18106,18108,18109,18110,18111,18114,18116,18118,18140,18141,18144,18146,18148,18160,18161,18164,18166,18168,18180,18184,18186,18188,18189,18190,18194,18196,18198,18400,18404,18406,18408,18409,18410,18411,18414,18416,18418,18419,18440,18441,18444,18446,18448,18449,18460,18464,18466,18468,18469,18480,18484,18486,18488,18489,18490,18491,18494,18496,18498,18499,18600,18601,18604,18606,18608,18609,18610,18611,18614,18616,18618,18619,18640,18641,18644,18646,18648,18649,18660,18664,18666,18668,18669,18680,18681,18684,18686,18688,18689,18690,18694,18696,18698,18699,18800,18801,18804,18806,18808,18809,18810,18811,18814,18816,18818,18819,18840,18841,18844,18846,18848,18849,18860,18861,18864,18866,18868,18880,18881,18884,18886,18888,18889,18890,18891,18894,18896,18898,18900,18901,18904,18906,18908,18909,18910,18914,18916,18918,18940,18941,18944,18946,18948,18949,18960,18961,18964,18966,18968,18969,18980,18981,18984,18986,18988,18989,18990,18991,18994,18996,18998,18999,19000,19004,19006,19008,19010,19011,19014,19016,19018,19019,19040,19041,19044,19046,19048,19049,19060,19061,19064,19066,19068,19080,19084,19086,19088,19089,19090,19091,19094,19096,19098,19099,19100,19101,19104,19106,19108,19109,19110,19111,19114,19116,19118,19119,19140,19144,19146,19148,19149,19160,19161,19164,19166,19168,19169,19180,19184,19186,19188,19189,19190,19191,19194,19196,19198,19199,19400,19401,19404,19406,19408,19409,19410,19411,19414,19416,19418,19419,19440,19444,19446,19448,19449,19460,19461,19464,19466,19468,19480,19481,19484,19486,19488,19490,19491,19494,19496,19498,19499,19600,19601,19604,19606,19608,19610,19611,19614,19616,19618,19619,19640,19641,19644,19646,19648,19649,19660,19664,19666,19668,19669,19680,19684,19686,19688,19689,19690,19691,19694,19696,19698,19800,19804,19806,19808,19809,19810,19811,19814,19816,19818,19840,19844,19846,19848,19849,19860,19864,19866,19868,19869,19880,19881,19884,19886,19888,19890,19894,19896,19898,19899,19900,19901,19904,19906,19908,19909,19910,19911,19914,19916,19918,19940,19941,19944,19946,19948,19960,19964,19966,19968,19969,19980,19981,19984,19986,19988,19989,19990,19994,19996,19998,19999,40000,40001,40004,40006,40008,40010,40011,40014,40016,40018,40019,40040,40041,40044,40046,40048,40049,40060,40061,40064,40066,40068,40069,40080,40081,40084,40086,40088,40089,40090,40091,40094,40096,40098,40100,40101,40104,40106,40108,40109,40110,40114,40116,40118,40119,40140,40141,40144,40146,40148,40149,40160,40161,40164,40166,40168,40180,40181,40184,40186,40188,40190,40191,40194,40196,40198,40199,40400,40401,40404,40406,40408,40409,40410,40411,40414,40416,40418,40419,40440,40441,40444,40446,40448,40449,40460,40461,40464,40466,40468,40469,40480,40481,40484,40486,40488,40489,40490,40491,40494,40496,40498,40600,40601,40604,40606,40608,40610,40611,40614,40616,40618,40619,40640,40641,40644,40646,40648,40649,40660,40661,40664,40666,40668,40669,40680,40681,40684,40686,40688,40689,40690,40691,40694,40696,40698,40800,40804,40806,40808,40809,40810,40811,40814,40816,40818,40840,40844,40846,40848,40860,40861,40864,40866,40868,40869,40880,40881,40884,40886,40888,40889,40890,40891,40894,40896,40898,40899,40900,40901,40904,40906,40908,40909,40910,40911,40914,40916,40918,40919,40940,40941,40944,40946,40948,40960,40964,40966,40968,40969,40980,40981,40984,40986,40988,40989,40990,40991,40994,40996,40998,40999,41000,41001,41004,41006,41008,41009,41010,41014,41016,41018,41019,41040,41041,41044,41046,41048,41049,41060,41061,41064,41066,41068,41069,41080,41084,41086,41088,41089,41090,41091,41094,41096,41098,41099,41100,41101,41104,41106,41108,41109,41110,41111,41114,41116,41118,41119,41140,41144,41146,41148,41160,41164,41166,41168,41169,41180,41181,41184,41186,41188,41190,41191,41194,41196,41198,41199,41400,41401,41404,41406,41408,41409,41410,41414,41416,41418,41419,41440,41441,41444,41446,41448,41449,41460,41461,41464,41466,41468,41469,41480,41481,41484,41486,41488,41489,41490,41494,41496,41498,41499,41600,41601,41604,41606,41608,41610,41614,41616,41618,41619,41640,41644,41646,41648,41649,41660,41661,41664,41666,41668,41680,41684,41686,41688,41689,41690,41691,41694,41696,41698,41699,41800,41804,41806,41808,41810,41811,41814,41816,41818,41819,41840,41841,41844,41846,41848,41860,41861,41864,41866,41868,41869,41880,41881,41884,41886,41888,41889,41890,41891,41894,41896,41898,41899,41900,41901,41904,41906,41908,41909,41910,41914,41916,41918,41919,41940,41944,41946,41948,41949,41960,41961,41964,41966,41968,41980,41984,41986,41988,41989,41990,41991,41994,41996,41998,44000,44001,44004,44006,44008,44009,44010,44011,44014,44016,44018,44019,44040,44044,44046,44048,44049,44060,44061,44064,44066,44068,44069,44080,44081,44084,44086,44088,44090,44091,44094,44096,44098,44099,44100,44104,44106,44108,44109,44110,44114,44116,44118,44140,44141,44144,44146,44148,44149,44160,44161,44164,44166,44168,44169,44180,44181,44184,44186,44188,44190,44191,44194,44196,44198,44199,44400,44401,44404,44406,44408,44409,44410,44411,44414,44416,44418,44419,44440,44441,44444,44446,44448,44460,44461,44464,44466,44468,44469,44480,44481,44484,44486,44488,44489,44490,44494,44496,44498,44499,44600,44601,44604,44606,44608,44609,44610,44611,44614,44616,44618,44619,44640,44644,44646,44648,44649,44660,44661,44664,44666,44668,44669,44680,44681,44684,44686,44688,44689,44690,44691,44694,44696,44698,44800,44801,44804,44806,44808,44810,44811,44814,44816,44818,44840,44841,44844,44846,44848,44849,44860,44861,44864,44866,44868,44869,44880,44881,44884,44886,44888,44889,44890,44891,44894,44896,44898,44899,44900,44901,44904,44906,44908,44910,44911,44914,44916,44918,44919,44940,44941,44944,44946,44948,44949,44960,44961,44964,44966,44968,44969,44980,44981,44984,44986,44988,44989,44990,44991,44994,44996,44998,44999,46000,46001,46004,46006,46008,46009,46010,46011,46014,46016,46018,46019,46040,46041,46044,46046,46048,46060,46064,46066,46068,46069,46080,46081,46084,46086,46088,46089,46090,46094,46096,46098,46100,46101,46104,46106,46108,46109,46110,46111,46114,46116,46118,46119,46140,46144,46146,46148,46149,46160,46161,46164,46166,46168,46169,46180,46184,46186,46188,46189,46190,46191,46194,46196,46198,46400,46401,46404,46406,46408,46409,46410,46414,46416,46418,46419,46440,46444,46446,46448,46449,46460,46461,46464,46466,46468,46469,46480,46481,46484,46486,46488,46490,46491,46494,46496,46498,46600,46604,46606,46608,46609,46610,46611,46614,46616,46618,46640,46641,46644,46646,46648,46660,46661,46664,46666,46668,46669,46680,46684,46686,46688,46689,46690,46694,46696,46698,46699,46800,46801,46804,46806,46808,46809,46810,46814,46816,46818,46840,46841,46844,46846,46848,46849,46860,46864,46866,46868,46869,46880,46881,46884,46886,46888,46890,46891,46894,46896,46898,46899,46900,46904,46906,46908,46909,46910,46911,46914,46916,46918,46940,46941,46944,46946,46948,46949,46960,46961,46964,46966,46968,46969,46980,46981,46984,46986,46988,46989,46990,46991,46994,46996,46998,46999,48000,48001,48004,48006,48008,48009,48010,48011,48014,48016,48018,48019,48040,48041,48044,48046,48048,48060,48061,48064,48066,48068,48069,48080,48081,48084,48086,48088,48089,48090,48094,48096,48098,48099,48100,48101,48104,48106,48108,48110,48111,48114,48116,48118,48140,48141,48144,48146,48148,48149,48160,48161,48164,48166,48168,48169,48180,48181,48184,48186,48188,48189,48190,48191,48194,48196,48198,48199,48400,48401,48404,48406,48408,48410,48411,48414,48416,48418,48419,48440,48441,48444,48446,48448,48460,48461,48464,48466,48468,48469,48480,48484,48486,48488,48489,48490,48494,48496,48498,48499,48600,48601,48604,48606,48608,48609,48610,48614,48616,48618,48640,48641,48644,48646,48648,48660,48664,48666,48668,48669,48680,48681,48684,48686,48688,48689,48690,48691,48694,48696,48698,48699,48800,48801,48804,48806,48808,48810,48811,48814,48816,48818,48819,48840,48841,48844,48846,48848,48849,48860,48861,48864,48866,48868,48880,48881,48884,48886,48888,48890,48891,48894,48896,48898,48899,48900,48901,48904,48906,48908,48909,48910,48911,48914,48916,48918,48919,48940,48941,48944,48946,48948,48949,48960,48961,48964,48966,48968,48969,48980,48981,48984,48986,48988,48990,48994,48996,48998,48999,49000,49001,49004,49006,49008,49010,49011,49014,49016,49018,49040,49041,49044,49046,49048,49049,49060,49061,49064,49066,49068,49080,49084,49086,49088,49089,49090,49091,49094,49096,49098,49099,49100,49101,49104,49106,49108,49110,49111,49114,49116,49118,49119,49140,49141,49144,49146,49148,49149,49160,49161,49164,49166,49168,49180,49181,49184,49186,49188,49189,49190,49191,49194,49196,49198,49400,49401,49404,49406,49408,49410,49414,49416,49418,49419,49440,49441,49444,49446,49448,49449,49460,49461,49464,49466,49468,49469,49480,49484,49486,49488,49489,49490,49491,49494,49496,49498,49600,49601,49604,49606,49608,49609,49610,49611,49614,49616,49618,49619,49640,49641,49644,49646,49648,49649,49660,49661,49664,49666,49668,49680,49684,49686,49688,49689,49690,49691,49694,49696,49698,49699,49800,49804,49806,49808,49809,49810,49814,49816,49818,49819,49840,49841,49844,49846,49848,49849,49860,49861,49864,49866,49868,49869,49880,49881,49884,49886,49888,49889,49890,49894,49896,49898,49899,49900,49901,49904,49906,49908,49909,49910,49911,49914,49916,49918,49940,49941,49944,49946,49948,49949,49960,49961,49964,49966,49968,49969,49980,49981,49984,49986,49988,49989,49990,49994,49996,49998][n]

from itertools import compress
def sieve(n): 
    n += 1
    r = [False,True] * (n//2) + [True] 
    r[1] = False
    r[2] = True 
    for i in range(3,int(n**.5)+1,2): 
        if r[i]: 
            r[i*i::2*i] = [False] * ((n+2*i-1-i*i)//(2*i))
    r = list(compress(range(len(r)),r))
    if r[-1] %2 == 0:
        return r[:-1]
    return r

primes = set(sieve(10**6))
res = [] 
factors = {'2','3','5','7'}
for i in range(1,10**6): 
    if i not in primes and set(str(i)).isdisjoint(factors): 
        res.append(i)

def solve(n):
    return res[n] 

limit = 50000
sieve = [0] * 2 + list(range(2, limit))
for i in range(2, limit):
        for j in range(i * i, limit, i):
            sieve[j] = 0
primes = {i for i in sieve if i}
p,i,li = ['2', '3', '5', '7'],0,[]
while len(li) <= 3000:
      if i and all(k not in p for k in str(i)) and i not in primes : li.append(i)
      i += 1
solve=lambda n:li[n]

import numpy as np

s = np.ones(100000)
s[1] = s[4::2] = 0
for i in range(3, int(len(s) ** 0.5) + 1, 2):
    if not s[i]:
        continue
    s[i*i::i] = 0
PRIME_DIGITS = {'2', '3', '5', '7'}
the_array = [i for i, x in enumerate(s) if (not x) and PRIME_DIGITS.isdisjoint(str(i))]

def solve(n):
    return the_array[n]

from itertools import product

LIMIT = 10**5
primes = set(n for n in range(3, LIMIT, 2) if all(n%x for x in range(3, int(n**0.5)+1, 2)))
non_primes, digits, n = [], ['14689'], 0

while n < LIMIT:
    for n in product(*digits):
        n = int(''.join(n))
        if n not in primes:
            non_primes.append(n)
    digits.append('014689')


def solve(n):
    return non_primes[n]

from itertools import count

import numpy as np

primes = np.ones(1000000)
primes[:2] = 0
for i in range(2, len(primes)):
    if primes[i]:
        primes[i * i::i] = 0

non_primes = [1, 4, 6, 8, 9, 10, 14, 16, 18]
def gen_non_primes():
    for x in count(non_primes[-1] + 1):
        if primes[x]:
            continue
        s = str(x)
        if '2' in s or '3' in s or '5' in s or '7' in s:
            continue
        non_primes.append(x)
        yield x
        
def solve(n):
    if n < len(non_primes):
        return non_primes[n]
    for i, np in enumerate(gen_non_primes(), len(non_primes)):
        if i == n:
            return np

def solve(n):
    return [1,4,6,8,9,10,14,16,18,40,44,46,48,49,60,64,66,68,69,80,81,84,86,88,90,91,94,96,98,99,100,104,106,108,110,111,114,116,118,119,140,141,144,146,148,160,161,164,166,168,169,180,184,186,188,189,190,194,196,198,400,404,406,408,410,411,414,416,418,440,441,444,446,448,460,464,466,468,469,480,481,484,486,488,489,490,494,496,498,600,604,606,608,609,610,611,614,616,618,640,644,646,648,649,660,664,666,668,669,680,681,684,686,688,689,690,694,696,698,699,800,801,804,806,808,810,814,816,818,819,840,841,844,846,848,849,860,861,864,866,868,869,880,884,886,888,889,890,891,894,896,898,899,900,901,904,906,908,909,910,914,916,918,940,944,946,948,949,960,961,964,966,968,969,980,981,984,986,988,989,990,994,996,998,999,1000,1001,1004,1006,1008,1010,1011,1014,1016,1018,1040,1041,1044,1046,1048,1060,1064,1066,1068,1080,1081,1084,1086,1088,1089,1090,1094,1096,1098,1099,1100,1101,1104,1106,1108,1110,1111,1114,1116,1118,1119,1140,1141,1144,1146,1148,1149,1160,1161,1164,1166,1168,1169,1180,1184,1186,1188,1189,1190,1191,1194,1196,1198,1199,1400,1401,1404,1406,1408,1410,1411,1414,1416,1418,1419,1440,1441,1444,1446,1448,1449,1460,1461,1464,1466,1468,1469,1480,1484,1486,1488,1490,1491,1494,1496,1498,1600,1604,1606,1608,1610,1611,1614,1616,1618,1640,1641,1644,1646,1648,1649,1660,1661,1664,1666,1668,1680,1681,1684,1686,1688,1689,1690,1691,1694,1696,1698,1800,1804,1806,1808,1809,1810,1814,1816,1818,1819,1840,1841,1844,1846,1848,1849,1860,1864,1866,1868,1869,1880,1881,1884,1886,1888,1890,1891,1894,1896,1898,1899,1900,1904,1906,1908,1909,1910,1911,1914,1916,1918,1919,1940,1941,1944,1946,1948,1960,1961,1964,1966,1968,1969,1980,1981,1984,1986,1988,1989,1990,1991,1994,1996,1998,4000,4004,4006,4008,4009,4010,4011,4014,4016,4018,4040,4041,4044,4046,4048,4060,4061,4064,4066,4068,4069,4080,4081,4084,4086,4088,4089,4090,4094,4096,4098,4100,4101,4104,4106,4108,4109,4110,4114,4116,4118,4119,4140,4141,4144,4146,4148,4149,4160,4161,4164,4166,4168,4169,4180,4181,4184,4186,4188,4189,4190,4191,4194,4196,4198,4199,4400,4401,4404,4406,4408,4410,4411,4414,4416,4418,4419,4440,4444,4446,4448,4449,4460,4461,4464,4466,4468,4469,4480,4484,4486,4488,4489,4490,4491,4494,4496,4498,4499,4600,4601,4604,4606,4608,4609,4610,4611,4614,4616,4618,4619,4640,4641,4644,4646,4648,4660,4661,4664,4666,4668,4669,4680,4681,4684,4686,4688,4689,4690,4694,4696,4698,4699,4800,4804,4806,4808,4809,4810,4811,4814,4816,4818,4819,4840,4841,4844,4846,4848,4849,4860,4864,4866,4868,4869,4880,4881,4884,4886,4888,4890,4891,4894,4896,4898,4899,4900,4901,4904,4906,4908,4910,4911,4914,4916,4918,4940,4941,4944,4946,4948,4949,4960,4961,4964,4966,4968,4980,4981,4984,4986,4988,4989,4990,4991,4994,4996,4998,6000,6001,6004,6006,6008,6009,6010,6014,6016,6018,6019,6040,6041,6044,6046,6048,6049,6060,6061,6064,6066,6068,6069,6080,6081,6084,6086,6088,6090,6094,6096,6098,6099,6100,6104,6106,6108,6109,6110,6111,6114,6116,6118,6119,6140,6141,6144,6146,6148,6149,6160,6161,6164,6166,6168,6169,6180,6181,6184,6186,6188,6189,6190,6191,6194,6196,6198,6400,6401,6404,6406,6408,6409,6410,6411,6414,6416,6418,6419,6440,6441,6444,6446,6448,6460,6461,6464,6466,6468,6480,6484,6486,6488,6489,6490,6494,6496,6498,6499,6600,6601,6604,6606,6608,6609,6610,6611,6614,6616,6618,6640,6641,6644,6646,6648,6649,6660,6664,6666,6668,6669,6680,6681,6684,6686,6688,6690,6694,6696,6698,6699,6800,6801,6804,6806,6808,6809,6810,6811,6814,6816,6818,6819,6840,6844,6846,6848,6849,6860,6861,6864,6866,6868,6880,6881,6884,6886,6888,6889,6890,6891,6894,6896,6898,6900,6901,6904,6906,6908,6909,6910,6914,6916,6918,6919,6940,6941,6944,6946,6948,6960,6964,6966,6968,6969,6980,6981,6984,6986,6988,6989,6990,6994,6996,6998,6999,8000,8001,8004,8006,8008,8010,8014,8016,8018,8019,8040,8041,8044,8046,8048,8049,8060,8061,8064,8066,8068,8080,8084,8086,8088,8090,8091,8094,8096,8098,8099,8100,8104,8106,8108,8109,8110,8114,8116,8118,8119,8140,8141,8144,8146,8148,8149,8160,8164,8166,8168,8169,8180,8181,8184,8186,8188,8189,8190,8194,8196,8198,8199,8400,8401,8404,8406,8408,8409,8410,8411,8414,8416,8418,8440,8441,8444,8446,8448,8449,8460,8464,8466,8468,8469,8480,8481,8484,8486,8488,8489,8490,8491,8494,8496,8498,8499,8600,8601,8604,8606,8608,8610,8611,8614,8616,8618,8619,8640,8644,8646,8648,8649,8660,8661,8664,8666,8668,8680,8684,8686,8688,8690,8691,8694,8696,8698,8800,8801,8804,8806,8808,8809,8810,8811,8814,8816,8818,8840,8841,8844,8846,8848,8860,8864,8866,8868,8869,8880,8881,8884,8886,8888,8889,8890,8891,8894,8896,8898,8899,8900,8901,8904,8906,8908,8909,8910,8911,8914,8916,8918,8919,8940,8944,8946,8948,8949,8960,8961,8964,8966,8968,8980,8981,8984,8986,8988,8989,8990,8991,8994,8996,8998,9000,9004,9006,9008,9009,9010,9014,9016,9018,9019,9040,9044,9046,9048,9060,9061,9064,9066,9068,9069,9080,9081,9084,9086,9088,9089,9090,9094,9096,9098,9099,9100,9101,9104,9106,9108,9110,9111,9114,9116,9118,9119,9140,9141,9144,9146,9148,9149,9160,9164,9166,9168,9169,9180,9184,9186,9188,9189,9190,9191,9194,9196,9198,9400,9401,9404,9406,9408,9409,9410,9411,9414,9416,9418,9440,9441,9444,9446,9448,9449,9460,9464,9466,9468,9469,9480,9481,9484,9486,9488,9489,9490,9494,9496,9498,9499,9600,9604,9606,9608,9609,9610,9611,9614,9616,9618,9640,9641,9644,9646,9648,9660,9664,9666,9668,9669,9680,9681,9684,9686,9688,9690,9691,9694,9696,9698,9699,9800,9801,9804,9806,9808,9809,9810,9814,9816,9818,9819,9840,9841,9844,9846,9848,9849,9860,9861,9864,9866,9868,9869,9880,9881,9884,9886,9888,9889,9890,9891,9894,9896,9898,9899,9900,9904,9906,9908,9909,9910,9911,9914,9916,9918,9919,9940,9944,9946,9948,9960,9961,9964,9966,9968,9969,9980,9981,9984,9986,9988,9989,9990,9991,9994,9996,9998,9999,10000,10001,10004,10006,10008,10010,10011,10014,10016,10018,10019,10040,10041,10044,10046,10048,10049,10060,10064,10066,10068,10080,10081,10084,10086,10088,10089,10090,10094,10096,10098,10100,10101,10104,10106,10108,10109,10110,10114,10116,10118,10119,10140,10144,10146,10148,10149,10160,10161,10164,10166,10168,10180,10184,10186,10188,10189,10190,10191,10194,10196,10198,10199,10400,10401,10404,10406,10408,10409,10410,10411,10414,10416,10418,10419,10440,10441,10444,10446,10448,10449,10460,10461,10464,10466,10468,10469,10480,10481,10484,10486,10488,10489,10490,10491,10494,10496,10498,10600,10604,10606,10608,10609,10610,10611,10614,10616,10618,10619,10640,10641,10644,10646,10648,10649,10660,10661,10664,10666,10668,10669,10680,10681,10684,10686,10688,10689,10690,10694,10696,10698,10699,10800,10801,10804,10806,10808,10809,10810,10811,10814,10816,10818,10819,10840,10841,10844,10846,10848,10849,10860,10864,10866,10868,10869,10880,10881,10884,10886,10888,10890,10894,10896,10898,10899,10900,10901,10904,10906,10908,10910,10911,10914,10916,10918,10919,10940,10941,10944,10946,10948,10960,10961,10964,10966,10968,10969,10980,10981,10984,10986,10988,10989,10990,10991,10994,10996,10998,10999,11000,11001,11004,11006,11008,11009,11010,11011,11014,11016,11018,11019,11040,11041,11044,11046,11048,11049,11060,11061,11064,11066,11068,11080,11081,11084,11086,11088,11089,11090,11091,11094,11096,11098,11099,11100,11101,11104,11106,11108,11109,11110,11111,11114,11116,11118,11140,11141,11144,11146,11148,11160,11164,11166,11168,11169,11180,11181,11184,11186,11188,11189,11190,11191,11194,11196,11198,11199,11400,11401,11404,11406,11408,11409,11410,11414,11416,11418,11419,11440,11441,11444,11446,11448,11449,11460,11461,11464,11466,11468,11469,11480,11481,11484,11486,11488,11490,11494,11496,11498,11499,11600,11601,11604,11606,11608,11609,11610,11611,11614,11616,11618,11619,11640,11641,11644,11646,11648,11649,11660,11661,11664,11666,11668,11669,11680,11684,11686,11688,11690,11691,11694,11696,11698,11800,11804,11806,11808,11809,11810,11811,11814,11816,11818,11819,11840,11841,11844,11846,11848,11849,11860,11861,11864,11866,11868,11869,11880,11881,11884,11886,11888,11889,11890,11891,11894,11896,11898,11899,11900,11901,11904,11906,11908,11910,11911,11914,11916,11918,11919,11940,11944,11946,11948,11949,11960,11961,11964,11966,11968,11980,11984,11986,11988,11989,11990,11991,11994,11996,11998,11999,14000,14001,14004,14006,14008,14010,14014,14016,14018,14019,14040,14041,14044,14046,14048,14049,14060,14061,14064,14066,14068,14069,14080,14084,14086,14088,14089,14090,14091,14094,14096,14098,14099,14100,14101,14104,14106,14108,14109,14110,14111,14114,14116,14118,14119,14140,14141,14144,14146,14148,14160,14161,14164,14166,14168,14169,14180,14181,14184,14186,14188,14189,14190,14191,14194,14196,14198,14199,14400,14404,14406,14408,14409,14410,14414,14416,14418,14440,14441,14444,14446,14448,14460,14464,14466,14468,14469,14480,14481,14484,14486,14488,14490,14491,14494,14496,14498,14499,14600,14601,14604,14606,14608,14609,14610,14611,14614,14616,14618,14619,14640,14641,14644,14646,14648,14649,14660,14661,14664,14666,14668,14680,14681,14684,14686,14688,14689,14690,14691,14694,14696,14698,14800,14801,14804,14806,14808,14809,14810,14811,14814,14816,14818,14819,14840,14841,14844,14846,14848,14849,14860,14861,14864,14866,14868,14880,14881,14884,14886,14888,14889,14890,14894,14896,14898,14899,14900,14901,14904,14906,14908,14909,14910,14911,14914,14916,14918,14919,14940,14941,14944,14946,14948,14949,14960,14961,14964,14966,14968,14980,14981,14984,14986,14988,14989,14990,14991,14994,14996,14998,14999,16000,16004,16006,16008,16009,16010,16011,16014,16016,16018,16019,16040,16041,16044,16046,16048,16049,16060,16064,16066,16068,16080,16081,16084,16086,16088,16089,16090,16094,16096,16098,16099,16100,16101,16104,16106,16108,16109,16110,16114,16116,16118,16119,16140,16144,16146,16148,16149,16160,16161,16164,16166,16168,16169,16180,16181,16184,16186,16188,16190,16191,16194,16196,16198,16199,16400,16401,16404,16406,16408,16409,16410,16414,16416,16418,16419,16440,16441,16444,16446,16448,16449,16460,16461,16464,16466,16468,16469,16480,16484,16486,16488,16489,16490,16491,16494,16496,16498,16499,16600,16601,16604,16606,16608,16609,16610,16611,16614,16616,16618,16640,16641,16644,16646,16648,16660,16664,16666,16668,16669,16680,16681,16684,16686,16688,16689,16690,16694,16696,16698,16800,16801,16804,16806,16808,16809,16810,16814,16816,16818,16819,16840,16841,16844,16846,16848,16849,16860,16861,16864,16866,16868,16869,16880,16881,16884,16886,16888,16890,16891,16894,16896,16898,16899,16900,16904,16906,16908,16909,16910,16911,16914,16916,16918,16919,16940,16941,16944,16946,16948,16949,16960,16961,16964,16966,16968,16969,16980,16984,16986,16988,16989,16990,16991,16994,16996,16998,16999,18000,18001,18004,18006,18008,18009,18010,18011,18014,18016,18018,18019,18040,18044,18046,18048,18060,18064,18066,18068,18069,18080,18081,18084,18086,18088,18090,18091,18094,18096,18098,18099,18100,18101,18104,18106,18108,18109,18110,18111,18114,18116,18118,18140,18141,18144,18146,18148,18160,18161,18164,18166,18168,18180,18184,18186,18188,18189,18190,18194,18196,18198,18400,18404,18406,18408,18409,18410,18411,18414,18416,18418,18419,18440,18441,18444,18446,18448,18449,18460,18464,18466,18468,18469,18480,18484,18486,18488,18489,18490,18491,18494,18496,18498,18499,18600,18601,18604,18606,18608,18609,18610,18611,18614,18616,18618,18619,18640,18641,18644,18646,18648,18649,18660,18664,18666,18668,18669,18680,18681,18684,18686,18688,18689,18690,18694,18696,18698,18699,18800,18801,18804,18806,18808,18809,18810,18811,18814,18816,18818,18819,18840,18841,18844,18846,18848,18849,18860,18861,18864,18866,18868,18880,18881,18884,18886,18888,18889,18890,18891,18894,18896,18898,18900,18901,18904,18906,18908,18909,18910,18914,18916,18918,18940,18941,18944,18946,18948,18949,18960,18961,18964,18966,18968,18969,18980,18981,18984,18986,18988,18989,18990,18991,18994,18996,18998,18999,19000,19004,19006,19008,19010,19011,19014,19016,19018,19019,19040,19041,19044,19046,19048,19049,19060,19061,19064,19066,19068,19080,19084,19086,19088,19089,19090,19091,19094,19096,19098,19099,19100,19101,19104,19106,19108,19109,19110,19111,19114,19116,19118,19119,19140,19144,19146,19148,19149,19160,19161,19164,19166,19168,19169,19180,19184,19186,19188,19189,19190,19191,19194,19196,19198,19199,19400,19401,19404,19406,19408,19409,19410,19411,19414,19416,19418,19419,19440,19444,19446,19448,19449,19460,19461,19464,19466,19468,19480,19481,19484,19486,19488,19490,19491,19494,19496,19498,19499,19600,19601,19604,19606,19608,19610,19611,19614,19616,19618,19619,19640,19641,19644,19646,19648,19649,19660,19664,19666,19668,19669,19680,19684,19686,19688,19689,19690,19691,19694,19696,19698,19800,19804,19806,19808,19809,19810,19811,19814,19816,19818,19840,19844,19846,19848,19849,19860,19864,19866,19868,19869,19880,19881,19884,19886,19888,19890,19894,19896,19898,19899,19900,19901,19904,19906,19908,19909,19910,19911,19914,19916,19918,19940,19941,19944,19946,19948,19960,19964,19966,19968,19969,19980,19981,19984,19986,19988,19989,19990,19994,19996,19998,19999,40000,40001,40004,40006,40008,40010,40011,40014,40016,40018,40019,40040,40041,40044,40046,40048,40049,40060,40061,40064,40066,40068,40069,40080,40081,40084,40086,40088,40089,40090,40091,40094,40096,40098,40100,40101,40104,40106,40108,40109,40110,40114,40116,40118,40119,40140,40141,40144,40146,40148,40149,40160,40161,40164,40166,40168,40180,40181,40184,40186,40188,40190,40191,40194,40196,40198,40199,40400,40401,40404,40406,40408,40409,40410,40411,40414,40416,40418,40419,40440,40441,40444,40446,40448,40449,40460,40461,40464,40466,40468,40469,40480,40481,40484,40486,40488,40489,40490,40491,40494,40496,40498,40600,40601,40604,40606,40608,40610,40611,40614,40616,40618,40619,40640,40641,40644,40646,40648,40649,40660,40661,40664,40666,40668,40669,40680,40681,40684,40686,40688,40689,40690,40691,40694,40696,40698,40800,40804,40806,40808,40809,40810,40811,40814,40816,40818,40840,40844,40846,40848,40860,40861,40864,40866,40868,40869,40880,40881,40884,40886,40888,40889,40890,40891,40894,40896,40898,40899,40900,40901,40904,40906,40908,40909,40910,40911,40914,40916,40918,40919,40940,40941,40944,40946,40948,40960,40964,40966,40968,40969,40980,40981,40984,40986,40988,40989,40990,40991,40994,40996,40998,40999,41000,41001,41004,41006,41008,41009,41010,41014,41016,41018,41019,41040,41041,41044,41046,41048,41049,41060,41061,41064,41066,41068,41069,41080,41084,41086,41088,41089,41090,41091,41094,41096,41098,41099,41100,41101,41104,41106,41108,41109,41110,41111,41114,41116,41118,41119,41140,41144,41146,41148,41160,41164,41166,41168,41169,41180,41181,41184,41186,41188,41190,41191,41194,41196,41198,41199,41400,41401,41404,41406,41408,41409,41410,41414,41416,41418,41419,41440,41441,41444,41446,41448,41449,41460,41461,41464,41466,41468,41469,41480,41481,41484,41486,41488,41489,41490,41494,41496,41498,41499,41600,41601,41604,41606,41608,41610,41614,41616,41618,41619,41640,41644,41646,41648,41649,41660,41661,41664,41666,41668,41680,41684,41686,41688,41689,41690,41691,41694,41696,41698,41699,41800,41804,41806,41808,41810,41811,41814,41816,41818,41819,41840,41841,41844,41846,41848,41860,41861,41864,41866,41868,41869,41880,41881,41884,41886,41888,41889,41890,41891,41894,41896,41898,41899,41900,41901,41904,41906,41908,41909,41910,41914,41916,41918,41919,41940,41944,41946,41948,41949,41960,41961,41964,41966,41968,41980,41984,41986,41988,41989,41990,41991,41994,41996,41998,44000,44001,44004,44006,44008,44009,44010,44011,44014,44016,44018,44019,44040,44044,44046,44048,44049,44060,44061,44064,44066,44068,44069,44080,44081,44084,44086,44088,44090,44091,44094,44096,44098,44099,44100,44104,44106,44108,44109,44110,44114,44116,44118,44140,44141,44144,44146,44148,44149,44160,44161,44164,44166,44168,44169,44180,44181,44184,44186,44188,44190,44191,44194,44196,44198,44199,44400,44401,44404,44406,44408,44409,44410,44411,44414,44416,44418,44419,44440,44441,44444,44446,44448,44460,44461,44464,44466,44468,44469,44480,44481,44484,44486,44488,44489,44490,44494,44496,44498,44499,44600,44601,44604,44606,44608,44609,44610,44611,44614,44616,44618,44619,44640,44644,44646,44648,44649,44660,44661,44664,44666,44668,44669,44680,44681,44684,44686,44688,44689,44690,44691,44694,44696,44698,44800,44801,44804,44806,44808,44810,44811,44814,44816,44818,44840,44841,44844,44846,44848,44849,44860,44861,44864,44866,44868,44869,44880,44881,44884,44886,44888,44889,44890,44891,44894,44896,44898,44899,44900,44901,44904,44906,44908,44910,44911,44914,44916,44918,44919,44940,44941,44944,44946,44948,44949,44960,44961,44964,44966,44968,44969,44980,44981,44984,44986,44988,44989,44990,44991,44994,44996,44998,44999,46000,46001,46004,46006,46008,46009,46010,46011,46014,46016,46018,46019,46040,46041,46044,46046,46048,46060,46064,46066,46068,46069,46080,46081,46084,46086,46088,46089,46090,46094,46096,46098,46100,46101,46104,46106,46108,46109,46110,46111,46114,46116,46118,46119,46140,46144,46146,46148,46149,46160,46161,46164,46166,46168,46169,46180,46184,46186,46188,46189,46190,46191,46194,46196,46198,46400,46401,46404,46406,46408,46409,46410,46414,46416,46418,46419,46440,46444,46446,46448,46449,46460,46461,46464,46466,46468,46469,46480,46481,46484,46486,46488,46490,46491,46494,46496,46498,46600,46604,46606,46608,46609,46610,46611,46614,46616,46618,46640,46641,46644,46646,46648,46660,46661,46664,46666,46668,46669,46680,46684,46686,46688,46689,46690,46694,46696,46698,46699,46800,46801,46804,46806,46808,46809,46810,46814,46816,46818,46840,46841,46844,46846,46848,46849,46860,46864,46866,46868,46869,46880,46881,46884,46886,46888,46890,46891,46894,46896,46898,46899,46900,46904,46906,46908,46909,46910,46911,46914,46916,46918,46940,46941,46944,46946,46948,46949,46960,46961,46964,46966,46968,46969,46980,46981,46984,46986,46988,46989,46990,46991,46994,46996,46998,46999,48000,48001,48004,48006,48008,48009,48010,48011,48014,48016,48018,48019,48040,48041,48044,48046,48048,48060,48061,48064,48066,48068,48069,48080,48081,48084,48086,48088,48089,48090,48094,48096,48098,48099,48100,48101,48104,48106,48108,48110,48111,48114,48116,48118,48140,48141,48144,48146,48148,48149,48160,48161,48164,48166,48168,48169,48180,48181,48184,48186,48188,48189,48190,48191,48194,48196,48198,48199,48400,48401,48404,48406,48408,48410,48411,48414,48416,48418,48419,48440,48441,48444,48446,48448,48460,48461,48464,48466,48468,48469,48480,48484,48486,48488,48489,48490,48494,48496,48498,48499,48600,48601,48604,48606,48608,48609,48610,48614,48616,48618,48640,48641,48644,48646,48648,48660,48664,48666,48668,48669,48680,48681,48684,48686,48688,48689,48690,48691,48694,48696,48698,48699,48800,48801,48804,48806,48808,48810,48811,48814,48816,48818,48819,48840,48841,48844,48846,48848,48849,48860,48861,48864,48866,48868,48880,48881,48884,48886,48888,48890,48891,48894,48896,48898,48899,48900,48901,48904,48906,48908,48909,48910,48911,48914,48916,48918,48919,48940,48941,48944,48946,48948,48949,48960,48961,48964,48966,48968,48969,48980,48981,48984,48986,48988,48990,48994,48996,48998,48999,49000,49001,49004,49006,49008,49010,49011,49014,49016,49018,49040,49041,49044,49046,49048,49049,49060,49061,49064,49066,49068,49080,49084,49086,49088,49089,49090,49091,49094,49096,49098,49099,49100,49101,49104,49106,49108,49110,49111,49114,49116,49118,49119,49140,49141,49144,49146,49148,49149,49160,49161,49164,49166,49168,49180,49181,49184,49186,49188,49189,49190,49191,49194,49196,49198,49400,49401,49404,49406,49408,49410,49414,49416,49418,49419,49440,49441,49444,49446,49448,49449,49460,49461,49464,49466,49468,49469,49480,49484,49486,49488,49489,49490,49491,49494,49496,49498,49600,49601,49604,49606,49608,49609,49610,49611,49614,49616,49618,49619,49640,49641,49644,49646,49648,49649,49660,49661,49664,49666,49668,49680,49684,49686,49688,49689,49690,49691,49694,49696,49698,49699,49800,49804,49806,49808,49809,49810,49814,49816,49818,49819,49840,49841,49844,49846,49848,49849,49860,49861,49864,49866,49868,49869,49880,49881,49884,49886,49888,49889,49890,49894,49896,49898,49899,49900,49901,49904,49906,49908,49909,49910,49911,49914,49916,49918,49940,49941,49944,49946,49948,49949,49960,49961,49964,49966,49968,49969,49980,49981,49984,49986,49988,49989,49990,49994,49996,49998][n]

def is_prime(n):
    if n<2:
        return False
    elif n==2:
        return True
    elif n%2==0:
        return False
    x=3
    while(x*x<=n):
        if n%x==0:
            return False
        x+=2
    return True

p=[x for x in range(1,50001) if not is_prime(x) and all(d not in '2357' for d in str(x))]

def solve(n):
    return p[n]

from itertools import compress
def sieve(n): 
    n += 1
    r = [False,True] * (n//2) + [True] 
    r[1] = False
    r[2] = True 
    for i in range(3,int(n**.5)+1,2): 
        if r[i]: 
            r[i*i::2*i] = [False] * ((n+2*i-1-i*i)//(2*i))
    r = list(compress(list(range(len(r))),r))
    if r[-1] %2 == 0:
        return r[:-1]
    return r

def test(num):
    num = str(num)
    for i in num:
        if int(i) in (2,3,5,7): 
            return False
    return True 

primes = set(sieve(10**6))
res = [] 
for i in range(1,10**6): 
    if i not in primes and test(i): 
        res.append(i)

def solve(n):
    return res[n]