QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#641827#3089. Harsh CommentsohwphilTL 978ms11516kbPython31.0kb2024-10-15 00:57:322024-10-15 00:57:33

Judging History

This is the latest submission verdict.

  • [2024-10-15 00:57:33]
  • Judged
  • Verdict: TL
  • Time: 978ms
  • Memory: 11516kb
  • [2024-10-15 00:57:32]
  • Submitted

answer

import sys
input=sys.stdin.readline
MOD=119<<23|1
N,M=map(int,input().split())
*a_i,=map(int,input().split())
*b_i,=map(int,input().split())
sum_a=sum(a_i)
sum_b=sum(b_i)
inv_sum=pow(sum_a+sum_b,-1,MOD)
knapsack=[0]*10001
knapsack[0]=1
for a in a_i:
    for i in range(10000-a,-1,-1):
        if knapsack[i]:
            knapsack[i+a]=(knapsack[i+a]-knapsack[i])%MOD
final_coeffs=[0]*10001
for a in a_i:
    temp_knapsack=knapsack[:]
    for i in range(10000-a,-1,-1):
        temp_knapsack[i]=(temp_knapsack[i]+temp_knapsack[i+a])%MOD
        temp_knapsack[i+a]=(MOD-temp_knapsack[i+a])%MOD
    temp_knapsack=temp_knapsack[a:]
    for i in range(len(temp_knapsack)):
        final_coeffs[i]=(final_coeffs[i]+temp_knapsack[sum_a-a-i]*a)%MOD
ans=0
for i in range(10001):
    if final_coeffs[i]:
        ans=(ans+final_coeffs[i]*pow(sum_a-i,-1,MOD)*(N+M))%MOD
for b in b_i:
    for i in range(10001):
        if final_coeffs[i]:
            ans=(ans-final_coeffs[i]*pow(sum_a-i+b,-1,MOD))%MOD
print(ans)

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 810ms
memory: 11184kb

input:

95 100
61 6 36 49 69 67 89 27 65 22 60 21 66 80 78 31 25 15 83 20 62 20 90 6 6 30 45 2 32 30 74 31 80 11 40 80 41 17 31 61 32 21 15 14 55 71 55 13 44 10 26 98 64 4 64 96 92 61 89 39 84 30 12 79 13 30 44 81 97 11 9 68 4 17 30 76 40 58 1 84 36 26 3 30 24 14 90 6 6 38 1 9 93 5 3
1426110 1643513 365571 ...

output:

241078495

result:

ok single line: '241078495'

Test #2:

score: 0
Accepted
time: 937ms
memory: 11228kb

input:

97 92
12 48 34 55 51 75 24 97 68 38 41 62 29 22 62 81 68 54 46 40 76 29 68 18 32 68 92 48 80 69 91 30 25 7 49 36 49 24 8 85 27 27 48 86 19 88 11 57 82 42 66 6 38 25 47 36 60 46 100 98 28 4 22 95 69 45 51 13 28 13 6 61 94 18 13 64 99 76 41 71 3 45 25 97 84 62 8 25 41 15 94 61 34 68 34 85 28
6737543 9...

output:

517480317

result:

ok single line: '517480317'

Test #3:

score: 0
Accepted
time: 817ms
memory: 11200kb

input:

90 100
58 63 24 4 57 21 34 30 28 28 59 50 57 59 19 89 78 62 9 89 62 55 4 22 23 89 77 12 85 50 5 51 44 39 19 79 34 32 8 40 18 75 22 72 64 41 99 63 82 63 69 40 82 27 43 14 63 37 15 49 9 3 34 85 88 73 92 46 46 96 23 88 21 81 77 33 98 13 1 14 12 2 84 73 67 18 58 98 31 5
9393346 5675925 3595318 1426237 8...

output:

699286815

result:

ok single line: '699286815'

Test #4:

score: 0
Accepted
time: 926ms
memory: 11344kb

input:

96 93
58 44 81 20 11 81 88 90 1 6 66 43 77 10 98 63 16 61 76 88 100 46 14 36 26 14 1 52 62 94 26 69 86 8 76 35 79 13 51 44 81 29 95 89 10 65 99 83 91 52 25 70 92 36 86 89 55 14 24 61 74 32 82 85 83 69 25 28 4 18 3 58 30 57 72 69 56 75 83 8 60 43 41 22 8 7 46 99 100 70 99 54 11 6 4 8
5651855 7218847 ...

output:

83316870

result:

ok single line: '83316870'

Test #5:

score: 0
Accepted
time: 877ms
memory: 11148kb

input:

96 98
75 67 12 51 74 19 73 91 69 88 11 37 91 19 26 30 47 35 51 25 38 95 31 6 76 98 47 6 38 20 3 70 69 41 47 52 88 15 1 17 54 72 61 84 16 10 16 42 56 72 99 59 3 26 62 32 75 43 20 91 15 72 83 67 10 26 28 66 92 75 59 79 32 45 14 66 38 71 85 44 65 68 73 29 68 11 24 55 68 9 97 85 10 66 55 35
176095 85776...

output:

857493246

result:

ok single line: '857493246'

Test #6:

score: 0
Accepted
time: 822ms
memory: 11196kb

input:

90 98
15 7 56 2 86 44 15 76 40 96 50 96 4 78 18 64 78 21 46 97 66 3 48 31 93 81 92 66 48 37 62 45 41 26 67 93 33 76 73 94 97 94 61 86 57 85 22 92 12 64 12 5 61 97 53 62 25 58 2 33 37 60 58 72 7 10 21 78 96 37 65 58 66 14 97 80 83 17 59 62 23 43 18 75 30 39 23 37 23 20
8536726 445360 6549586 8871047 ...

output:

518246325

result:

ok single line: '518246325'

Test #7:

score: 0
Accepted
time: 812ms
memory: 11212kb

input:

90 96
86 30 40 86 7 11 65 84 34 54 29 56 85 73 34 35 95 45 44 84 11 86 7 13 14 25 88 44 46 61 20 59 1 81 18 93 36 14 79 81 21 3 72 24 81 72 89 84 46 62 64 14 26 43 40 94 38 16 95 23 5 60 13 92 29 90 61 7 43 52 53 55 66 83 77 100 48 52 28 35 100 72 47 93 33 2 75 4 1 55
6738276 5286038 7332547 8769210...

output:

831790358

result:

ok single line: '831790358'

Test #8:

score: 0
Accepted
time: 856ms
memory: 11216kb

input:

98 99
70 65 55 55 14 3 58 55 51 97 37 4 62 14 36 30 79 46 77 24 2 10 79 47 40 41 90 1 100 99 45 86 78 45 60 18 12 68 20 41 61 5 64 77 18 41 34 75 3 72 57 43 41 38 11 76 40 32 94 72 16 80 55 1 1 68 1 93 4 94 17 59 44 20 21 54 73 31 68 57 7 99 32 56 6 95 28 95 51 30 91 62 50 36 37 38 9 7
9592645 15178...

output:

404335437

result:

ok single line: '404335437'

Test #9:

score: 0
Accepted
time: 896ms
memory: 11360kb

input:

99 90
85 55 99 43 16 33 74 52 85 63 75 99 36 30 26 3 64 56 52 62 49 31 45 61 59 24 17 42 59 43 99 75 65 36 30 2 51 90 8 8 9 37 5 83 45 31 28 90 6 91 23 43 75 45 97 40 54 95 94 8 95 60 18 28 91 30 57 50 18 96 61 4 94 92 22 77 98 55 43 54 11 28 89 69 70 95 8 15 35 44 2 8 71 16 95 29 78 78 9
9492475 83...

output:

369387451

result:

ok single line: '369387451'

Test #10:

score: 0
Accepted
time: 844ms
memory: 11252kb

input:

91 95
6 32 87 94 72 81 100 11 84 75 16 99 19 28 8 51 49 24 76 95 90 81 39 56 24 41 90 76 38 22 50 5 47 14 28 10 8 26 53 77 58 16 60 95 67 68 37 71 88 8 2 33 2 18 59 36 90 65 29 17 55 9 25 10 61 4 62 38 63 66 43 10 59 69 45 15 72 60 35 57 35 76 52 77 65 6 20 83 87 63 88
3998713 866847 4907031 9455818...

output:

967893024

result:

ok single line: '967893024'

Test #11:

score: 0
Accepted
time: 968ms
memory: 11252kb

input:

100 96
65 34 17 96 68 24 98 28 82 1 40 89 1 11 18 94 81 69 85 12 67 41 53 67 65 53 47 32 83 48 27 59 64 20 59 33 8 72 98 2 7 97 71 5 41 66 41 49 15 24 68 9 90 45 55 41 36 46 48 71 100 98 59 19 73 63 17 93 99 98 72 34 65 54 71 52 37 96 36 20 92 34 70 68 71 16 41 75 92 45 99 37 46 85 5 25 76 48 82 25
...

output:

54155933

result:

ok single line: '54155933'

Test #12:

score: 0
Accepted
time: 901ms
memory: 11268kb

input:

91 93
86 71 92 31 73 86 76 64 88 12 41 31 34 96 11 58 40 51 69 31 50 61 96 72 65 60 78 51 75 50 68 68 35 60 5 69 47 33 74 23 66 61 94 5 50 48 24 61 69 2 70 76 55 88 42 27 93 40 85 53 50 81 80 17 15 32 81 70 2 95 99 20 90 5 46 92 23 77 83 3 35 40 40 23 62 29 89 77 22 91 60
8467997 6585759 3282041 844...

output:

185536410

result:

ok single line: '185536410'

Test #13:

score: 0
Accepted
time: 938ms
memory: 11380kb

input:

100 100
92 49 94 91 16 21 57 13 33 76 15 72 5 32 55 68 56 10 39 40 58 1 75 21 73 59 7 80 10 75 45 58 98 59 82 68 44 64 45 100 40 16 73 88 52 76 38 24 83 57 46 66 60 9 18 42 57 63 88 72 3 34 89 1 13 26 10 53 88 56 98 97 41 10 9 52 80 49 91 92 45 1 34 69 6 22 78 83 81 30 66 88 14 71 26 8 96 34 70 76
9...

output:

740279557

result:

ok single line: '740279557'

Test #14:

score: 0
Accepted
time: 845ms
memory: 11264kb

input:

94 94
15 28 64 94 82 69 52 83 69 88 35 27 44 55 56 52 58 15 17 6 1 78 91 90 61 4 54 32 26 65 39 22 22 60 21 98 12 10 58 17 6 56 22 86 75 93 8 68 99 48 92 12 9 56 5 85 32 23 61 68 18 74 58 49 94 96 28 73 31 4 79 50 4 84 61 1 38 62 44 82 13 80 62 56 6 90 68 46 50 12 14 74 88 92
6759174 1053571 4759573...

output:

595691002

result:

ok single line: '595691002'

Test #15:

score: 0
Accepted
time: 953ms
memory: 11328kb

input:

98 93
61 80 73 13 32 6 75 69 86 22 52 82 21 88 50 77 19 72 99 34 79 25 96 44 28 3 53 55 7 39 90 96 67 97 1 15 90 93 79 12 16 15 26 35 35 81 65 80 48 88 83 77 39 30 82 46 11 95 9 41 75 20 46 1 33 92 40 98 49 88 58 97 8 90 47 59 93 24 100 100 93 13 65 36 96 91 24 78 4 49 14 91 68 74 98 9 90 36
3796974...

output:

468439547

result:

ok single line: '468439547'

Test #16:

score: 0
Accepted
time: 911ms
memory: 11228kb

input:

98 98
100 83 13 6 15 17 53 88 18 69 57 3 3 24 45 79 19 74 90 91 78 100 40 63 50 27 62 41 40 67 14 31 88 11 75 22 54 91 95 94 16 97 38 50 52 5 8 34 68 22 16 75 87 51 34 24 34 1 36 37 67 67 17 25 98 39 43 97 24 12 56 76 28 31 78 29 61 43 100 49 77 4 83 77 84 78 92 48 100 94 16 83 24 92 21 29 88 38
669...

output:

293170261

result:

ok single line: '293170261'

Test #17:

score: 0
Accepted
time: 878ms
memory: 11220kb

input:

98 100
85 16 74 13 17 81 49 41 32 66 99 62 5 31 53 61 20 23 15 65 45 8 2 41 10 66 86 11 49 70 4 36 36 26 48 30 22 35 49 42 50 38 89 22 20 75 2 83 17 19 55 74 9 55 95 46 19 29 87 100 87 86 96 34 90 63 79 14 75 8 38 22 42 42 30 41 7 8 36 48 61 18 55 32 68 50 51 32 18 72 72 72 28 10 74 88 14 81
355824 ...

output:

351953473

result:

ok single line: '351953473'

Test #18:

score: 0
Accepted
time: 804ms
memory: 11256kb

input:

91 92
67 46 62 24 69 91 71 16 61 87 61 7 9 21 15 13 34 57 37 75 51 41 33 48 30 100 73 44 86 9 66 96 80 51 64 52 4 63 64 13 57 76 65 40 7 67 81 71 93 60 59 24 81 83 28 96 85 13 25 42 16 34 24 8 60 63 44 68 37 49 36 25 87 11 25 72 1 59 87 86 38 73 55 70 45 47 13 68 15 19 72
9721630 5765285 970575 9508...

output:

363920783

result:

ok single line: '363920783'

Test #19:

score: 0
Accepted
time: 972ms
memory: 11388kb

input:

100 100
47 54 15 31 48 47 11 57 39 76 76 25 87 31 100 32 95 57 10 100 61 52 44 4 53 56 48 100 90 26 15 74 40 81 15 48 91 75 89 87 21 98 8 51 38 83 65 10 33 57 42 72 81 39 87 19 46 51 7 90 77 47 30 85 81 23 76 46 80 28 73 25 73 17 93 90 100 85 63 40 94 23 13 57 25 47 63 55 11 52 40 78 29 38 78 55 12 ...

output:

335891263

result:

ok single line: '335891263'

Test #20:

score: 0
Accepted
time: 868ms
memory: 11332kb

input:

96 96
31 42 84 21 82 67 11 91 79 14 52 99 45 28 42 78 100 4 83 25 98 2 45 74 16 46 38 70 86 40 91 46 52 36 23 16 10 44 70 37 67 81 74 45 38 67 42 7 1 20 30 12 33 7 10 56 19 79 70 25 29 56 70 74 79 21 19 21 15 1 62 96 94 49 14 81 6 9 84 91 75 84 96 26 97 90 71 43 88 63 82 84 72 51 100 66
9486425 2014...

output:

211786857

result:

ok single line: '211786857'

Test #21:

score: 0
Accepted
time: 964ms
memory: 11272kb

input:

99 90
79 41 59 64 7 5 11 76 98 2 66 75 96 2 30 85 81 20 1 14 56 94 29 7 96 5 91 42 37 19 98 62 9 58 29 25 60 5 34 45 56 20 23 91 12 78 90 60 29 5 16 84 7 97 35 81 20 43 39 52 40 83 87 80 14 98 37 69 77 26 28 93 69 15 64 9 9 24 28 37 94 68 42 16 23 58 56 12 48 35 73 87 75 10 83 77 74 14 46
7838938 56...

output:

520580054

result:

ok single line: '520580054'

Test #22:

score: 0
Accepted
time: 936ms
memory: 11356kb

input:

95 94
28 21 78 39 88 84 55 25 15 90 54 26 60 68 69 8 73 34 51 55 6 65 69 82 73 87 80 12 52 9 29 31 6 58 79 8 79 61 6 11 91 85 16 13 80 65 18 96 92 5 100 5 16 14 82 28 45 13 99 91 31 29 84 47 14 88 36 93 81 92 25 2 22 63 100 84 62 77 93 98 59 56 17 25 59 89 25 18 97 34 72 66 55 74 40
9795961 9537920 ...

output:

176259918

result:

ok single line: '176259918'

Test #23:

score: 0
Accepted
time: 845ms
memory: 11252kb

input:

92 90
85 98 73 28 92 73 55 75 1 74 47 85 18 65 52 65 28 47 30 73 61 14 88 22 85 92 47 83 76 32 64 90 91 61 22 5 30 50 5 46 45 43 41 51 98 24 31 44 73 57 91 18 10 38 60 64 23 52 16 81 71 49 39 59 27 35 76 72 100 57 53 75 19 84 18 73 12 65 45 9 12 63 30 96 46 63 46 25 72 93 53 31
631810 3353531 378572...

output:

233638804

result:

ok single line: '233638804'

Test #24:

score: 0
Accepted
time: 879ms
memory: 11264kb

input:

95 93
80 56 29 58 33 33 95 98 58 37 69 72 46 83 42 69 1 49 15 2 90 2 85 27 54 32 21 41 3 64 75 6 5 91 95 25 48 100 76 80 72 7 51 46 6 52 12 49 5 58 18 65 46 55 63 28 52 58 82 65 25 38 6 78 82 44 22 32 55 8 15 41 20 38 23 78 96 30 82 89 66 53 60 46 31 84 74 77 23 59 89 40 58 7 98
8370179 4231583 2341...

output:

401168598

result:

ok single line: '401168598'

Test #25:

score: 0
Accepted
time: 912ms
memory: 11392kb

input:

96 96
59 26 8 11 50 53 69 16 47 66 95 1 90 92 1 27 58 39 48 51 95 57 18 56 36 65 79 93 28 76 38 82 73 80 70 36 51 76 57 29 58 11 45 72 71 53 94 97 49 77 71 83 84 8 56 50 55 91 85 73 85 75 43 12 48 83 86 60 57 78 85 70 51 40 29 92 30 47 67 59 53 27 58 38 23 36 97 93 8 23 22 25 77 41 87 85
9059923 399...

output:

490574780

result:

ok single line: '490574780'

Test #26:

score: 0
Accepted
time: 976ms
memory: 11516kb

input:

100 92
92 82 25 18 57 66 89 55 87 99 63 85 74 27 82 26 87 31 96 29 40 67 52 88 33 13 1 93 37 21 87 40 63 87 9 2 67 100 8 53 95 72 40 32 62 61 18 9 50 11 96 65 99 94 43 60 44 69 96 66 31 16 86 69 6 98 86 31 29 58 49 94 81 51 81 6 98 99 19 18 73 22 41 98 77 76 30 35 28 16 78 86 21 27 76 1 77 37 14 66
...

output:

56160744

result:

ok single line: '56160744'

Test #27:

score: 0
Accepted
time: 859ms
memory: 11200kb

input:

96 94
39 45 20 84 69 51 86 45 61 47 51 100 12 85 47 54 47 23 77 97 22 87 75 46 64 37 18 54 15 83 7 93 37 50 19 70 78 100 15 49 11 14 86 43 1 17 10 33 41 53 84 41 3 47 46 69 27 69 10 96 24 95 6 90 89 84 25 72 45 79 73 36 54 86 41 29 99 57 56 14 9 79 79 34 63 2 58 18 58 34 60 72 80 56 2 92
2206251 966...

output:

338800448

result:

ok single line: '338800448'

Test #28:

score: 0
Accepted
time: 898ms
memory: 11192kb

input:

96 95
32 72 15 89 79 74 97 74 72 91 5 14 17 78 4 10 53 53 18 94 92 21 78 56 34 16 86 4 70 14 34 20 85 22 88 82 65 70 27 36 91 65 57 97 78 74 70 67 23 16 60 77 42 81 82 78 36 99 79 68 79 50 63 63 59 39 34 92 16 57 65 39 12 33 66 88 84 63 8 57 15 73 2 48 13 29 32 52 85 93 83 68 50 88 1 19
1328354 1829...

output:

10071229

result:

ok single line: '10071229'

Test #29:

score: 0
Accepted
time: 967ms
memory: 11212kb

input:

95 96
69 78 52 36 77 95 100 90 65 54 9 22 28 54 21 10 97 65 91 68 30 96 67 87 95 74 37 54 97 79 47 19 68 44 98 49 14 90 94 60 88 70 98 20 60 14 23 92 35 64 32 50 43 51 81 92 61 30 8 75 54 13 77 6 11 99 42 17 13 11 85 86 91 12 90 31 50 61 91 2 25 77 55 10 75 52 55 3 88 5 22 18 47 39 62
3035265 780937...

output:

848993157

result:

ok single line: '848993157'

Test #30:

score: 0
Accepted
time: 978ms
memory: 11280kb

input:

97 100
74 46 58 68 21 91 74 60 49 17 97 66 65 65 68 12 20 60 68 75 62 65 73 43 91 34 48 35 15 54 95 15 52 96 67 59 20 38 18 74 22 65 76 35 44 17 39 95 43 8 60 42 72 86 90 7 5 11 50 89 16 26 63 29 72 31 70 86 8 74 73 82 10 95 52 63 85 39 63 31 78 48 55 82 22 43 78 65 91 51 31 87 80 10 16 6 79
8570016...

output:

967988330

result:

ok single line: '967988330'

Test #31:

score: 0
Accepted
time: 912ms
memory: 11304kb

input:

93 96
64 48 61 94 65 46 20 50 73 47 73 83 38 72 16 6 20 57 5 63 35 93 66 97 50 7 7 56 23 82 95 17 98 88 84 7 50 81 5 83 8 71 95 37 13 8 80 4 37 96 47 12 88 23 32 4 80 97 42 62 39 33 36 4 46 93 100 97 77 67 22 50 91 58 32 26 94 85 90 34 24 33 44 100 8 100 18 11 5 61 78 19 63
6855323 8734033 1669970 7...

output:

74951473

result:

ok single line: '74951473'

Test #32:

score: 0
Accepted
time: 847ms
memory: 11316kb

input:

99 97
3 29 18 98 60 27 29 55 28 86 12 45 94 42 22 24 83 35 52 57 69 45 6 18 74 51 40 19 75 54 60 98 85 23 88 7 9 28 4 64 53 26 33 50 73 92 69 11 59 38 23 4 6 6 81 51 65 3 25 79 95 54 27 29 48 38 66 89 65 16 89 43 92 100 1 42 14 39 80 5 1 86 14 88 4 98 25 70 68 16 49 19 47 61 22 48 8 47 65
613465 309...

output:

809745396

result:

ok single line: '809745396'

Test #33:

score: 0
Accepted
time: 819ms
memory: 11280kb

input:

93 97
17 50 88 57 64 81 87 36 94 61 91 16 27 23 25 98 36 57 63 59 74 36 37 24 97 57 26 17 5 16 60 12 25 4 28 82 1 9 79 89 45 3 20 71 26 62 58 76 33 21 99 4 22 35 18 22 51 37 8 33 41 59 72 26 81 28 62 44 76 29 79 48 3 83 78 42 74 16 57 29 19 32 43 7 35 28 24 15 86 69 61 75 23
1247149 2220043 9278447 ...

output:

209512512

result:

ok single line: '209512512'

Test #34:

score: 0
Accepted
time: 802ms
memory: 11324kb

input:

90 90
40 32 10 72 81 85 79 69 74 57 10 79 53 70 46 70 52 69 53 37 20 82 79 21 95 27 3 93 12 2 34 10 92 3 50 64 41 41 81 28 4 75 67 91 48 33 21 14 53 17 39 21 57 8 14 98 60 36 40 68 5 96 76 30 27 47 47 40 74 59 95 82 46 65 68 44 98 59 86 36 44 62 47 63 99 20 35 66 74 54
8022626 2992758 3162609 779168...

output:

51028873

result:

ok single line: '51028873'

Test #35:

score: 0
Accepted
time: 847ms
memory: 11356kb

input:

93 94
92 13 96 85 89 56 6 65 83 61 100 83 53 98 18 85 96 16 76 35 79 36 92 35 6 9 11 26 49 69 96 56 73 94 32 31 98 75 36 45 56 77 40 72 41 20 74 40 28 97 16 72 58 18 48 96 33 89 91 23 9 45 59 24 4 15 46 7 5 5 32 100 8 41 66 20 51 46 74 79 51 26 8 11 53 5 66 70 93 87 59 77 54
6725707 2534700 2502780 ...

output:

928829303

result:

ok single line: '928829303'

Test #36:

score: 0
Accepted
time: 855ms
memory: 11328kb

input:

91 98
70 67 49 64 51 67 90 53 45 74 26 52 54 58 65 34 27 57 49 68 51 3 7 65 48 88 84 93 56 83 97 12 66 70 68 18 59 93 57 70 81 58 68 88 79 1 43 4 14 67 48 12 10 62 81 92 91 11 46 43 22 19 22 11 71 41 39 41 67 17 38 57 19 90 36 93 39 26 92 4 29 50 23 46 45 75 10 18 69 90 47
6184649 7540144 3208942 94...

output:

478626901

result:

ok single line: '478626901'

Test #37:

score: 0
Accepted
time: 942ms
memory: 11272kb

input:

98 93
92 52 25 55 36 34 77 4 78 79 77 74 37 38 14 12 63 76 52 61 59 64 63 50 4 87 90 61 30 97 36 6 20 85 7 35 99 52 20 11 13 79 52 71 8 43 89 16 87 92 67 87 73 50 69 37 74 15 26 21 19 26 21 60 91 14 56 20 29 54 27 100 5 12 92 56 72 66 8 35 92 97 62 78 67 19 96 81 18 31 56 90 52 21 29 8 67 38
6321675...

output:

876993469

result:

ok single line: '876993469'

Test #38:

score: 0
Accepted
time: 891ms
memory: 11348kb

input:

97 98
81 99 8 46 33 1 45 62 42 52 76 67 29 31 1 40 48 90 46 34 48 68 37 85 90 78 10 42 25 24 68 49 54 60 6 80 10 96 1 55 14 47 55 40 80 59 37 74 76 91 83 47 70 18 76 19 8 60 51 42 26 79 12 92 33 75 41 84 23 68 95 89 11 70 46 21 59 18 12 67 42 80 65 23 83 35 47 29 5 88 63 95 64 46 91 2 51
3238875 447...

output:

702961902

result:

ok single line: '702961902'

Test #39:

score: 0
Accepted
time: 862ms
memory: 11148kb

input:

92 95
93 44 56 82 50 7 81 99 26 15 23 90 39 25 5 61 69 93 87 22 84 15 88 18 75 23 74 27 49 54 77 54 75 42 88 69 85 85 17 33 45 50 31 4 60 81 8 17 2 33 2 35 12 2 5 28 64 55 38 46 15 46 38 92 7 42 99 100 70 40 15 35 11 97 70 2 15 93 17 100 10 97 54 18 72 3 20 98 58 57 34 99
2480839 5280830 3365028 725...

output:

710190259

result:

ok single line: '710190259'

Test #40:

score: 0
Accepted
time: 861ms
memory: 11320kb

input:

91 97
92 100 24 7 88 79 88 36 51 81 87 5 58 80 62 31 52 67 45 36 90 8 68 56 92 24 40 59 24 77 15 75 14 52 5 44 85 96 77 88 92 15 47 88 36 93 10 27 96 25 33 30 90 66 14 24 31 59 81 17 54 46 72 3 32 56 9 6 8 8 17 4 26 68 52 33 37 70 88 49 57 98 20 4 60 83 6 52 72 62 80
7632719 1266086 3145381 3557084 ...

output:

471917684

result:

ok single line: '471917684'

Test #41:

score: 0
Accepted
time: 864ms
memory: 11232kb

input:

90 100
98 21 63 100 79 40 19 32 76 2 42 2 21 73 5 66 100 100 67 87 7 69 27 89 67 24 1 93 81 86 63 35 71 34 1 35 75 39 20 77 54 88 100 30 29 27 23 35 91 46 81 12 49 7 33 12 73 92 36 79 7 86 82 18 74 17 36 72 31 71 37 87 87 83 96 23 39 70 68 35 18 53 79 57 60 91 16 46 55 16
4539077 6777033 7346060 761...

output:

972094492

result:

ok single line: '972094492'

Test #42:

score: -100
Time Limit Exceeded

input:

99 96
55 56 46 31 41 52 16 34 36 17 88 41 21 37 22 17 11 78 53 31 39 19 88 6 62 24 12 74 86 81 48 62 100 94 85 60 72 74 69 56 5 60 43 47 79 68 1 19 6 23 23 54 15 69 18 69 97 9 49 62 16 17 39 41 26 78 81 36 47 99 58 97 89 80 73 46 87 77 6 15 40 83 19 25 46 43 95 99 66 30 15 88 73 4 79 17 12 73 3
9499...

output:

904866465

result: