QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#178995#3097. Shoppingznstz#1 90ms15220kbC++203.8kb2023-09-14 16:20:422024-07-04 01:59:49

详细

Subtask #1:

score: 1
Accepted

Test #1:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #2:

score: 1
Accepted
time: 14ms
memory: 3920kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #3:

score: 1
Accepted
time: 10ms
memory: 3864kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #4:

score: 1
Accepted
time: 13ms
memory: 4160kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #5:

score: 1
Accepted
time: 14ms
memory: 3876kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #6:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
1
1
1
1
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
1
1
1
0
1
1
0
0
0
0
0
0
0
1
1
1
0
1
0
1
1
1
1
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
0
0
1
1
1
0
1
1
1
1
1
0
1
0
1
1
0
1
1
0
1
0
1
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #7:

score: 1
Accepted
time: 4ms
memory: 3860kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
1
0
1
1
1
0
1
1
0
0
0
1
1
1
0
1
0
1
0
1
1
0
0
1
0
1
1
0
0
1
1
1
0
0
0
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
0
1
1
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
0
0
0
1
1
1
0
1
1
1
0
1
0
0
1
1
0
1
1
0
0
1
1
0
1
0
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #8:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
0
0
0
1
1
1
1
0
0
0
1
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
1
0
0
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
1
0
1
1
0
1
0
1
0
1
1
0
0
1
0
0
0
0
1
0
1
0
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
1
0
1
0
0
0
1
1
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #9:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
1
0
1
1
0
1
0
0
0
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
1
1
0
0
1
1
1
1
0
0
0
1
1
1
0
1
1
0
1
1
1
0
0
0
0
1
0
1
0
0
1
1
1
1
0
0
1
1
0
0
0
1
0
1
1
0
1
1
0
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1
1
1
0
0
0
1
1
0
1
0
0
1
0
0
1
1
0
0
1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #10:

score: 1
Accepted
time: 5ms
memory: 4084kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
0
0
0
0
1
0
1
1
1
0
0
0
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
0
0
1
0
1
1
0
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
0
1
1
1
0
0
0
0
1
0
1
0
1
1
0
0
0
0
0
1
1
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
0
1
0
1
0
1
1
1
0
0
0
1
1
0
0
1
1
1
1
0
1
1
0
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #11:

score: 1
Accepted
time: 4ms
memory: 4104kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
1
1
0
1
1
0
1
1
1
0
0
0
0
0
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
1
1
1
1
1
1
0
1
0
0
0
1
1
0
0
1
0
1
1
0
1
0
1
1
0
1
1
1
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
1
0
0
1
0
1
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
0
0
1
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #12:

score: 1
Accepted
time: 10ms
memory: 3864kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #13:

score: 1
Accepted
time: 3ms
memory: 4104kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
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...

input:


output:

Accepted: 18 8361

result:

ok 

Test #14:

score: 1
Accepted
time: 4ms
memory: 3852kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
1
0
0
0
0
0
0
0
1
1
1
1
1
1
0
1
0
1
1
0
0
1
1
0
1
1
1
1
0
0
0
1
1
1
0
1
0
0
0
1
0
1
0
1
0
1
1
1
0
0
0
0
1
0
1
1
1
1
1
0
1
1
1
0
1
1
0
1
0
1
0
1
1
1
0
0
0
1
1
0
1
1
1
1
0
0
0
0
0
1
0
1
0
0
1
1
0
0
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #15:

score: 1
Accepted
time: 4ms
memory: 4056kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
0
0
0
0
0
1
1
1
1
1
1
1
1
0
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
1
0
0
1
1
0
0
0
0
1
1
0
1
1
1
0
1
1
1
0
0
0
1
1
0
1
0
1
0
0
1
1
0
0
1
0
1
1
0
0
0
0
0
1
0
0
1
1
1
1
0
0
1
1
0
1
0
1
1
1
0
1
1
1
0
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #16:

score: 1
Accepted
time: 2ms
memory: 4104kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #17:

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

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #18:

score: 1
Accepted
time: 2ms
memory: 3868kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
0
0
0
1
0
1
1
0
0
1
1
1
0
1
0
0
0
1
1
0
0
0
1
0
0
1
1
1
0
0
1
1
1
1
0
0
0
0
0
1
0
0
1
1
0
1
1
1
1
0
1
1
1
1
1
0
1
0
0
1
1
0
0
0
1
0
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
0
1
1
0
1
0
0
1
0
0
1
0
1
0
0
1
0
1
0
0
0
0
1
1
0
0
1
1
1
1
1
0
0
0
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #19:

score: 1
Accepted
time: 4ms
memory: 3800kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
0
0
0
1
0
1
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
0
0
1
1
0
1
0
1
0
0
0
0
0
1
0
1
1
1
1
0
0
0
0
0
1
1
1
1
1
0
0
1
1
0
0
1
1
0
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1
1
1
0
0
0
1
0
1
0
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
0
0
1
0
0
0
1
1
0
0
1
0
1
0
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #20:

score: 1
Accepted
time: 6ms
memory: 3868kb

input:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
0
0
0
1
0
0
0
0
0
0
1
1
1
1
0
1
0
0
0
0
1
1
1
0
0
1
0
0
1
1
0
0
1
1
0
0
0
1
1
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
1
0
0
1
0
1
0
0
1
1
0
0
1
0
0
1
0
1
1
1
1
1
0
0
0
1
0
0
1
0
1
1
1
0
1
0
0
1
0
1
1
0
1
1
0
1
1
0
1
1
1
0
1
1
0
0
1
1
0
0
1
1
1
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Subtask #2:

score: 0
Wrong Answer

Test #21:

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

input:

0
1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
1
0
1
0
0
1
1
0
0
1
1
1
0
0
0
0
1
0
1
0
1
1
1
0
0
1
1
1
1
1
0
1
1
1
0
1
0
0
1
0
0
0
1
0
0
1
0
0
1
1
1
1
0
1
0
0
1
0
0
1
0
1
1
1
0
0
0
1
0
1
0
1
1
0
1
1
0
0
0
0
1
0
1
0
1
1
0
1
0
1
0
0
1
1
0
0
0
0
1
1
1
1
0
1
1
1
0
1
0
0
1
1
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #22:

score: 9
Accepted
time: 5ms
memory: 3776kb

input:

1
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
0
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
1
0
0
0
1
0
0
1
0
0
1
0
1
0
0
1
0
0
0
1
1
0
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
1
1
0
1
0
1
0
1
0
0
0
0
1
1
0
0
0
1
0
1
1
0
1
1
1
0
0
1
1
1
0
1
0
0
1
0
1
0
1
1
1
1
1
1
1
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #23:

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

input:

1
0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
0
1
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
1
1
1
1
0
1
0
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
1
1
0
1
0
0
1
1
0
0
1
0
0
1
1
1
1
0
0
1
0
0
1
1
1
1
0
0
0
0
0
1
1
1
0
1
0
1
1
1
0
0
0
1
0
1
0
0
0
0
1
0
1
0
1
1
0
1
0
0
0
0
0
0
1
0
1
1
1
1
1
0
1
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #24:

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

input:

0
0
1
1
1
1
0
0
1
1
0
1
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
0
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
1
1
0
1
0
1
1
0
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
0
1
0
1
0
1
1
1
1
0
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
0
0
0
0
0
1
1
0
1
0
1
0
0
1
1
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #25:

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

input:

0
0
0
0
1
0
1
1
0
1
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-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
1
0
0
1
1
0
1
1
1
0
0
0
1
0
0
0
0
0
1
0
1
1
1
0
1
1
0
1
0
0
1
1
1
1
0
0
1
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
1
1
0
1
0
0
1
1
0
0
1
1
1
0
0
1
1
0
1
0
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
0
0
0
1
0
0
1
1
1
1
0
1
1
1
0
1
1
1
1
0
1
1
1
1
0
1
1
0
0
1
1
1
0
1
1...

input:


output:

Accepted: 18 8361

result:

ok 

Test #26:

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

input:

1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
0
0
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
1
0
1
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
0
1
0
0
1
1
1
1
0
0
1
1
0
0
0
0
1
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
0
1
0
1
0
1
1
0
0
0
1
1
1
1
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
0
0...

input:


output:

Accepted: 18 8361

result:

ok 

Test #27:

score: 0
Wrong Answer
time: 4ms
memory: 3924kb

input:

1
1
0
1
1
1
0
0
1
1
0
1
0
0
0
0
0
0
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Wrong Answer [1]

result:

wrong answer 

Subtask #3:

score: 0
Wrong Answer

Test #38:

score: 8.195
Acceptable Answer
time: 52ms
memory: 14888kb

input:

0
0
1
1
0
0
0
0
1
1
0
1
0
0
1
1
1
0
-1
-1
-1

output:

-1
1
1
1
1
1
0
0
1
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
1
0
1
0
0
1
0
1
0
0
1
0
1
1
0
1
0
0
1
0
1
1
1
1
0
1
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
0
0
0
1
1
1
1
0
0
0
1
0
1
1
0
0
1
1
0
0
0
0
1
1
1
0
1
0
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #39:

score: 8.195
Acceptable Answer
time: 55ms
memory: 15052kb

input:

0
0
0
1
0
0
1
1
1
1
1
0
1
0
0
1
0
1
-1
-1
-1

output:

-1
1
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
1
1
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
1
1
0
0
0
1
1
1
0
1
1
0
1
0
0
0
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
0
1
1
0
1
1
0
1
0
0
0
0
1
0
0
1
1
0
0
0
1
1
1
1
0
1
1
1
0
0
1
0
0
0
1
0
1
0
1
1
1
1
1
0
0
0
1
0
1
0
1
0
0
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #40:

score: 8.195
Acceptable Answer
time: 77ms
memory: 15136kb

input:

1
0
1
0
0
1
0
0
0
0
1
1
1
0
1
1
0
0
-1
-1
-1

output:

-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
1
1
1
0
1
1
0
1
0
0
1
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
1
0
1
1
0
0
0
1
0
0
1
0
1
1
0
0
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
0
1
1
0
0
0
0
0
0
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
1
1
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #41:

score: 8.195
Acceptable Answer
time: 63ms
memory: 15156kb

input:

1
1
1
1
0
0
1
1
0
1
0
0
0
0
0
0
0
0
-1
-1
-1

output:

-1
1
1
1
0
1
1
0
0
1
1
1
1
0
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
1
1
1
0
0
0
0
1
0
1
1
0
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
0
0
0
0
1
1
0
1
0
1
0
1
0
1
0
1
1
1
1
0
0
1
1
1
0
0
0
0
1
0
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #42:

score: 8.195
Acceptable Answer
time: 76ms
memory: 15052kb

input:

0
1
0
0
1
0
1
0
1
1
1
1
1
0
0
1
1
0
-1
-1
-1

output:

-1
0
1
0
0
0
0
1
1
0
1
0
1
0
0
0
1
1
1
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #43:

score: 8.195
Acceptable Answer
time: 90ms
memory: 14900kb

input:

0
1
1
1
0
0
0
1
1
1
0
1
0
1
1
0
1
0
-1
-1
-1

output:

-1
1
1
0
0
1
1
1
0
0
0
1
1
1
0
0
1
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
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...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #44:

score: 8.195
Acceptable Answer
time: 76ms
memory: 15060kb

input:

0
0
1
0
0
1
0
0
0
1
1
1
1
0
0
0
1
1
-1
-1
-1

output:

-1
0
1
1
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
0
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
1
0
1
1
1
1
1
1
0
0
0
1
0
1
1
0
1
0
1
1
0
1
1
1
1
0
1
0
0
1
0
1
1
0
1
1
0
0
1
1
0
0
0
1
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
0
0
1
0
1
1
1
0
0
1
1
0
0
0
1
0
1
1
1
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #45:

score: 8.195
Acceptable Answer
time: 62ms
memory: 14988kb

input:

0
1
0
0
0
0
1
0
1
0
0
1
1
1
1
0
0
1
-1
-1
-1

output:

-1
1
1
0
0
1
0
1
0
0
0
1
1
1
1
0
0
0
1
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
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...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #46:

score: 8.195
Acceptable Answer
time: 56ms
memory: 14964kb

input:

0
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
-1
-1
-1

output:

-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
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
1
0
1
0
1
1
1
0
1
0
0
1
0
0
0
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
0
0
1
1
0
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
1
1
0
0
0
0
0
1
0
1
1
0
0
1
1
1
0
0
0
0
1
0
1
1
1
0
0
1
1
0
0
1
0
1
1
0
0
1
1
1
0
1
1
0
0
0
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #47:

score: 8.195
Acceptable Answer
time: 67ms
memory: 14968kb

input:

0
1
1
1
1
1
0
0
0
0
0
1
0
1
0
0
1
1
-1
-1
-1

output:

-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
1
0
1
1
1
0
0
1
1
1
1
1
1
1
0
0
0
0
0
0
1
0
0
1
0
0
1
0
1
1
0
0
1
1
1
0
1
0
1
1
0
1
0
1
0
1
1
1
0
0
1
0
1
0
0
1
0
0
1
0
1
1
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
0
1
0
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
0
1
1
0
0
1
1
0
0
1
0
0
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #48:

score: 8.195
Acceptable Answer
time: 65ms
memory: 15220kb

input:

0
1
1
1
0
1
1
0
1
0
0
1
0
1
1
0
0
0
-1
-1
-1

output:

-1
1
0
0
1
1
1
0
0
1
0
0
0
0
1
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
1
0
0
0
1
1
0
1
0
0
1
1
1
0
0
1
1
0
0
1
1
1
0
0
1
0
0
1
1
0
0
0
0
0
0
1
1
0
0
1
1
0
1
1
0
1
0
1
0
1
1
0
0
1
1
0
1
0
1
0
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
1
1
0
1
1
0
1
1
0
0
1
1
0
1
1
1
0
1
1
1
1
0
0
0
1
1
1
0
1
1
1
1
0
0
0
0
0
1
1
1
1
0
0
0
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #49:

score: 8.195
Acceptable Answer
time: 63ms
memory: 15000kb

input:

1
0
0
0
0
0
1
0
1
0
1
0
1
1
1
1
0
1
-1
-1
-1

output:

-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
1
0
1
1
0
0
0
0
1
1
0
0
0
0
0
1
1
1
0
0
1
1
0
0
1
1
0
0
0
1
1
1
1
1
1
1
0
1
0
1
1
1
0
1
0
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
1
1
1
1
0
0
0
0
0
0
1
1
1
1
0
0
1
0
1
1
1
0
0
0
1
0
0
1
1
1
0
0
0
0
1
0
1
0
1
0
1
1
1
0
1
1
0
1
0
0
0
0
1
0
1
0
1
0
0
1
1
1
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #50:

score: 8.195
Acceptable Answer
time: 64ms
memory: 15060kb

input:

1
1
0
1
0
1
0
0
1
0
1
1
0
0
0
0
1
0
-1
-1
-1

output:

-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
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
1
1
1
1
1
0
0
1
0
0
0
1
1
1
1
0
0
1
0
1
0
1
1
1
1
0
0
0
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
1
0
0
0
0
0
0
0
1
1
1
0
1
0
1
0
1
1
0
0
1
0
1
1
0
0
1
0
1
1
0
1
0
0
0
1
1
0
0
1
1
1
1
0
1
0
1
0
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #51:

score: 8.195
Acceptable Answer
time: 61ms
memory: 14964kb

input:

1
0
1
0
0
1
0
1
0
1
0
1
0
0
0
0
1
1
-1
-1
-1

output:

-1
0
0
0
1
0
1
1
0
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
0
0
0
1
0
0
1
0
1
1
0
0
0
1
1
0
1
0
0
1
1
0
1
1
0
0
0
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #52:

score: 8.195
Acceptable Answer
time: 51ms
memory: 15140kb

input:

1
0
0
1
0
0
1
0
0
1
0
0
0
0
0
0
1
1
-1
-1
-1

output:

-1
0
0
0
1
0
1
1
0
1
0
0
1
0
0
0
1
1
0
0
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
0
1
1
0
1
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
0
1
1
0
0
0
0
1
1
0
1
1
0
0
1
0
1
1
0
0
0
1
1
0
1
1
0
0
1
1
1
1
0
0...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #53:

score: 8.195
Acceptable Answer
time: 68ms
memory: 15220kb

input:

1
1
1
1
0
1
1
0
0
0
0
1
0
0
0
1
0
0
-1
-1
-1

output:

-1
0
1
0
1
0
1
1
1
0
0
1
0
1
0
0
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #54:

score: 8.195
Acceptable Answer
time: 71ms
memory: 15040kb

input:

0
1
1
1
0
1
1
1
0
0
0
1
1
0
1
1
1
0
-1
-1
-1

output:

-1
0
1
0
1
0
0
1
1
0
1
0
0
0
1
0
0
0
0
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #55:

score: 8.195
Acceptable Answer
time: 78ms
memory: 15048kb

input:

0
0
1
0
0
1
0
0
1
0
0
0
1
0
0
1
0
1
-1
-1
-1

output:

-1
1
0
0
1
0
1
0
1
0
0
0
0
1
1
0
0
1
1
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
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...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #56:

score: 8.195
Acceptable Answer
time: 65ms
memory: 14968kb

input:

1
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
1
-1
-1
-1

output:

-1
1
0
1
0
0
1
1
0
1
0
0
1
0
0
1
0
0
1
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
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...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #57:

score: 8.195
Acceptable Answer
time: 79ms
memory: 15048kb

input:

1
1
1
0
1
0
0
1
0
0
1
1
1
0
0
1
0
1
-1
-1
-1

output:

-1
1
0
1
0
0
0
1
1
1
0
1
1
0
0
0
1
0
1
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
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...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #58:

score: 8.195
Acceptable Answer
time: 71ms
memory: 14992kb

input:

0
1
0
1
1
0
0
0
0
1
0
1
1
0
0
1
0
0
-1
-1
-1

output:

-1
0
0
1
1
0
1
1
1
0
1
0
1
1
1
0
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #59:

score: 8.195
Acceptable Answer
time: 69ms
memory: 15148kb

input:

1
0
0
1
1
0
1
0
0
0
0
1
0
0
0
0
1
0
-1
-1
-1

output:

-1
0
0
1
0
1
0
1
1
1
0
0
1
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
1
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
1
0
0
1
0
0
1
1
1
0
0
0
0
1
0
1
1
1
0
0
1
0
0
0
1
0
0
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
1
0
1
0
0
0
1
0
0
0
1
0
1
1
0
1
1
0
1
1
0
1
0
1
1
0
0
0
0
0
1
1
1
1
0
0
1
0
1...

input:


output:

Accepted: 18 8361

result:

points 0.09105555560

Test #60:

score: 0
Wrong Answer
time: 66ms
memory: 15052kb

input:

0
1
0
0
0
0
1
0
0
1
0
1
0
0
1
1
1
1
-1
-1
-1

output:

-1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

input:


output:

Wrong Answer [1]

result:

wrong answer