QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#464635#8860. Pirate Chestucup-team1005#AC ✓9882ms5716kbC++201.9kb2024-07-06 13:16:532024-07-06 13:16:54

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3768kb

input:

3 1 2 3
2 1 1
2 2 1

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

4 1 1 5
2 0 2 2 2

output:

12

result:

ok single line: '12'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

2 3 3 5
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2

output:

18

result:

ok single line: '18'

Test #4:

score: 0
Accepted
time: 9882ms
memory: 5608kb

input:

499 499 500 500
649850711 869750238 627745405 930778599 956785748 598310756 998020082 659182553 889106939 905912562 606533068 765367617 509331841 519356700 778167157 675754469 808581870 911021086 521336619 618984603 786647531 902669308 804488018 755969003 609652761 767290830 624502151 628733548 9473...

output:

31156455008500822

result:

ok single line: '31156455008500822'

Test #5:

score: 0
Accepted
time: 4221ms
memory: 5528kb

input:

499 499 500 500
999999999 1000000000 999999999 1000000000 1000000000 999999999 1000000000 999999999 1000000000 1000000000 999999999 1000000000 999999999 999999999 1000000000 999999999 1000000000 1000000000 999999999 999999999 1000000000 1000000000 1000000000 1000000000 999999999 1000000000 999999999...

output:

62312562500000999

result:

ok single line: '62312562500000999'

Test #6:

score: 0
Accepted
time: 3000ms
memory: 5612kb

input:

499 499 500 500
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...

output:

62312562562500250

result:

ok single line: '62312562562500250'

Test #7:

score: 0
Accepted
time: 3077ms
memory: 5604kb

input:

499 499 500 500
1000000000 999999999 999999998 999999997 999999996 999999995 999999994 999999993 999999992 999999991 999999990 999999989 999999988 999999987 999999986 999999985 999999984 999999983 999999982 999999981 999999980 999999979 999999978 999999977 999999976 999999975 999999974 999999973 999...

output:

62297015702750313

result:

ok single line: '62297015702750313'

Test #8:

score: 0
Accepted
time: 0ms
memory: 3836kb

input:

1 1 2 2
0 0
0 0

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

1 1 2 2
0 1000000000
0 0

output:

1333333333

result:

ok single line: '1333333333'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

1 1 2 2
1 1
1 1

output:

1

result:

ok single line: '1'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

1 1 2 2
2 2
4 2

output:

5

result:

ok single line: '5'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

1 1 2 2
4 4
4 2

output:

5

result:

ok single line: '5'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

1 1 2 2
1 2
3 4

output:

5

result:

ok single line: '5'

Test #14:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

3 2 3 4
1 1 1 1
1 0 1 1
1 1 1 1

output:

6

result:

ok single line: '6'

Test #15:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

3 2 4 3
1 1 1
1 0 1
1 1 1
1 1 1

output:

6

result:

ok single line: '6'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

3 3 4 4
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4

output:

36

result:

ok single line: '36'

Test #17:

score: 0
Accepted
time: 3ms
memory: 4308kb

input:

30 48 120 31
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 10...

output:

2348640

result:

ok single line: '2348640'

Test #18:

score: 0
Accepted
time: 0ms
memory: 4016kb

input:

30 48 120 31
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 10...

output:

2348640

result:

ok single line: '2348640'

Test #19:

score: 0
Accepted
time: 12ms
memory: 5424kb

input:

22 263 472 31
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000
1000000 1000000 1000000 1000000 100000...

output:

9570506880

result:

ok single line: '9570506880'

Test #20:

score: 0
Accepted
time: 12ms
memory: 5712kb

input:

263 22 472 31
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000
1000000 1000000 1000000 1000000 100000...

output:

9570506880

result:

ok single line: '9570506880'

Test #21:

score: 0
Accepted
time: 2ms
memory: 3932kb

input:

2 15 110 31
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...

output:

30266272170

result:

ok single line: '30266272170'

Test #22:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

15 2 110 31
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 10...

output:

30266272170

result:

ok single line: '30266272170'

Test #23:

score: 0
Accepted
time: 146ms
memory: 5580kb

input:

123 66 442 124
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

9522414

result:

ok single line: '9522414'

Test #24:

score: 0
Accepted
time: 144ms
memory: 5296kb

input:

123 66 442 124
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

9522414

result:

ok single line: '9522414'

Test #25:

score: 0
Accepted
time: 30ms
memory: 4360kb

input:

64 40 150 124
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...

output:

2968576000

result:

ok single line: '2968576000'

Test #26:

score: 0
Accepted
time: 34ms
memory: 4360kb

input:

64 40 150 124
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 100000...

output:

2968576000

result:

ok single line: '2968576000'

Test #27:

score: 0
Accepted
time: 11ms
memory: 3852kb

input:

32 54 56 124
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...

output:

2300466256704

result:

ok single line: '2300466256704'

Test #28:

score: 0
Accepted
time: 11ms
memory: 3836kb

input:

54 32 56 124
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1...

output:

2300466256704

result:

ok single line: '2300466256704'

Test #29:

score: 0
Accepted
time: 385ms
memory: 4800kb

input:

69 105 240 496
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

7708680

result:

ok single line: '7708680'

Test #30:

score: 0
Accepted
time: 393ms
memory: 4576kb

input:

69 105 240 496
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

7708680

result:

ok single line: '7708680'

Test #31:

score: 0
Accepted
time: 1152ms
memory: 5320kb

input:

335 15 432 496
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

5145670350

result:

ok single line: '5145670350'

Test #32:

score: 0
Accepted
time: 1312ms
memory: 5264kb

input:

335 15 432 496
1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 1000000 10000...

output:

5145670350

result:

ok single line: '5145670350'

Test #33:

score: 0
Accepted
time: 982ms
memory: 4600kb

input:

273 172 265 496
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...

output:

73054029616932

result:

ok single line: '73054029616932'

Test #34:

score: 0
Accepted
time: 981ms
memory: 4688kb

input:

172 273 265 496
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 100000000...

output:

73054029616932

result:

ok single line: '73054029616932'

Test #35:

score: 0
Accepted
time: 2972ms
memory: 5612kb

input:

499 499 500 500
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...

output:

0

result:

ok single line: '0'

Test #36:

score: 0
Accepted
time: 0ms
memory: 3616kb

input:

2 1 3 3
3 6 3
7 7 3
7 3 6

output:

16

result:

ok single line: '16'

Test #37:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

1 2 3 3
82 191 71
221 234 56
255 86 200

output:

568

result:

ok single line: '568'

Test #38:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

1 2 3 3
299701602 739500542 255491000
861557234 913571517 196621718
996040164 318365281 778213934

output:

2215432886

result:

ok single line: '2215432886'

Test #39:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

7 2 3 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6 5...

output:

42

result:

ok single line: '42'

Test #40:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

2 7 3 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 234...

output:

1320

result:

ok single line: '1320'

Test #41:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

2 7 3 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 3972...

output:

5089575880

result:

ok single line: '5089575880'

Test #42:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

1 14 56 3
3 6 3
7 7 3
7 3 6
6 3 5
2 2 5
4 5 6
2 3 5
6 5 5
3 5 3
3 7 4
4 2 6
2 6 7
6 2 7
5 2 4
5 6 7
7 5 6
2 6 2
2 5 5
2 3 3
5 2 4
3 5 4
7 6 5
4 2 6
3 5 2
6 3 6
5 4 3
6 5 7
3 5 5
6 6 4
7 3 5
2 7 2
2 2 4
2 3 5
2 3 4
3 6 2
3 4 7
6 6 5
3 5 3
4 7 3
4 6 5
3 4 7
4 7 7
7 7 3
4 3 3
6 7 5
6 4 6
7 5 4
7 5 5
6 ...

output:

42

result:

ok single line: '42'

Test #43:

score: 0
Accepted
time: 0ms
memory: 4052kb

input:

14 1 56 3
82 191 71
221 234 56
255 86 200
209 60 139
12 17 145
95 161 211
18 67 150
207 159 134
62 140 69
71 229 106
129 10 177
30 203 251
204 45 216
139 29 105
171 213 217
254 158 176
17 180 46
26 154 167
17 88 64
155 17 97
79 139 117
246 198 167
130 36 189
50 158 40
213 57 189
168 97 53
183 160 23...

output:

1290

result:

ok single line: '1290'

Test #44:

score: 0
Accepted
time: 0ms
memory: 4040kb

input:

1 14 56 3
299701602 739500542 255491000
861557234 913571517 196621718
996040164 318365281 778213934
811825172 213066337 530735354
18663934 38713647 556334427
351509104 617163837 822042217
42673484 237969402 573295170
805338666 608976135 511938130
219305723 534581778 249004494
257467287 894774293 397...

output:

4924341786

result:

ok single line: '4924341786'

Test #45:

score: 0
Accepted
time: 4ms
memory: 3768kb

input:

7 14 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6...

output:

196

result:

ok single line: '196'

Test #46:

score: 0
Accepted
time: 2ms
memory: 3764kb

input:

7 14 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 2...

output:

2800

result:

ok single line: '2800'

Test #47:

score: 0
Accepted
time: 5ms
memory: 3760kb

input:

14 7 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 39...

output:

9675953385

result:

ok single line: '9675953385'

Test #48:

score: 0
Accepted
time: 1ms
memory: 3804kb

input:

2 38 3 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6 ...

output:

228

result:

ok single line: '228'

Test #49:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

38 2 3 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 23...

output:

2376

result:

ok single line: '2376'

Test #50:

score: 0
Accepted
time: 1ms
memory: 3552kb

input:

38 2 3 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 397...

output:

6446080608

result:

ok single line: '6446080608'

Test #51:

score: 0
Accepted
time: 6ms
memory: 3828kb

input:

38 14 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 ...

output:

1064

result:

ok single line: '1064'

Test #52:

score: 0
Accepted
time: 9ms
memory: 4048kb

input:

38 14 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 ...

output:

5698

result:

ok single line: '5698'

Test #53:

score: 0
Accepted
time: 9ms
memory: 3856kb

input:

38 14 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 3...

output:

11871610580

result:

ok single line: '11871610580'

Test #54:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

1 55 56 3
3 6 3
7 7 3
7 3 6
6 3 5
2 2 5
4 5 6
2 3 5
6 5 5
3 5 3
3 7 4
4 2 6
2 6 7
6 2 7
5 2 4
5 6 7
7 5 6
2 6 2
2 5 5
2 3 3
5 2 4
3 5 4
7 6 5
4 2 6
3 5 2
6 3 6
5 4 3
6 5 7
3 5 5
6 6 4
7 3 5
2 7 2
2 2 4
2 3 5
2 3 4
3 6 2
3 4 7
6 6 5
3 5 3
4 7 3
4 6 5
3 4 7
4 7 7
7 7 3
4 3 3
6 7 5
6 4 6
7 5 4
7 5 5
6 ...

output:

110

result:

ok single line: '110'

Test #55:

score: 0
Accepted
time: 0ms
memory: 3852kb

input:

55 1 56 3
82 191 71
221 234 56
255 86 200
209 60 139
12 17 145
95 161 211
18 67 150
207 159 134
62 140 69
71 229 106
129 10 177
30 203 251
204 45 216
139 29 105
171 213 217
254 158 176
17 180 46
26 154 167
17 88 64
155 17 97
79 139 117
246 198 167
130 36 189
50 158 40
213 57 189
168 97 53
183 160 23...

output:

1440

result:

ok single line: '1440'

Test #56:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

1 55 56 3
299701602 739500542 255491000
861557234 913571517 196621718
996040164 318365281 778213934
811825172 213066337 530735354
18663934 38713647 556334427
351509104 617163837 822042217
42673484 237969402 573295170
805338666 608976135 511938130
219305723 534581778 249004494
257467287 894774293 397...

output:

4924341786

result:

ok single line: '4924341786'

Test #57:

score: 0
Accepted
time: 3ms
memory: 4064kb

input:

55 7 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 6...

output:

770

result:

ok single line: '770'

Test #58:

score: 0
Accepted
time: 9ms
memory: 3760kb

input:

55 7 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 2...

output:

4620

result:

ok single line: '4620'

Test #59:

score: 0
Accepted
time: 6ms
memory: 3852kb

input:

7 55 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 39...

output:

11871610580

result:

ok single line: '11871610580'

Test #60:

score: 0
Accepted
time: 5ms
memory: 3764kb

input:

38 55 56 65
3 6 3 7 7 3 7 3 6 6 3 5 2 2 5 4 5 6 2 3 5 6 5 5 3 5 3 3 7 4 4 2 6 2 6 7 6 2 7 5 2 4 5 6 7 7 5 6 2 6 2 2 5 5 2 3 3 5 2 4 3 5 4 7 6
5 4 2 6 3 5 2 6 3 6 5 4 3 6 5 7 3 5 5 6 6 4 7 3 5 2 7 2 2 2 4 2 3 5 2 3 4 3 6 2 3 4 7 6 6 5 3 5 3 4 7 3 4 6 5 3 4 7 4 7 7 7 7 3 4
3 3 6 7 5 6 4 6 7 5 4 7 5 5 ...

output:

8360

result:

ok single line: '8360'

Test #61:

score: 0
Accepted
time: 13ms
memory: 3832kb

input:

38 55 56 65
82 191 71 221 234 56 255 86 200 209 60 139 12 17 145 95 161 211 18 67 150 207 159 134 62 140 69 71 229 106 129 10 177 30 203 251 204 45 216 139 29 105 171 213 217 254 158 176 17 180 46 26 154 167 17 88 64 155 17 97 79 139 117 246 198
167 130 36 189 50 158 40 213 57 189 168 97 53 183 160 ...

output:

37620

result:

ok single line: '37620'

Test #62:

score: 0
Accepted
time: 13ms
memory: 4052kb

input:

55 38 56 65
299701602 739500542 255491000 861557234 913571517 196621718 996040164 318365281 778213934 811825172 213066337 530735354 18663934 38713647 556334427 351509104 617163837 822042217 42673484 237969402 573295170 805338666 608976135 511938130 219305723 534581778 249004494 257467287 894774293 3...

output:

11871610580

result:

ok single line: '11871610580'

Test #63:

score: 0
Accepted
time: 6ms
memory: 3728kb

input:

24 42 43 52
299701423 739500476 255490810 861557198 913571495 196621512 996040163 318365107 778213877 811825124 213066135 530735234 18663683 38713401 556334314 351508938 617163739 822042171 42673239 237969207 573295061 805338616 608976035 511938005 219305523 534581659 249004302 257467097 894774266 3...

output:

18432996624

result:

ok single line: '18432996624'

Test #64:

score: 0
Accepted
time: 109ms
memory: 4908kb

input:

2 15 345 246
151227484 789543306 512383373 318251864 963588695 758405230 201717385 605564073 629737585 473197716 754666167 142940607 454336588 840194280 960814343 436414302 179351912 695931359 638476894 355250270 806676717 706154197 941265193 495536287 900913682 966482438 745339855 504850890 3161843...

output:

10607893296

result:

ok single line: '10607893296'

Test #65:

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

input:

179 320 347 181
690843266 346074649 434479634 175199396 173022964 863853234 303401812 815876632 481855135 813531362 940426608 310255933 125033365 135780485 379051727 765227211 137232968 261180132 832378674 563175096 283372076 323701607 320753525 522122740 438141731 147591590 944649880 555526314 3848...

output:

12475997768

result:

ok single line: '12475997768'

Test #66:

score: 0
Accepted
time: 2289ms
memory: 5716kb

input:

113 275 475 269
113173038 487092470 999914535 894718897 815790551 7023415 968172060 855456713 946637580 278744292 428576107 549547442 742283675 459545109 278829757 533857210 733756892 735260259 491373050 423373044 587219631 455012600 306684152 941825608 681089370 127674521 176182842 772826942 208068...

output:

18926461488

result:

ok single line: '18926461488'

Test #67:

score: 0
Accepted
time: 943ms
memory: 4512kb

input:

299 13 220 349
258493285 307845371 532315762 2398579 424173141 232074804 572538364 583330321 565177533 728358936 175872458 715806529 324837035 257332162 196043174 173473879 291633387 92762231 684793798 612712854 608296346 563274451 916889773 968987270 287875818 350964183 367231277 743415894 67735388...

output:

17317141176

result:

ok single line: '17317141176'

Test #68:

score: 0
Accepted
time: 76ms
memory: 3832kb

input:

52 140 53 205
237057534 333472068 534838424 776374312 974185803 306067083 66737009 592872142 674003338 567292415 306095916 383055142 355814607 340531269 32453991 529721604 408869340 49747524 273794260 439581850 855718267 841576925 743651609 890739119 83767242 515186997 809122934 213930005 481869778 ...

output:

12829142123

result:

ok single line: '12829142123'

Test #69:

score: 0
Accepted
time: 54ms
memory: 4560kb

input:

195 51 236 55
376574157 667328817 933261403 968917700 49822974 207476133 497468654 480689879 499301122 943285610 380945871 564780818 104115722 831972306 10024206 412028172 514957844 896639589 334503651 529334328 912727050 571672234 515693717 769722833 425218605 80754744 561648027 103665544 254764989...

output:

15023476650

result:

ok single line: '15023476650'

Test #70:

score: 0
Accepted
time: 1128ms
memory: 4460kb

input:

60 152 230 413
467307541 166719534 627152214 544927009 900086702 163903661 133245152 480840734 86989022 75323603 502720804 989379452 13533193 920269489 448171389 957793795 89292749 849629532 787024336 967330655 870804773 13969146 346908728 797644884 953797462 950535284 565797758 389114933 708352134 ...

output:

17139198780

result:

ok single line: '17139198780'