记录编号 |
266010 |
评测结果 |
AAAAAAAAA |
题目名称 |
[USACO 1.5] 回文质数 |
最终得分 |
100 |
用户昵称 |
ConanQZ |
是否通过 |
通过 |
代码语言 |
Pascal |
运行时间 |
0.001 s |
提交时间 |
2016-06-05 10:24:00 |
内存使用 |
0.17 MiB |
显示代码纯文本
program P1118;
var
l,r,i,a,b:longint;
w:array[1..781]of longint{=(2,3,5,7,11,101,131,151,181,191,313,353,373,383,727,757,787,797,919,929,10301,10501,10601,11311,11411,12421,12721,12821,13331,13831,13931,14341,14741,15451,15551,16061,16361,16561,16661,17471,17971,18181,18481,19391,
19891,19991,30103,30203,30403,30703,30803,31013,31513,32323,32423,33533,34543,34843,35053,35153,35353,35753,36263,36563,37273,37573,38083,38183,38783,39293,70207,70507,70607,71317,71917,
72227,72727,73037,73237,73637,74047,74747,75557,76367,76667,77377,77477,77977,78487,78787,78887,79397,79697,79997,90709,91019,93139,93239,93739,94049,94349,94649,94849,94949,95959,96269,96469,
96769,97379,97579,97879,98389,98689,1003001,1008001,1022201,1028201,1035301,1043401,1055501,1062601,1065601,1074701,1082801,1085801,1092901,1093901,1114111,1117111,1120211,1123211,
1126211,1129211,1134311,1145411,1150511,1153511,1160611,1163611,1175711,1177711,1178711,1180811,1183811,1186811,1190911,1193911,1196911,1201021,1208021,1212121,1215121,1218121,1221221,
1235321,1242421,1243421,1245421,1250521,1253521,1257521,1262621,1268621,1273721,1276721,1278721,1280821,1281821,1286821,1287821,1300031,1303031,1311131,1317131,1327231,1328231,1333331,
1335331,1338331,1343431,1360631,1362631,1363631,1371731,1374731,1390931,1407041,1409041,1411141,1412141,1422241,1437341,1444441,1447441,1452541,1456541,1461641,1463641,1464641,
1469641,1486841,1489841,1490941,1496941,1508051,1513151,1520251,1532351,1535351,1542451,1548451,1550551,1551551,1556551,1557551,1565651,1572751,1579751,1580851,1583851,1589851,1594951,
1597951,1598951,1600061,1609061,1611161,1616161,1628261,1630361,1633361,1640461,1643461,1646461,1654561,1657561,1658561,1660661,1670761,1684861,1685861,1688861,1695961,1703071,1707071,
1712171,1714171,1730371,1734371,1737371,1748471,1755571,1761671,1764671,1777771,1793971,1802081,1805081,1820281,1823281,1824281,1826281,1829281,1831381,1832381,1842481,1851581,1853581,
1856581,1865681,1876781,1878781,1879781,1880881,1881881,1883881,1884881,1895981,1903091,1908091,1909091,1917191,1924291,1930391,1936391,1941491,1951591,1952591,1957591,1958591,1963691,1968691,
1969691,1970791,1976791,1981891,1982891,1984891,1987891,1988891,1993991,1995991,1998991,3001003,3002003,3007003,3016103,3026203,3064603,3065603,3072703,3073703,3075703,3083803,3089803,
3091903,3095903,3103013,3106013,3127213,3135313,3140413,3155513,3158513,3160613,3166613,3181813,3187813,3193913,3196913,3198913,3211123,3212123,3218123,3222223,3223223,3228223,3233323,
3236323,3241423,3245423,3252523,3256523,3258523,3260623,3267623,3272723,3283823,3285823,3286823,3288823,3291923,3293923,3304033,3305033,3307033,3310133,3315133,3319133,3321233,3329233,
3331333,3337333,3343433,3353533,3362633,3364633,3365633,3368633,3380833,3391933,3392933,3400043,3411143,3417143,3424243,3425243,3427243,3439343,3441443,3443443,3444443,3447443,3449443,3452543,
3460643,3466643,3470743,3479743,3485843,3487843,3503053,3515153,3517153,3528253,3541453,3553553,3558553,3563653,3569653,3586853,3589853,3590953,3591953,3594953,3601063,3607063,3618163,
3621263,3627263,3635363,3643463,3646463,3670763,3673763,3680863,3689863,3698963,3708073,3709073,3716173,3717173,3721273,3722273,3728273,3732373,3743473,3746473,3762673,3763673,3765673,3768673,
3769673,3773773,3774773,3781873,3784873,3792973,3793973,3799973,3804083,3806083,3812183,3814183,3826283,3829283,3836383,3842483,3853583,3858583,3863683,3864683,3867683,3869683,3871783,
3878783,3893983,3899983,3913193,3916193,3918193,3924293,3927293,3931393,3938393,3942493,3946493,3948493,3964693,3970793,3983893,3991993,3994993,3997993,3998993,7014107,7035307,7036307,
7041407,7046407,7057507,7065607,7069607,7073707,7079707,7082807,7084807,7087807,7093907,7096907,7100017,7114117,7115117,7118117,7129217,7134317,7136317,7141417,7145417,7155517,7156517,7158517,
7159517,7177717,7190917,7194917,7215127,7226227,7246427,7249427,7250527,7256527,7257527,7261627,7267627,7276727,7278727,7291927,7300037,7302037,7310137,7314137,7324237,7327237,7347437,
7352537,7354537,7362637,7365637,7381837,7388837,7392937,7401047,7403047,7409047,7415147,7434347,7436347,7439347,7452547,7461647,7466647,7472747,7475747,7485847,7486847,7489847,7493947,
7507057,7508057,7518157,7519157,7521257,7527257,7540457,7562657,7564657,7576757,7586857,7592957,7594957,7600067,7611167,7619167,7622267,7630367,7632367,7644467,7654567,7662667,7665667,7666667,
7668667,7669667,7674767,7681867,7690967,7693967,7696967,7715177,7718177,7722277,7729277,7733377,7742477,7747477,7750577,7758577,7764677,7772777,7774777,7778777,7782877,7783877,7791977,
7794977,7807087,7819187,7820287,7821287,7831387,7832387,7838387,7843487,7850587,7856587,7865687,7867687,7868687,7873787,7884887,7891987,7897987,7913197,7916197,7930397,7933397,7935397,
7938397,7941497,7943497,7949497,7957597,7958597,7960697,7977797,7984897,7985897,7987897,7996997,9002009,9015109,9024209,9037309,9042409,9043409,9045409,9046409,9049409,9067609,9073709,
9076709,9078709,9091909,9095909,9103019,9109019,9110119,9127219,9128219,9136319,9149419,9169619,9173719,9174719,9179719,9185819,9196919,9199919,9200029,9209029,9212129,9217129,9222229,
9223229,9230329,9231329,9255529,9269629,9271729,9277729,9280829,9286829,9289829,9318139,9320239,9324239,9329239,9332339,9338339,9351539,9357539,9375739,9384839,9397939,9400049,9414149,
9419149,9433349,9439349,9440449,9446449,9451549,9470749,9477749,9492949,9493949,9495949,9504059,9514159,9526259,9529259,9547459,9556559,9558559,9561659,9577759,9583859,9585859,9586859,
9601069,9602069,9604069,9610169,9620269,9624269,9626269,9632369,9634369,9645469,9650569,9657569,9670769,9686869,9700079,9709079,9711179,9714179,9724279,9727279,9732379,9733379,9743479,
9749479,9752579,9754579,9758579,9762679,9770779,9776779,9779779,9781879,9782879,9787879,9788879,9795979,9801089,9807089,9809089,9817189,9818189,9820289,9822289,9836389,9837389,9845489,
9852589,9871789,9888889,9889889,9896989,9902099,9907099,9908099,9916199,9918199,9919199,9921299,9923299,9926299,9927299,9931399,9932399,9935399,9938399,9957599,9965699,9978799,
9980899,9981899,9989899)};
function check(x:longint):boolean;
var
i,l,t:longint;
d:array[1..15]of integer;
begin
i:=2;
while i*i<=x do
begin
if x mod i=0 then exit(false);
inc(i);
end;
t:=0;
while x<>0 do
begin
inc(t);
d[t]:=x mod 10;
x:=x div 10;
end;
l:=1;
while l<t do
if d[l]<>d[t] then exit(false) else
begin
inc(l); dec(t);
end;
exit(true);
end;
begin
assign(input,'pprime.in'); reset(input);
assign(output,'pprime.out'); rewrite(output);
{for i:=2 to 100000000 do
begin
if check(i) then write(i,',');
end; }
{readln(a,b);
l:=1;
while w[l]<a do inc(l);
r:=781;
while w[r]>b do dec(r);
for i:=l to r do
writeln(w[i]);
}
w[1]:=2;
w[2]:=3;
w[3]:=5;
w[4]:=7;
w[5]:=11;
w[6]:=101;
w[7]:=131;
w[8]:=151;
w[9]:=181;
w[10]:=191;
w[11]:=313;
w[12]:=353;
w[13]:=373;
w[14]:=383;
w[15]:=727;
w[16]:=757;
w[17]:=787;
w[18]:=797;
w[19]:=919;
w[20]:=929;
w[21]:=10301;
w[22]:=10501;
w[23]:=10601;
w[24]:=11311;
w[25]:=11411;
w[26]:=12421;
w[27]:=12721;
w[28]:=12821;
w[29]:=13331;
w[30]:=13831;
w[31]:=13931;
w[32]:=14341;
w[33]:=14741;
w[34]:=15451;
w[35]:=15551;
w[36]:=16061;
w[37]:=16361;
w[38]:=16561;
w[39]:=16661;
w[40]:=17471;
w[41]:=17971;
w[42]:=18181;
w[43]:=18481;
w[44]:=19391;
w[45]:=19891;
w[46]:=19991;
w[47]:=30103;
w[48]:=30203;
w[49]:=30403;
w[50]:=30703;
w[51]:=30803;
w[52]:=31013;
w[53]:=31513;
w[54]:=32323;
w[55]:=32423;
w[56]:=33533;
w[57]:=34543;
w[58]:=34843;
w[59]:=35053;
w[60]:=35153;
w[61]:=35353;
w[62]:=35753;
w[63]:=36263;
w[64]:=36563;
w[65]:=37273;
w[66]:=37573;
w[67]:=38083;
w[68]:=38183;
w[69]:=38783;
w[70]:=39293;
w[71]:=70207;
w[72]:=70507;
w[73]:=70607;
w[74]:=71317;
w[75]:=71917;
w[76]:=72227;
w[77]:=72727;
w[78]:=73037;
w[79]:=73237;
w[80]:=73637;
w[81]:=74047;
w[82]:=74747;
w[83]:=75557;
w[84]:=76367;
w[85]:=76667;
w[86]:=77377;
w[87]:=77477;
w[88]:=77977;
w[89]:=78487;
w[90]:=78787;
w[91]:=78887;
w[92]:=79397;
w[93]:=79697;
w[94]:=79997;
w[95]:=90709;
w[96]:=91019;
w[97]:=93139;
w[98]:=93239;
w[99]:=93739;
w[100]:=94049;
w[101]:=94349;
w[102]:=94649;
w[103]:=94849;
w[104]:=94949;
w[105]:=95959;
w[106]:=96269;
w[107]:=96469;
w[108]:=96769;
w[109]:=97379;
w[110]:=97579;
w[111]:=97879;
w[112]:=98389;
w[113]:=98689;
w[114]:=1003001;
w[115]:=1008001;
w[116]:=1022201;
w[117]:=1028201;
w[118]:=1035301;
w[119]:=1043401;
w[120]:=1055501;
w[121]:=1062601;
w[122]:=1065601;
w[123]:=1074701;
w[124]:=1082801;
w[125]:=1085801;
w[126]:=1092901;
w[127]:=1093901;
w[128]:=1114111;
w[129]:=1117111;
w[130]:=1120211;
w[131]:=1123211;
w[132]:=1126211;
w[133]:=1129211;
w[134]:=1134311;
w[135]:=1145411;
w[136]:=1150511;
w[137]:=1153511;
w[138]:=1160611;
w[139]:=1163611;
w[140]:=1175711;
w[141]:=1177711;
w[142]:=1178711;
w[143]:=1180811;
w[144]:=1183811;
w[145]:=1186811;
w[146]:=1190911;
w[147]:=1193911;
w[148]:=1196911;
w[149]:=1201021;
w[150]:=1208021;
w[151]:=1212121;
w[152]:=1215121;
w[153]:=1218121;
w[154]:=1221221;
w[155]:=1235321;
w[156]:=1242421;
w[157]:=1243421;
w[158]:=1245421;
w[159]:=1250521;
w[160]:=1253521;
w[161]:=1257521;
w[162]:=1262621;
w[163]:=1268621;
w[164]:=1273721;
w[165]:=1276721;
w[166]:=1278721;
w[167]:=1280821;
w[168]:=1281821;
w[169]:=1286821;
w[170]:=1287821;
w[171]:=1300031;
w[172]:=1303031;
w[173]:=1311131;
w[174]:=1317131;
w[175]:=1327231;
w[176]:=1328231;
w[177]:=1333331;
w[178]:=1335331;
w[179]:=1338331;
w[180]:=1343431;
w[181]:=1360631;
w[182]:=1362631;
w[183]:=1363631;
w[184]:=1371731;
w[185]:=1374731;
w[186]:=1390931;
w[187]:=1407041;
w[188]:=1409041;
w[189]:=1411141;
w[190]:=1412141;
w[191]:=1422241;
w[192]:=1437341;
w[193]:=1444441;
w[194]:=1447441;
w[195]:=1452541;
w[196]:=1456541;
w[197]:=1461641;
w[198]:=1463641;
w[199]:=1464641;
w[200]:=1469641;
w[201]:=1486841;
w[202]:=1489841;
w[203]:=1490941;
w[204]:=1496941;
w[205]:=1508051;
w[206]:=1513151;
w[207]:=1520251;
w[208]:=1532351;
w[209]:=1535351;
w[210]:=1542451;
w[211]:=1548451;
w[212]:=1550551;
w[213]:=1551551;
w[214]:=1556551;
w[215]:=1557551;
w[216]:=1565651;
w[217]:=1572751;
w[218]:=1579751;
w[219]:=1580851;
w[220]:=1583851;
w[221]:=1589851;
w[222]:=1594951;
w[223]:=1597951;
w[224]:=1598951;
w[225]:=1600061;
w[226]:=1609061;
w[227]:=1611161;
w[228]:=1616161;
w[229]:=1628261;
w[230]:=1630361;
w[231]:=1633361;
w[232]:=1640461;
w[233]:=1643461;
w[234]:=1646461;
w[235]:=1654561;
w[236]:=1657561;
w[237]:=1658561;
w[238]:=1660661;
w[239]:=1670761;
w[240]:=1684861;
w[241]:=1685861;
w[242]:=1688861;
w[243]:=1695961;
w[244]:=1703071;
w[245]:=1707071;
w[246]:=1712171;
w[247]:=1714171;
w[248]:=1730371;
w[249]:=1734371;
w[250]:=1737371;
w[251]:=1748471;
w[252]:=1755571;
w[253]:=1761671;
w[254]:=1764671;
w[255]:=1777771;
w[256]:=1793971;
w[257]:=1802081;
w[258]:=1805081;
w[259]:=1820281;
w[260]:=1823281;
w[261]:=1824281;
w[262]:=1826281;
w[263]:=1829281;
w[264]:=1831381;
w[265]:=1832381;
w[266]:=1842481;
w[267]:=1851581;
w[268]:=1853581;
w[269]:=1856581;
w[270]:=1865681;
w[271]:=1876781;
w[272]:=1878781;
w[273]:=1879781;
w[274]:=1880881;
w[275]:=1881881;
w[276]:=1883881;
w[277]:=1884881;
w[278]:=1895981;
w[279]:=1903091;
w[280]:=1908091;
w[281]:=1909091;
w[282]:=1917191;
w[283]:=1924291;
w[284]:=1930391;
w[285]:=1936391;
w[286]:=1941491;
w[287]:=1951591;
w[288]:=1952591;
w[289]:=1957591;
w[290]:=1958591;
w[291]:=1963691;
w[292]:=1968691;
w[293]:=1969691;
w[294]:=1970791;
w[295]:=1976791;
w[296]:=1981891;
w[297]:=1982891;
w[298]:=1984891;
w[299]:=1987891;
w[300]:=1988891;
w[301]:=1993991;
w[302]:=1995991;
w[303]:=1998991;
w[304]:=3001003;
w[305]:=3002003;
w[306]:=3007003;
w[307]:=3016103;
w[308]:=3026203;
w[309]:=3064603;
w[310]:=3065603;
w[311]:=3072703;
w[312]:=3073703;
w[313]:=3075703;
w[314]:=3083803;
w[315]:=3089803;
w[316]:=3091903;
w[317]:=3095903;
w[318]:=3103013;
w[319]:=3106013;
w[320]:=3127213;
w[321]:=3135313;
w[322]:=3140413;
w[323]:=3155513;
w[324]:=3158513;
w[325]:=3160613;
w[326]:=3166613;
w[327]:=3181813;
w[328]:=3187813;
w[329]:=3193913;
w[330]:=3196913;
w[331]:=3198913;
w[332]:=3211123;
w[333]:=3212123;
w[334]:=3218123;
w[335]:=3222223;
w[336]:=3223223;
w[337]:=3228223;
w[338]:=3233323;
w[339]:=3236323;
w[340]:=3241423;
w[341]:=3245423;
w[342]:=3252523;
w[343]:=3256523;
w[344]:=3258523;
w[345]:=3260623;
w[346]:=3267623;
w[347]:=3272723;
w[348]:=3283823;
w[349]:=3285823;
w[350]:=3286823;
w[351]:=3288823;
w[352]:=3291923;
w[353]:=3293923;
w[354]:=3304033;
w[355]:=3305033;
w[356]:=3307033;
w[357]:=3310133;
w[358]:=3315133;
w[359]:=3319133;
w[360]:=3321233;
w[361]:=3329233;
w[362]:=3331333;
w[363]:=3337333;
w[364]:=3343433;
w[365]:=3353533;
w[366]:=3362633;
w[367]:=3364633;
w[368]:=3365633;
w[369]:=3368633;
w[370]:=3380833;
w[371]:=3391933;
w[372]:=3392933;
w[373]:=3400043;
w[374]:=3411143;
w[375]:=3417143;
w[376]:=3424243;
w[377]:=3425243;
w[378]:=3427243;
w[379]:=3439343;
w[380]:=3441443;
w[381]:=3443443;
w[382]:=3444443;
w[383]:=3447443;
w[384]:=3449443;
w[385]:=3452543;
w[386]:=3460643;
w[387]:=3466643;
w[388]:=3470743;
w[389]:=3479743;
w[390]:=3485843;
w[391]:=3487843;
w[392]:=3503053;
w[393]:=3515153;
w[394]:=3517153;
w[395]:=3528253;
w[396]:=3541453;
w[397]:=3553553;
w[398]:=3558553;
w[399]:=3563653;
w[400]:=3569653;
w[401]:=3586853;
w[402]:=3589853;
w[403]:=3590953;
w[404]:=3591953;
w[405]:=3594953;
w[406]:=3601063;
w[407]:=3607063;
w[408]:=3618163;
w[409]:=3621263;
w[410]:=3627263;
w[411]:=3635363;
w[412]:=3643463;
w[413]:=3646463;
w[414]:=3670763;
w[415]:=3673763;
w[416]:=3680863;
w[417]:=3689863;
w[418]:=3698963;
w[419]:=3708073;
w[420]:=3709073;
w[421]:=3716173;
w[422]:=3717173;
w[423]:=3721273;
w[424]:=3722273;
w[425]:=3728273;
w[426]:=3732373;
w[427]:=3743473;
w[428]:=3746473;
w[429]:=3762673;
w[430]:=3763673;
w[431]:=3765673;
w[432]:=3768673;
w[433]:=3769673;
w[434]:=3773773;
w[435]:=3774773;
w[436]:=3781873;
w[437]:=3784873;
w[438]:=3792973;
w[439]:=3793973;
w[440]:=3799973;
w[441]:=3804083;
w[442]:=3806083;
w[443]:=3812183;
w[444]:=3814183;
w[445]:=3826283;
w[446]:=3829283;
w[447]:=3836383;
w[448]:=3842483;
w[449]:=3853583;
w[450]:=3858583;
w[451]:=3863683;
w[452]:=3864683;
w[453]:=3867683;
w[454]:=3869683;
w[455]:=3871783;
w[456]:=3878783;
w[457]:=3893983;
w[458]:=3899983;
w[459]:=3913193;
w[460]:=3916193;
w[461]:=3918193;
w[462]:=3924293;
w[463]:=3927293;
w[464]:=3931393;
w[465]:=3938393;
w[466]:=3942493;
w[467]:=3946493;
w[468]:=3948493;
w[469]:=3964693;
w[470]:=3970793;
w[471]:=3983893;
w[472]:=3991993;
w[473]:=3994993;
w[474]:=3997993;
w[475]:=3998993;
w[476]:=7014107;
w[477]:=7035307;
w[478]:=7036307;
w[479]:=7041407;
w[480]:=7046407;
w[481]:=7057507;
w[482]:=7065607;
w[483]:=7069607;
w[484]:=7073707;
w[485]:=7079707;
w[486]:=7082807;
w[487]:=7084807;
w[488]:=7087807;
w[489]:=7093907;
w[490]:=7096907;
w[491]:=7100017;
w[492]:=7114117;
w[493]:=7115117;
w[494]:=7118117;
w[495]:=7129217;
w[496]:=7134317;
w[497]:=7136317;
w[498]:=7141417;
w[499]:=7145417;
w[500]:=7155517;
w[501]:=7156517;
w[502]:=7158517;
w[503]:=7159517;
w[504]:=7177717;
w[505]:=7190917;
w[506]:=7194917;
w[507]:=7215127;
w[508]:=7226227;
w[509]:=7246427;
w[510]:=7249427;
w[511]:=7250527;
w[512]:=7256527;
w[513]:=7257527;
w[514]:=7261627;
w[515]:=7267627;
w[516]:=7276727;
w[517]:=7278727;
w[518]:=7291927;
w[519]:=7300037;
w[520]:=7302037;
w[521]:=7310137;
w[522]:=7314137;
w[523]:=7324237;
w[524]:=7327237;
w[525]:=7347437;
w[526]:=7352537;
w[527]:=7354537;
w[528]:=7362637;
w[529]:=7365637;
w[530]:=7381837;
w[531]:=7388837;
w[532]:=7392937;
w[533]:=7401047;
w[534]:=7403047;
w[535]:=7409047;
w[536]:=7415147;
w[537]:=7434347;
w[538]:=7436347;
w[539]:=7439347;
w[540]:=7452547;
w[541]:=7461647;
w[542]:=7466647;
w[543]:=7472747;
w[544]:=7475747;
w[545]:=7485847;
w[546]:=7486847;
w[547]:=7489847;
w[548]:=7493947;
w[549]:=7507057;
w[550]:=7508057;
w[551]:=7518157;
w[552]:=7519157;
w[553]:=7521257;
w[554]:=7527257;
w[555]:=7540457;
w[556]:=7562657;
w[557]:=7564657;
w[558]:=7576757;
w[559]:=7586857;
w[560]:=7592957;
w[561]:=7594957;
w[562]:=7600067;
w[563]:=7611167;
w[564]:=7619167;
w[565]:=7622267;
w[566]:=7630367;
w[567]:=7632367;
w[568]:=7644467;
w[569]:=7654567;
w[570]:=7662667;
w[571]:=7665667;
w[572]:=7666667;
w[573]:=7668667;
w[574]:=7669667;
w[575]:=7674767;
w[576]:=7681867;
w[577]:=7690967;
w[578]:=7693967;
w[579]:=7696967;
w[580]:=7715177;
w[581]:=7718177;
w[582]:=7722277;
w[583]:=7729277;
w[584]:=7733377;
w[585]:=7742477;
w[586]:=7747477;
w[587]:=7750577;
w[588]:=7758577;
w[589]:=7764677;
w[590]:=7772777;
w[591]:=7774777;
w[592]:=7778777;
w[593]:=7782877;
w[594]:=7783877;
w[595]:=7791977;
w[596]:=7794977;
w[597]:=7807087;
w[598]:=7819187;
w[599]:=7820287;
w[600]:=7821287;
w[601]:=7831387;
w[602]:=7832387;
w[603]:=7838387;
w[604]:=7843487;
w[605]:=7850587;
w[606]:=7856587;
w[607]:=7865687;
w[608]:=7867687;
w[609]:=7868687;
w[610]:=7873787;
w[611]:=7884887;
w[612]:=7891987;
w[613]:=7897987;
w[614]:=7913197;
w[615]:=7916197;
w[616]:=7930397;
w[617]:=7933397;
w[618]:=7935397;
w[619]:=7938397;
w[620]:=7941497;
w[621]:=7943497;
w[622]:=7949497;
w[623]:=7957597;
w[624]:=7958597;
w[625]:=7960697;
w[626]:=7977797;
w[627]:=7984897;
w[628]:=7985897;
w[629]:=7987897;
w[630]:=7996997;
w[631]:=9002009;
w[632]:=9015109;
w[633]:=9024209;
w[634]:=9037309;
w[635]:=9042409;
w[636]:=9043409;
w[637]:=9045409;
w[638]:=9046409;
w[639]:=9049409;
w[640]:=9067609;
w[641]:=9073709;
w[642]:=9076709;
w[643]:=9078709;
w[644]:=9091909;
w[645]:=9095909;
w[646]:=9103019;
w[647]:=9109019;
w[648]:=9110119;
w[649]:=9127219;
w[650]:=9128219;
w[651]:=9136319;
w[652]:=9149419;
w[653]:=9169619;
w[654]:=9173719;
w[655]:=9174719;
w[656]:=9179719;
w[657]:=9185819;
w[658]:=9196919;
w[659]:=9199919;
w[660]:=9200029;
w[661]:=9209029;
w[662]:=9212129;
w[663]:=9217129;
w[664]:=9222229;
w[665]:=9223229;
w[666]:=9230329;
w[667]:=9231329;
w[668]:=9255529;
w[669]:=9269629;
w[670]:=9271729;
w[671]:=9277729;
w[672]:=9280829;
w[673]:=9286829;
w[674]:=9289829;
w[675]:=9318139;
w[676]:=9320239;
w[677]:=9324239;
w[678]:=9329239;
w[679]:=9332339;
w[680]:=9338339;
w[681]:=9351539;
w[682]:=9357539;
w[683]:=9375739;
w[684]:=9384839;
w[685]:=9397939;
w[686]:=9400049;
w[687]:=9414149;
w[688]:=9419149;
w[689]:=9433349;
w[690]:=9439349;
w[691]:=9440449;
w[692]:=9446449;
w[693]:=9451549;
w[694]:=9470749;
w[695]:=9477749;
w[696]:=9492949;
w[697]:=9493949;
w[698]:=9495949;
w[699]:=9504059;
w[700]:=9514159;
w[701]:=9526259;
w[702]:=9529259;
w[703]:=9547459;
w[704]:=9556559;
w[705]:=9558559;
w[706]:=9561659;
w[707]:=9577759;
w[708]:=9583859;
w[709]:=9585859;
w[710]:=9586859;
w[711]:=9601069;
w[712]:=9602069;
w[713]:=9604069;
w[714]:=9610169;
w[715]:=9620269;
w[716]:=9624269;
w[717]:=9626269;
w[718]:=9632369;
w[719]:=9634369;
w[720]:=9645469;
w[721]:=9650569;
w[722]:=9657569;
w[723]:=9670769;
w[724]:=9686869;
w[725]:=9700079;
w[726]:=9709079;
w[727]:=9711179;
w[728]:=9714179;
w[729]:=9724279;
w[730]:=9727279;
w[731]:=9732379;
w[732]:=9733379;
w[733]:=9743479;
w[734]:=9749479;
w[735]:=9752579;
w[736]:=9754579;
w[737]:=9758579;
w[738]:=9762679;
w[739]:=9770779;
w[740]:=9776779;
w[741]:=9779779;
w[742]:=9781879;
w[743]:=9782879;
w[744]:=9787879;
w[745]:=9788879;
w[746]:=9795979;
w[747]:=9801089;
w[748]:=9807089;
w[749]:=9809089;
w[750]:=9817189;
w[751]:=9818189;
w[752]:=9820289;
w[753]:=9822289;
w[754]:=9836389;
w[755]:=9837389;
w[756]:=9845489;
w[757]:=9852589;
w[758]:=9871789;
w[759]:=9888889;
w[760]:=9889889;
w[761]:=9896989;
w[762]:=9902099;
w[763]:=9907099;
w[764]:=9908099;
w[765]:=9916199;
w[766]:=9918199;
w[767]:=9919199;
w[768]:=9921299;
w[769]:=9923299;
w[770]:=9926299;
w[771]:=9927299;
w[772]:=9931399;
w[773]:=9932399;
w[774]:=9935399;
w[775]:=9938399;
w[776]:=9957599;
w[777]:=9965699;
w[778]:=9978799;
w[779]:=9980899;
w[780]:=9981899;
w[781]:=9989899;
readln(a,b);
l:=1;
while w[l]<a do inc(l);
r:=781;
while w[r]>b do dec(r);
for i:=l to r do
writeln(w[i])
end.