# Summing up Last digits

## Submit

File:
Open code-statistics:

Language is selected by the extension of the file. See the list of supported languages to know the extension of your language.

## Problem

Let F(x) is a function which returns the last digit of the first prime number with 'x' digit. The first few values of F(x) is:

F(1) = 2
F(2) = 1
F(3) = 1
F(4) = 9
F(5) = 7

The value of F(x) for 1 <= x <= 25 is {2,1,1,9,7,3,3,9,7,7,9,3,9,7,1,7,1,3,3,1,9,7,9,7,7}.

In this task you have to compute the sum up F(x)'s between two given a and b (including)

The first line of the input is an integer T(say),then T test cases follows.Check out the sample I/O for more details.
Constraints:

1 <= T <= 1000
1 <= a <= b <= 1000

Source:
Own problem originally written for Mathalon,(http://mathalon.in/?page=show_problem.php&pid=153) -Deb

exec is denied

```10
647 997
736 823
632 928
398 953
682 713
862 893
321 595
822 952
171 780
175 679```

```1741
410
1487
2816
192
152
1419
659
3098
2553
```

```26
741 824
942 943
391 744
472 715
428 686
294 703
113 694
608 817
4 609
109 455
6 309
744 801
16 82
531 975
668 721
311 478
608 946
65 961
900 915
976 977
839 882
914 919
527 586
765 960
904 952
1 1000```

```392
18
1826
1274
1335
2138
2960
1062
3102
1763
1556
298
351
2263
310
870
1715
4569
60
2
208
38
316
960
267
5059
```

```200
706 902
206 626
283 909
549 662
485 785
904 992
334 486
317 816
593 1000
338 343
798 833
793 804
229 679
230 999
646 833
560 852
114 414
152 386
302 597
788 870
104 968
357 567
830 929
793 807
676 858
563 879
367 947
70 875
51 450
908 999
452 494
840 942
620 788
88 653
20 158
345 393
242 614
263 919
666 863
584 897
275 291
881 905
589 897
944 970
625 665
251 653
915 934
307 935
31 932
564 704
323 396
854 949
217 881
619 906
497 916
902 961
929 942
525 647
693 715
658 760
90 301
990 994
569 748
945 976
17 553
232 260
754 791
306 805
464 882
543 876
363 766
717 805
669 690
157 993
9 236
42 770
657 988
736 829
258 883
72 898
274 306
141 227
618 929
839 889
35 153
208 561
701 852
324 967
611 734
336 709
853 953
430 637
556 808
272 295
500 706
156 434
307 988
171 257
516 784
726 795
522 603
950 975
128 327
416 757
792 991
616 951
905 989
559 740
134 217
547 836
287 414
777 938
407 790
101 546
466 851
299 483
59 828
198 687
688 793
442 950
522 571
654 668
664 863
273 748
860 896
491 596
516 828
225 422
444 932
283 814
989 992
419 858
616 908
413 551
319 788
852 992
942 958
453 626
451 566
450 512
824 854
883 975
776 943
672 706
750 763
326 517
144 323
168 909
815 890
458 741
457 905
845 886
929 940
356 910
266 971
810 869
368 402
392 574
352 863
104 861
104 613
995 997
142 691
4 847
190 878
774 939
275 957
833 932
6 358
307 946
18 991
670 776
324 548
927 983
127 997
56 639
65 945
93 727
302 543
948 996
422 778
836 948
761 906
876 907
688 909
904 947
141 713
735 897
22 834
504 515
760 971
23 618
444 479
849 929
617 894
21 757
936 942
213 906
858 976
418 556```

```943
2123
3185
626
1533
459
797
2546
2028
22
146
58
2283
3860
930
1481
1503
1151
1544
379
4383
1069
502
63
895
1589
2967
4074
2060
466
223
529
871
2902
745
265
1893
3317
966
1582
103
131
1541
137
229
2075
106
3167
4558
761
376
510
3343
1428
2078
314
90
639
149
523
1076
21
954
146
2717
115
182
2564
2081
1696
2088
419
112
4195
1186
3733
1648
422
3160
4187
193
427
1546
249
639
1782
726
3262
652
1944
525
1074
1307
136
1065
1385
3450
403
1395
324
436
114
966
1764
978
1702
441
962
384
1478
674
780
1966
2240
1920
975
3916
2496
544
2577
250
71
970
2480
183
550
1567
976
2449
2744
20
2218
1455
687
2402
717
99
862
554
311
141
489
824
203
66
980
878
3706
350
1448
2239
192
74
2803
3590
276
197
927
2598
3828
2584
7
2774
4290
3453
802
3505
504
1793
3256
4934
553
1111
299
4345
3000
4497
3277
1218
213
1849
595
692
160
1082
254
2919
781
4125
48
1042
3046
194
393
1382
3781
59
3488
613
695
```

## Ranking

### Perl_

RankUserSizeTimeDateStatistics
1tails2910.03392016/06/14 19:30:5974B / 144B / 70B
2teebee3070.10802014/01/19 05:39:16164B / 75B / 64B
3mitchs3130.09102016/06/14 01:24:23151B / 95B / 66B
4mitch schwartz3140.05922013/06/18 10:20:05151B / ?B / ?B

### Python_

RankUserSizeTimeDateStatistics
1hallvabo3730.23592011/05/26 14:20:40152B / 128B / 84B
2lifthrasiir3760.21382011/05/17 13:41:12160B / 128B / 81B

### J_

RankUserSizeTimeDateStatistics
1I., S.(cheat)3182.49082011/05/26 23:29:020B / 189B / 124B
2I., S.3252.34602011/05/25 07:19:560B / 182B / 139B

### C_

RankUserSizeTimeDateStatistics
1Deb Ungolfed Testing21010.00282011/04/17 00:20:590B / ?B / ?B

### gs2_

RankUserSizeTimeDateStatistics
1whio2760.20352017/08/02 06:39:51161B / 75B / 37B

### Language Ranking_

RankLangUserSizeScore
1gs2whio27610000
2Perltails2919484
3JI., S.(cheat)3188679
4Pythonhallvabo3737399
5CDeb Ungolfed Testing21011313