QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#179013#3097. Shoppingznstz#1 137ms15208kbC++204.0kb2023-09-14 16:36:562024-07-04 02:44:35

詳細信息

Subtask #1:

score: 1
Accepted

Test #1:

score: 1
Accepted
time: 11ms
memory: 3944kb

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: 7ms
memory: 3980kb

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: 5896kb

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: 9ms
memory: 3908kb

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: 8ms
memory: 4212kb

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: 3ms
memory: 3892kb

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: 4ms
memory: 3928kb

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: 6ms
memory: 3880kb

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: 7ms
memory: 3820kb

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: 9ms
memory: 3892kb

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: 4148kb

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: 7ms
memory: 3884kb

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: 9ms
memory: 3824kb

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: 5ms
memory: 6192kb

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: 3ms
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
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: 4ms
memory: 3928kb

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: 4ms
memory: 3888kb

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: 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
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: 4ms
memory: 4148kb

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: 5ms
memory: 4132kb

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: 0ms
memory: 3784kb

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: 3ms
memory: 4120kb

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: 4136kb

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: 6ms
memory: 5912kb

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: 3896kb

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: 5ms
memory: 3932kb

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: 120ms
memory: 14852kb

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: 113ms
memory: 14960kb

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: 122ms
memory: 14852kb

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: 127ms
memory: 14972kb

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: 120ms
memory: 14828kb

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: 134ms
memory: 14792kb

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: 114ms
memory: 15208kb

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: 111ms
memory: 14912kb

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: 119ms
memory: 14948kb

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: 123ms
memory: 14764kb

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: 126ms
memory: 14836kb

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: 115ms
memory: 14820kb

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: 123ms
memory: 15016kb

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: 125ms
memory: 14816kb

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: 121ms
memory: 14968kb

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: 130ms
memory: 14948kb

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: 125ms
memory: 14832kb

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: 125ms
memory: 14904kb

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: 125ms
memory: 14964kb

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: 132ms
memory: 14752kb

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: 129ms
memory: 14860kb

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: 137ms
memory: 14768kb

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: 125ms
memory: 14968kb

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