QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#395232#4208. Flight to the Fordhyforces#100 ✓37ms4080kbC++203.4kb2024-04-21 11:17:482024-04-28 08:59:07

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 1ms
memory: 4032kb
Overall Time Limit: 500ms

input:

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

output:

510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
84...

input:

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

output:

510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
84...

input:

2
3
1
1
1
1
2
3
0
0
1
0
2
3
0
0
0
0
2
3
1
0
1
0
2
3
1
0
1
0
2
3
0
0
1
0
2
3
0
1
1
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
1
1
0
2
3
1
1
1
1
2
3
0
1
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
1
1
0
2
3
1
1
1
1
2
3
1
0
1
0
2
3
0
0
1
0
2
3
0
0
0
0
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
...

input:

2
3
0
1
1
0
2
3
0
0
0
0
2
3
1
1
1
1
2
3
1
0
1
0
2
3
1
0
1
0
2
3
0
1
1
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
1
1
1
1
2
3
0
0
0
0
2
3
1
0
1
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
1
1
1
1
2
3
0
0
0
0
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
...

result:

points 1.0

Test #2:

score: 15
Accepted
time: 1ms
memory: 4032kb
Overall Time Limit: 250ms

input:

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

output:

510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 1
84...

input:

2
3
1
1
1
1
2
3
0
1
1
0
2
3
0
1
1
0
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
0
0
0
0
2
3
0
0
0
0
2
3
1
1
1
1
2
3
1
1
1
1
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3

result:

points 1.0

Test #3:

score: 15
Accepted
time: 1ms
memory: 3796kb
Overall Time Limit: 375ms

input:

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

output:

510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
1
0
1
-1
-1

output:

510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
...

result:

points 1.0

Test #4:

score: 15
Accepted
time: 1ms
memory: 4032kb
Overall Time Limit: 500ms

input:

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

output:

510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

2
3
0
1
0
0
2
3
0
0
0
0
2
3
1
0
0
1
2
3
1
0
1
0
2
3
0
1
0
0
2
3
1
0
1
0
2
3
1
0
0
1
2
3
0
1
1
0
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
1
0
0
2
3
0
1
0
0
2
3
1
1
1
1
2
3
0
0
1
0
2
3
1
1
1
0
2
3
0
1
0
0
2
3
1
0
1
1
2
3
1
0
0
1
2
3
1
0
1
0
2
3
0
1
0
1
-1
-1

output:

510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
...

result:

points 1.0

Test #5:

score: 15
Accepted
time: 3ms
memory: 4032kb
Overall Time Limit: 2000ms

input:

1
3
1
0
0
0
0
1
3
2
0
1
0
1
1
3
1
0
0
0
0
1
3
1
0
0
0
0
1
3
1
0
0
0
0
1
3
3
0
0
1
0
1
3
2
0
1
0
1
1
3
3
0
0
1
0
1
3
3
0
0
1
0
1
3
2
0
1
0
1
1
3
3
0
0
1
0
1
3
3
0
0
1
0
1
3
3
0
0
1
0
1
3
3
0
0
1
0
1
3
1
0
0
0
0
1
3
2
0
1
0
1
1
3
1
0
0
0
0
1
3
3
0
0
1
0
1
3
1
0
0
0
0
1
3
1
0
0
0
0
1
3
3
0
0
1
0
1
3
1
...

output:

510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
84...

input:

2
3
0
1
0
1
2
3
0
0
0
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
0
0
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
1
0
1
2
3
0
0
0
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
0
0
0
...

output:

510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
...

result:

points 1.0

Test #6:

score: 15
Accepted
time: 1ms
memory: 3776kb
Overall Time Limit: 250ms

input:

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

output:

510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

2
3
0
1
0
1
2
3
1
0
0
1
2
3
1
1
1
0
2
3
0
1
0
0
2
3
0
1
1
1
2
3
0
1
0
1
2
3
0
0
1
0
2
3
1
1
1
0
2
3
1
0
0
1
2
3
1
1
1
1
-1
-1

output:

510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3

result:

points 1.0

Test #7:

score: 15
Accepted
time: 1ms
memory: 4036kb
Overall Time Limit: 375ms

input:

1
3
2
1
1
1
1
1
3
2
1
1
1
1
1
3
3
1
1
1
1
1
3
2
1
1
1
1
1
3
2
1
1
1
1
1
3
3
1
1
1
1
1
3
2
1
1
1
1
1
3
2
1
1
1
1
1
3
3
1
1
1
1
1
3
2
1
1
1
1
1
3
2
1
1
1
1
1
3
3
1
1
1
1
1
3
2
1
1
1
1
1
3
2
1
1
1
1
1
3
3
1
1
1
1

output:

510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 1
84...

input:

2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
1
1
1
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
...

result:

points 1.0

Subtask #2:

score: 85
Accepted

Test #8:

score: 85
Accepted
time: 14ms
memory: 3876kb
Overall Time Limit: 2210ms

input:

1
684392489
188482225
1
0
0
1
1
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
1
1
0
0
0
1
1
0
1
0
1
0
0
1
1
1
1
1
0
1
0
0
1
0
1
0
0
0
1
0
0
1
1
0
0
1
1
1
1
0
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
32744645
1173904
0
1
1
1
0
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
0
1
0
0
1
1
1
1
1
0
1
0
1
1...

output:

510
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
84...

input:

2
388942472
1
0
1
1
1
0
1
1
0
1
1
0
0
0
1
1
1
0
1
1
0
0
0
1
0
1
0
0
1
1
1
0
0
1
1
1
0
1
0
1
0
0
1
0
1
0
1
1
1
1
0
0
1
1
0
0
0
1
1
1
0
1
1
0
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
1
1
0
0
0
1
0
0
0
1
0
1
0
2
971642535
1
0
1
1
1
0
0
0
0
1
0
0
0
1
0
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
1
1
0
0
1
0
1
1
0
0
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #9:

score: 85
Accepted
time: 22ms
memory: 3804kb
Overall Time Limit: 2955ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
0
0...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
1
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
1
0
1
0
2
1000000000
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
1
0
1
1
0
1
1
1
0
0
0
1
1
0
1
0
1
1
1
2
1000000000
1
0
0
0
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
0
1
1
1
1
0
1
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #10:

score: 85
Accepted
time: 18ms
memory: 4076kb
Overall Time Limit: 2020ms

input:

1
1000000000
336586080
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
0
1
1
1
1
1
0
1
0
1
1
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
0
1
0
1
0
1
1000000000
995427135
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
0
0
1
0
0
1
0
0
1
0
0
0
1
1
1
...

output:

510
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
174122621
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
0
1
1
1
1
1
0
1
0
1
1
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
0
1
0
1
0
1
1000000000
141969875
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
0
0
1
0
0
1
0
0
1
0
0
0
1
1
1
...

output:

510
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
84...

input:

2
1000000000
1
0
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
0
0
1
1
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
1
1
0
0
1
0
1
0
1
0
1
0
0
1
1
0
1
1
1
0
1
1
0
1
1
0
1
1
1
1
1
0
1
0
0
2
1000000000
1
0
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
0
1
1
1
0
1
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
1
1
1
0
1
0
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
0
0
1
1
0
1
1
1
1
0
1
0
0
2
1000000000
1
0
1
0
1
1
0
1
1
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
1
1
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #11:

score: 85
Accepted
time: 9ms
memory: 4076kb
Overall Time Limit: 1235ms

input:

1
1000000000
458314021
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
0
1
0
1
0
1
0
1
1
1000000000
458314021
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
0
...

output:

510
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
437207149
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
0
1
0
1
0
1
0
1
1
1000000000
437207149
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
0
...

output:

510
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
84...

input:

2
1000000000
1
0
1
0
0
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
1
1
0
0
1
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
0
1
1
1
0
0
0
0
1
0
2
1000000000
1
0
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
0
1
0
1
0
1
0
0
0
0
1
1
1
0
1
0
1
0
1
0
1
1
1
1
1
0
0
0
0
1
1
0
1
0
0
1
0
1
0
0
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
0
0
0
1
1
1
2
1000000000
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #12:

score: 85
Accepted
time: 28ms
memory: 4060kb
Overall Time Limit: 2500ms

input:

1
1000000000
198638718
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
0
1
1
0
0
1
1
0
1
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
0
1
1
1
1
1000000000
227274056
1
1
0
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
...

output:

510
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
615950227
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
0
1
1
0
0
1
1
0
1
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
0
0
1
1
1
1
1000000000
482427607
1
1
0
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
...

output:

510
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 0
84...

input:

1
1000000000
198638718
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
0
1
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
1
1
0
1
0
1
1000000000
227274056
1
0
0
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
...

output:

510
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
84...

input:

1
1000000000
615950227
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
0
1
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
1
1
0
1
0
1
1000000000
482427607
1
0
0
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
84...

input:

2
1000000000
0
0
0
1
0
1
1
1
0
0
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
0
0
1
0
1
0
1
1
0
0
0
0
0
0
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
1
2
1000000000
1
1
1
0
1
1
1
1
0
1
0
1
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
0
1
0
0
0
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
1
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
1
1
1
1
0
1
0
1
1
0
1
1
0
0
0
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1
1
0
0
1
0
1
0
1
1
1
2
1000000000
1
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
0
0
1
1
0
0
1
0
1
1
1
0
1
0
0
0
1
0
1
1
1
1
0
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
0
1
0
1
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
1
0
1
1
1
2
1000000000
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
1
1
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
1
1
1
1
0
0
1
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
0
1
1
0
0
0
0
0
1
1
0
1
1
0
1
1
0
2
1000000000
0
1
0
1
0
0
1
1
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
1
1
0
0
0
0
0
0
1
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #13:

score: 85
Accepted
time: 27ms
memory: 3876kb
Overall Time Limit: 2965ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
1
0
1
0
0
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
1
0
0
0
1
1
0
2
1000000000
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
1
1
0
2
1000000000
1
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #14:

score: 85
Accepted
time: 37ms
memory: 4060kb
Overall Time Limit: 2955ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
1
0
1
0
0
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
1
0
0
0
1
1
0
2
1000000000
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
1
1
0
2
1000000000
1
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #15:

score: 85
Accepted
time: 23ms
memory: 4036kb
Overall Time Limit: 2960ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
0
0...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
1
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
1
0
1
0
2
1000000000
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
1
0
1
1
0
1
1
1
0
0
0
1
1
0
1
0
1
1
1
2
1000000000
1
0
0
0
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
0
1
1
1
1
0
1
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #16:

score: 85
Accepted
time: 11ms
memory: 4080kb
Overall Time Limit: 1210ms

input:

1
1000000000
755120568
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
0
0
1
1
1
0
0
1
1
1
0
1
0
0
1
1000000000
755120568
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
84...

input:

1
1000000000
614457618
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
0
0
1
1
1
0
0
1
1
1
0
1
0
0
1
1000000000
614457618
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
84...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
0
1
1
1
0
1
1
1
1
0
1
0
0
0
0
0
1
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
0
0
0
0
1
1
1
2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
0
0
1
1
0
1
0
0
0
1
0
0
1
1
1
1
0
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
1
1
1
1
0
1
0
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
0
0
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
0
1
0
1
1
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
0
1
0
0
0
1
0
0
1
1
1
0
1
0
1
1
0
0
1
0
1
0
2
1000000000
0
1
1
1
1
1
0
0
1
0
1
1
1
0
1
0
1
1
1
1
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
1
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #17:

score: 85
Accepted
time: 9ms
memory: 3756kb
Overall Time Limit: 1050ms

input:

1
1000000000
295341091
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
1
1000000000
135439260
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
...

output:

510
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

2
1000000000
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
0
2
1000000000
1
1
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
1
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #18:

score: 85
Accepted
time: 23ms
memory: 4060kb
Overall Time Limit: 2300ms

input:

1
1000000000
448772181
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
1
0
0
0
1
0
1
1
0
0
1
0
1
1
0
0
1
0
1
1
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
1
1
1000000000
183638812
0
1
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
1
...

output:

510
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
0
0
1
0
0
0
0
1
0
1
0
1
0
0
0
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
1
0
2
1000000000
0
0
1
0
0
1
1
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #19:

score: 85
Accepted
time: 20ms
memory: 3876kb
Overall Time Limit: 1255ms

input:

1
1000000000
143098526
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1000000000
143098526
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
...

output:

510
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
84...

input:

1
1000000000
237847677
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1000000000
237847677
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
...

output:

510
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
84...

input:

2
1000000000
1
1
1
0
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
1
1
0
1
0
0
1
1
0
0
1
1
1
0
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
1
1
1
0
1
1
1
0
0
0
0
1
0
0
1
1
1
1
0
0
0
0
1
1
0
1
1
1
0
1
0
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
1
0
1
0
0
1
0
1
1
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
0
0
1
0
1
0
1
1
1
1
0
0
0
0
1
0
1
1
0
0
0
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
1
0
1
1
1
1
1
1
0
0
0
1
1
0
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
1
0
1
0
1
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #20:

score: 85
Accepted
time: 10ms
memory: 3800kb
Overall Time Limit: 1250ms

input:

1
1000000000
143098526
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1000000000
143098526
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
...

output:

510
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
84...

input:

1
1000000000
237847677
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1000000000
237847677
1
1
1
1
1
0
1
1
1
1
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
...

output:

510
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
84...

input:

2
1000000000
1
1
1
0
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
1
1
0
1
0
0
1
1
0
0
1
1
1
0
1
0
0
0
0
0
1
0
1
0
1
0
0
0
0
1
1
1
0
1
1
1
0
0
0
0
1
0
0
1
1
1
1
0
0
0
0
1
1
0
1
1
1
0
1
0
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
1
0
1
0
0
1
0
1
1
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
0
0
1
0
1
0
1
1
1
1
0
0
0
0
1
0
1
1
0
0
0
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
1
0
1
1
1
1
1
1
0
0
0
1
1
0
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
1
0
1
0
1
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #21:

score: 85
Accepted
time: 0ms
memory: 4076kb
Overall Time Limit: 250ms

input:

1
1337
42
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
1
1337
42
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
1
1337
42
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
1
1337
42
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
...

output:

510
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
...

input:

2
1337
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
2
1337
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
2
1337
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
2
1337
0
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
2
1337
0...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
167 43 42
510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
167 43 42
510
410
...

result:

points 1.0

Test #22:

score: 85
Accepted
time: 12ms
memory: 4076kb
Overall Time Limit: 1230ms

input:

1
1000000000
458314021
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
0
1
0
1
0
1
0
1
1
1000000000
458314021
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
0
...

output:

510
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
437207149
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
1
1
1
0
0
0
0
0
1
0
0
1
0
1
0
1
0
1
0
1
1
1000000000
437207149
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
0
...

output:

510
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
84...

input:

2
1000000000
1
0
1
0
0
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
1
1
1
0
1
0
0
0
0
1
1
0
0
1
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
0
1
1
1
0
0
0
0
1
0
2
1000000000
1
0
1
1
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
0
0
1
0
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
0
1
1
1
0
1
0
1
0
1
0
0
0
0
1
1
1
0
1
0
1
0
1
0
1
1
1
1
1
0
0
0
0
1
1
0
1
0
0
1
0
1
0
0
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
0
0
0
1
1
1
2
1000000000
1
0
1
1
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #23:

score: 85
Accepted
time: 15ms
memory: 4036kb
Overall Time Limit: 3210ms

input:

1
1000000000
993192100
0
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
0
1
0
1
1
1
0
0
1
0
0
1
1
1
0
1
0
0
1
1000000000
884727289
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
...

output:

510
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
84...

input:

1
1000000000
990822595
0
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
0
1
0
1
1
1
0
0
1
0
0
1
1
1
0
1
0
0
1
1000000000
751258761
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
...

output:

510
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
84...

input:

2
1000000000
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
0
1
1
1
1
1
0
1
0
1
0
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
1
2
1000000000
1
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
1
1
1
0
1
0
1
1
0
0
0
0
0
0
1
1
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
1
1
1
1
0
0
1
0
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
0
1
1
1
0
0
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
2
1000000000
1
1
1
1
1
1
1
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #24:

score: 85
Accepted
time: 10ms
memory: 4072kb
Overall Time Limit: 1300ms

input:

1
1000000000
541788479
1
1
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
1
1000000000
871205524
0
1
1
0
0
1
0
1
0
1
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
...

output:

510
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
84...

input:

2
1000000000
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
1
0
1
1
0
0
1
0
0
0
0
1
0
0
1
1
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
0
0
1
1
2
1000000000
0
0
1
0
1
0
1
0
0
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
1
1
0
0
1
0
1
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #25:

score: 85
Accepted
time: 26ms
memory: 3856kb
Overall Time Limit: 4995ms

input:

1
1000000000
576564152
1
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
0
0
0
1
1
0
0
0
0
1
0
1
1000000000
576564152
1
1
0
1
0
1
0
0
1
1
1
1
0
0
0
0
0
0
1
0
1
1
0
0
1
1
0
1
0
0
...

output:

510
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
84...

input:

1
1000000000
484828360
1
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
0
1
1
0
0
0
1
1
0
0
0
0
1
0
1
1000000000
484828360
1
1
0
1
0
1
0
0
1
1
1
1
0
0
0
0
0
0
1
0
1
1
0
0
1
1
0
1
0
0
...

output:

510
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
84...

input:

2
1000000000
1
1
0
0
1
1
0
1
0
0
1
1
1
0
1
0
1
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
1
1
1
0
1
0
1
1
0
1
0
1
1
1
0
1
1
0
1
0
1
0
0
0
1
0
0
1
1
1
0
1
0
0
0
0
1
0
0
0
1
0
1
2
1000000000
0
0
1
0
0
0
1
0
1
0
0
0
0
1
0
0
0
0
0
1
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
0
1
0
0
0
0
1
1
1
1
0
0
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
1
1
1
1
0
1
0
1
1
0
1
0
1
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
1
1
1
0
1
1
1
1
0
1
0
0
1
1
1
1
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
1
2
1000000000
0
0
1
0
0
0
0
1
1
1
1
0
0
0
1
0
1
0
0
0
1
0
0
1
1
1
1
1
1
1
0
0
1
0
1
1
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #26:

score: 85
Accepted
time: 31ms
memory: 3804kb
Overall Time Limit: 2000ms

input:

1
1000000000
883386153
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
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
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
0
1
1
1000000000
278730866
0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
84...

input:

2
1000000000
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
2
1000000000
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #27:

score: 85
Accepted
time: 14ms
memory: 3996kb
Overall Time Limit: 1220ms

input:

1
1000000000
755120568
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
0
0
1
1
1
0
0
1
1
1
0
1
0
0
1
1000000000
755120568
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
84...

input:

1
1000000000
614457618
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
0
0
1
1
1
0
0
1
1
1
0
1
0
0
1
1000000000
614457618
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
84...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
0
1
1
1
0
1
1
1
1
0
1
0
0
0
0
0
1
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
0
0
0
0
1
1
1
2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
0
0
1
1
0
1
0
0
0
1
0
0
1
1
1
1
0
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
1
1
1
1
0
1
0
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
0
0
1
1
1
1
0
1
0
1
1
1
1
1
1
0
1
0
1
0
1
1
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
0
1
0
0
0
1
0
0
1
1
1
0
1
0
1
1
0
0
1
0
1
0
2
1000000000
0
1
1
1
1
1
0
0
1
0
1
1
1
0
1
0
1
1
1
1
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
1
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #28:

score: 85
Accepted
time: 19ms
memory: 4076kb
Overall Time Limit: 1710ms

input:

1
1000000000
182158063
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1000000000
854157332
0
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
...

output:

510
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
84...

input:

2
1000000000
0
1
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
0
2
1000000000
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #29:

score: 85
Accepted
time: 30ms
memory: 4060kb
Overall Time Limit: 2355ms

input:

1
1000000000
2321558
0
1
1
1
0
0
1
0
0
0
0
1
0
1
1
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
1
1
0
1
0
0
0
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1000000000
2321558
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
0
0
0
1
1
...

output:

510
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
821874523
0
1
1
1
0
0
1
0
0
0
0
1
0
1
1
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
1
1
0
1
0
0
0
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
1
1000000000
821874523
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
0
0
0
...

output:

510
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
84...

input:

2
1000000000
1
0
1
1
1
0
1
1
1
0
1
0
0
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
0
1
1
0
0
0
0
1
1
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
0
0
1
1
1
1
0
1
1
0
1
1
1
0
0
0
0
0
1
1
1
0
1
1
0
1
0
1
1
0
1
0
1
1
1
1
0
0
0
1
0
1
0
0
2
1000000000
0
1
1
1
0
0
1
1
0
0
1
0
0
1
0
0
1
1
1
1
1
0
0
1
0
1
1
1
0
1
0
1
0
1
1
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
1
1
1
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
0
0
0
1
1
0
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
0
1
0
0
1
0
1
0
1
1
0
1
1
0
0
1
0
1
0
0
1
1
0
1
0
1
0
1
1
0
1
0
1
0
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
0
1
0
2
1000000000
0
1
1
1
0
1
0
1
1
0
0
0
0
0
1
1
1
1
1
1
1
0
0
0
1
0
1
1
0
1
1
0
0
1
1
1
1
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #30:

score: 85
Accepted
time: 31ms
memory: 4064kb
Overall Time Limit: 2960ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
0
0
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
1
0
1
0
0
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
0
0
1
0
0
0
1
1
0
2
1000000000
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
0
0
1
0
0
0
1
1
0
2
1000000000
1
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
0
1
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #31:

score: 85
Accepted
time: 26ms
memory: 4036kb
Overall Time Limit: 2965ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
0
0...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
1
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
1
0
1
0
2
1000000000
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
1
0
1
1
0
1
1
1
0
0
0
1
1
0
1
0
1
1
1
2
1000000000
1
0
0
0
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
0
1
1
1
1
0
1
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0