QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#496642#7260. Ropesucup-team1005#AC ✓10ms3688kbC++20410b2024-07-28 14:12:372024-07-28 14:12:37

詳細信息

Test #1:

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

input:

9
1
3
2
1
3
1
2
1
2

output:

1260

result:

ok 1 number(s): "1260"

Test #2:

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

input:

9
1
2
1
1
3
2
1
3
2

output:

1260

result:

ok 1 number(s): "1260"

Test #3:

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

input:

5
3
3
3
3
3

output:

0

result:

ok 1 number(s): "0"

Test #4:

score: 0
Accepted
time: 7ms
memory: 3560kb

input:

100000
3
2
1
3
3
1
3
2
3
3
3
2
1
1
3
2
1
3
1
2
3
2
2
2
3
1
2
3
2
3
3
3
2
2
2
1
3
3
3
3
2
2
3
2
1
1
2
1
3
1
3
1
3
3
1
3
2
3
3
2
1
1
2
2
3
3
3
2
2
1
2
2
3
2
3
3
2
1
3
2
2
3
2
1
2
1
3
2
2
3
1
3
2
3
2
1
2
3
3
2
3
1
2
2
1
3
1
2
1
2
3
3
1
1
3
2
3
1
3
3
3
3
3
2
3
3
2
3
1
2
2
2
1
3
3
2
2
2
1
3
1
1
1
1
2
3
2...

output:

0

result:

ok 1 number(s): "0"

Test #5:

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

input:

100000
1
1
1
1
1
1
1
2
2
3
1
1
3
1
2
1
2
1
2
1
1
1
1
1
1
1
2
2
2
2
1
1
3
1
1
1
3
3
3
1
1
1
2
1
1
2
1
1
2
1
1
1
2
1
1
1
1
1
2
2
3
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
2
1
3
1
2
1
2
2
1
3
3
1
1
2
2
1
1
2
1
1
2
1
1
2
1
1
1
1
2
1
2
1
3
1
3
2
2
3
2
1
1
1
3
1
2
1
1
1
1
1
2
3
3
3
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

100000
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
2
1
1
1
2
1
1
1
3
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
3
1
1
1
1
1
2
1
1
2...

output:

0

result:

ok 1 number(s): "0"

Test #7:

score: 0
Accepted
time: 10ms
memory: 3672kb

input:

100000
2
3
1
2
3
2
2
2
2
2
2
2
1
3
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
1
3
2
2
3
2
1
2
2
2
2
3
2
2
1
2
2
2
2
2
2
2
3
1
2
1
3
1
2
2
2
1
2
3
1
2
2
3
2
3
2
2
2
2
2
3
3
2
2
1
3
2
2
2
2
2
3
2
2
2
1
1
3
2
3
2
2
1
3
1
2
3
2
3
2
2
2
2
2
2
2
2
2
1
2
1
3
2
2
2
3
2
2
2
2
3
1
3
3
2
2
2
1
2
3
2
2
2
3
3
1
2
2...

output:

0

result:

ok 1 number(s): "0"

Test #8:

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

input:

100000
2
2
3
3
3
1
1
2
1
2
3
1
3
1
1
2
3
1
3
1
3
1
2
2
1
2
3
1
3
2
2
1
3
3
3
1
2
3
3
3
2
3
3
2
2
3
1
3
3
3
1
2
3
3
1
1
3
3
2
2
1
2
2
3
1
3
2
3
1
3
1
3
1
3
1
1
3
3
3
3
2
3
3
2
1
1
1
2
1
3
1
3
1
2
2
2
3
3
3
2
3
1
3
2
3
3
3
3
2
2
1
1
2
2
3
2
2
1
2
3
1
3
3
1
1
3
1
3
3
2
1
3
3
2
2
3
3
2
2
1
1
1
2
3
3
1
3...

output:

0

result:

ok 1 number(s): "0"

Test #9:

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

input:

100000
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
2
1
1
1
2
2
1
1
1
2
2
1
1
1
1
2
1
1
2
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
1
2
1
3
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
3
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
3
1
2
1
1
1
1
1
2
1
1
1
1
1
1
2
2
2
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

100000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
3
1
1
1
1
1
3
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #11:

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

input:

100000
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
3
3
3
2
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
1
1
1
3
1
1
2
3
1
1
1
1
1
1
1
3
2
1
1
1
1
3
1
2
3
1
3
1
1
1
1
1
1
1
1
2
3
1
1
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
1
1
1
1
1
3
1
1
1
1
1
1
1
3...

output:

0

result:

ok 1 number(s): "0"

Test #12:

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

input:

100000
3
1
1
1
1
1
1
1
1
1
1
3
1
3
3
1
3
1
3
1
1
3
3
3
1
3
1
3
3
1
3
3
3
1
3
3
1
1
1
1
1
3
1
1
1
1
1
1
3
3
2
3
3
3
1
3
1
3
1
3
3
1
3
3
1
1
1
3
1
2
3
1
3
1
1
1
3
1
3
1
1
1
3
1
1
1
1
1
1
3
1
1
1
1
3
1
3
1
3
1
1
3
1
3
3
1
3
1
1
1
3
3
1
1
2
3
3
1
3
3
2
3
3
1
3
3
1
1
1
1
1
1
3
3
1
1
1
1
1
1
1
1
3
1
3
1
1...

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

100000
1
3
1
1
1
1
3
1
1
2
1
1
1
3
2
1
3
1
3
3
2
2
3
2
2
2
3
1
3
3
3
1
1
1
3
2
2
2
1
1
2
3
1
1
1
1
1
1
3
2
2
1
3
2
1
1
1
1
1
1
1
3
1
2
1
2
3
1
1
1
3
3
2
1
1
2
2
2
2
1
1
1
1
1
1
3
3
1
1
1
1
1
1
2
1
2
3
2
2
1
1
3
1
1
1
1
2
2
2
1
1
1
1
3
2
1
1
1
3
3
1
1
1
2
1
3
1
2
3
1
1
2
1
2
1
1
1
2
1
1
1
1
2
1
1
3
2...

output:

0

result:

ok 1 number(s): "0"

Test #14:

score: 0
Accepted
time: 10ms
memory: 3540kb

input:

100000
2
1
1
1
1
3
3
1
1
1
1
1
3
3
1
2
3
1
2
1
1
3
1
3
2
3
2
3
1
1
2
2
1
1
1
1
2
2
2
2
3
3
3
1
3
1
1
1
1
2
3
1
3
1
1
1
3
2
3
1
1
2
3
2
2
1
1
1
1
2
2
1
3
3
1
3
1
2
3
2
3
1
1
3
3
3
2
3
3
1
2
1
1
3
1
3
2
3
1
1
2
1
1
3
3
1
1
3
1
3
1
1
3
3
3
2
1
3
1
1
3
3
2
2
3
3
3
1
1
2
3
1
1
1
2
3
2
3
3
1
3
2
3
3
3
3
1...

output:

919886418

result:

ok 1 number(s): "919886418"

Test #15:

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

input:

100000
2
2
2
2
1
2
3
2
2
2
2
3
3
1
2
2
2
2
2
2
3
2
2
2
3
2
2
1
2
2
2
3
2
2
2
2
2
2
2
3
3
1
2
2
3
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
1
1
3
2
3
2
2
2
1
2
2
1
2
1
3
2
2
1
1
2
1
1
1
2
2
2
3
2
2
2
2
2
2
3
2
2
2
2
2
2
1
3
1
2
1
2
1
2
2
3
3
2
3
2
2
3
2
2
3
2
3
2
2
3
2
3
2
3
2
2
2
2
1
2
1
2
2
3
2
1...

output:

148292810

result:

ok 1 number(s): "148292810"

Test #16:

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

input:

100000
2
1
3
3
2
2
1
2
2
2
2
2
2
2
2
1
1
2
2
1
2
1
3
3
1
2
2
1
3
2
3
2
1
2
1
2
2
1
1
2
1
3
2
3
1
2
3
2
1
1
1
3
3
2
1
1
3
3
3
2
1
3
2
3
3
1
2
1
3
2
3
2
2
2
1
1
2
2
1
2
2
2
2
2
1
3
3
1
2
2
2
3
2
3
3
2
2
3
2
2
1
2
3
2
3
2
3
2
1
2
3
1
2
2
2
1
2
1
3
3
2
2
2
2
3
2
3
1
2
2
2
2
2
2
3
2
1
3
3
3
3
2
2
2
2
3
2...

output:

450813336

result:

ok 1 number(s): "450813336"

Test #17:

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

input:

100000
2
2
2
3
3
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

437199404

result:

ok 1 number(s): "437199404"

Test #18:

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

input:

100000
2
2
2
2
2
1
2
3
2
2
1
2
2
2
2
2
1
1
2
2
3
2
3
2
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
3
2
2
2
2
3
2
2
2
2
2
3
2
3
2
3
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2...

output:

834463090

result:

ok 1 number(s): "834463090"

Test #19:

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

input:

100000
2
1
2
1
3
1
1
3
2
3
3
1
2
2
1
2
2
1
2
2
2
3
2
1
3
2
3
1
2
1
2
2
1
2
2
2
3
3
2
2
3
3
2
1
2
2
2
3
2
3
2
3
1
2
3
3
2
1
3
2
2
2
3
2
2
2
1
2
1
2
3
1
2
2
2
1
2
2
3
2
2
2
2
1
2
2
3
2
2
2
1
2
2
2
3
3
2
2
2
2
2
2
2
2
2
2
3
2
1
2
2
1
2
2
3
2
1
2
3
2
3
2
2
1
2
2
2
1
2
2
2
2
2
2
2
1
3
1
3
2
2
3
2
1
3
2
2...

output:

464088820

result:

ok 1 number(s): "464088820"

Test #20:

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

input:

100000
3
1
3
3
3
3
2
3
2
3
2
1
3
2
1
2
2
1
1
2
2
2
3
2
2
2
3
3
1
2
2
1
2
2
1
3
1
2
3
1
1
1
2
2
3
2
3
3
3
3
2
2
2
3
2
2
2
3
3
3
2
2
2
2
2
3
3
2
2
2
2
2
3
1
2
1
2
1
3
2
2
2
2
2
2
2
3
2
3
2
3
1
1
3
3
2
3
1
1
3
3
1
3
2
1
3
2
3
3
3
2
2
1
2
1
2
2
2
1
1
2
2
1
2
3
3
2
2
2
2
2
3
1
2
2
2
2
2
1
2
2
3
2
2
2
2
1...

output:

658273751

result:

ok 1 number(s): "658273751"

Test #21:

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

input:

100000
1
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
3
2
3
1
2
2
2
2
3
2
2
2
2
2
3
2
2
3
2
2
2
3
2
2
3
3
2
2
2
2
2
2
2
1
3
2
2
1
3
2
1
2
2
2
2
2
2
2
3
2
2
1
2
2
2
2
2
2
2
1
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
3
2
2
1
2
2
3
3
2
3
3
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
1
3
3
2
2
3
2
2
2
1
3
2
2
2
2
2
2
2
2...

output:

749020002

result:

ok 1 number(s): "749020002"

Test #22:

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

input:

100000
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
3
1
2
3
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
3
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
1
1
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
3
2
2
2
2
3
2
2
2
3
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
2
2
2
2
2
2
2
2
2
2
2
2
1...

output:

126071466

result:

ok 1 number(s): "126071466"

Test #23:

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

input:

100000
3
1
1
3
1
3
2
1
3
1
3
1
1
3
3
3
1
3
1
1
1
3
2
1
3
1
1
3
1
3
3
1
1
3
2
1
3
3
1
1
3
3
1
1
1
1
1
1
2
1
2
1
3
2
1
1
1
1
1
1
1
3
3
3
1
1
3
1
2
2
3
1
3
1
3
1
2
3
3
2
3
2
1
3
3
3
3
2
1
3
3
3
3
1
1
3
3
3
3
3
3
2
3
1
2
2
1
1
3
3
1
3
3
2
1
3
2
1
3
1
1
3
1
3
3
3
1
2
3
2
1
1
1
1
1
1
3
3
3
1
3
2
3
3
3
3
2...

output:

815045464

result:

ok 1 number(s): "815045464"

Test #24:

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

input:

1331
2
2
3
2
1
2
3
2
2
2
2
3
1
2
2
2
2
3
2
2
3
2
1
3
2
2
3
2
3
3
2
2
3
2
2
1
2
1
1
2
2
1
2
2
3
2
1
2
2
3
1
3
2
1
2
3
1
1
2
2
2
3
2
1
2
1
1
2
2
3
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
1
1
2
2
3
2
2
1
2
1
2
2
2
2
2
2
2
1
1
1
2
2
2
3
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
3
1
1
2
1
1
3
2
1
2
1
3
2
2
2
2
2
3
2...

output:

818233920

result:

ok 1 number(s): "818233920"

Test #25:

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

input:

385
1
1
2
2
2
1
2
3
3
1
1
2
2
3
2
1
3
2
2
2
3
2
3
2
1
3
3
1
2
2
3
3
3
1
2
3
2
3
1
2
2
3
2
3
3
1
1
3
2
1
1
3
3
1
2
3
1
1
2
1
1
1
2
3
1
3
2
2
2
2
1
3
1
2
2
1
1
1
3
2
3
3
1
1
3
2
2
3
2
1
1
3
1
3
3
1
3
3
2
3
3
3
1
2
2
3
3
2
3
2
3
2
1
1
3
2
2
2
3
3
1
2
1
3
1
3
3
2
2
3
3
3
1
1
3
3
1
3
2
3
2
1
3
1
2
1
1
3
...

output:

467384285

result:

ok 1 number(s): "467384285"

Test #26:

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

input:

2065
3
1
1
3
3
3
2
1
2
2
1
3
3
1
2
1
2
1
2
3
1
1
3
2
3
1
3
3
3
3
3
3
3
1
1
1
1
2
3
3
2
3
3
3
1
3
3
1
1
3
3
2
1
3
3
3
2
2
3
3
1
1
3
3
2
3
1
3
3
3
2
3
1
3
2
1
3
1
3
1
3
1
3
1
3
3
1
2
1
1
3
3
1
3
1
3
3
3
1
3
3
1
1
3
3
3
3
2
3
2
3
3
3
3
1
3
3
1
3
3
3
1
3
2
2
3
3
3
3
1
3
1
1
2
1
1
3
3
3
1
3
1
1
2
3
1
1
3...

output:

188426891

result:

ok 1 number(s): "188426891"

Test #27:

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

input:

43
1
3
1
1
1
1
2
1
2
3
3
3
1
3
2
1
1
3
2
2
3
2
2
3
3
1
1
3
1
1
1
3
3
3
1
1
3
1
1
2
2
3
3

output:

657497820

result:

ok 1 number(s): "657497820"

Test #28:

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

input:

561
2
3
3
1
1
2
1
1
2
1
1
2
2
2
2
2
3
2
3
1
3
1
1
1
2
2
2
2
1
2
1
1
1
2
2
3
2
2
1
3
2
1
3
2
1
1
1
1
1
2
2
2
2
1
2
1
1
3
1
2
1
2
1
1
1
2
3
2
3
3
1
2
2
2
2
2
3
1
1
1
3
3
2
1
2
3
3
2
3
3
2
2
2
3
2
1
2
1
2
1
2
1
2
2
3
2
2
2
3
2
1
2
2
3
3
1
3
2
2
2
3
2
3
3
3
2
3
2
1
1
3
1
2
3
2
1
1
3
2
1
1
1
3
3
1
1
1
2
...

output:

479845932

result:

ok 1 number(s): "479845932"

Test #29:

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

input:

2
1
2

output:

0

result:

ok 1 number(s): "0"

Test #30:

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

input:

7
1
1
3
3
1
1
2

output:

30

result:

ok 1 number(s): "30"

Test #31:

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

input:

130
2
1
2
2
3
2
2
1
2
1
2
3
3
2
2
1
1
3
3
1
2
1
2
3
2
1
2
2
3
1
2
1
2
3
2
1
2
2
2
2
2
1
1
3
3
1
2
1
2
2
2
2
1
2
3
1
1
3
2
3
1
3
3
3
1
1
2
1
2
1
3
3
2
2
2
1
1
2
3
1
2
1
2
1
2
2
2
2
2
3
3
3
2
2
3
3
2
3
1
3
2
3
2
1
1
1
1
2
3
2
2
1
2
1
2
3
1
2
2
2
3
2
3
2
3
3
2
2
2
3

output:

297870439

result:

ok 1 number(s): "297870439"

Test #32:

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

input:

8417
2
1
1
3
1
3
3
3
3
1
3
1
1
3
1
3
3
3
3
1
3
3
3
1
3
1
3
3
1
1
1
3
1
3
3
1
1
3
1
1
3
3
3
1
1
3
3
1
1
3
3
3
3
3
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
2
1
3
3
3
1
3
1
3
1
3
3
3
3
1
1
1
1
2
3
3
1
3
1
3
3
1
3
3
1
3
1
3
1
3
1
1
1
1
3
3
1
3
1
1
1
1
1
1
3
3
3
1
3
3
1
3
1
3
1
1
1
3
1
1
3
1
1
3
2
3
1
3
1
1
3
2
3...

output:

380707477

result:

ok 1 number(s): "380707477"

Test #33:

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

input:

6433
2
3
2
3
2
3
1
3
3
2
2
1
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
1
2
3
1
2
2
2
3
2
2
3
2
2
3
3
3
1
2
2
3
1
2
3
2
2
2
2
1
2
2
2
3
2
2
2
2
2
2
2
2
1
3
2
2
1
1
1
2
2
2
2
1
2
2
2
1
2
2
3
2
3
1
2
3
3
3
3
2
2
2
2
2
1
3
3
1
2
1
2
1
2
2
2
2
1
3
1
2
1
2
2
2
3
2
3
1
3
2
2
3
2
2
3
2
2
2
2
2
2
3
3...

output:

30227426

result:

ok 1 number(s): "30227426"

Test #34:

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

input:

100000
3
1
3
1
1
1
3
1
3
3
3
3
1
1
1
1
3
1
3
1
3
3
1
3
3
1
1
1
1
3
1
1
1
1
3
3
1
1
3
1
1
1
3
1
1
1
3
3
3
1
3
1
1
1
3
3
3
3
1
3
1
3
1
1
1
1
3
1
1
1
3
3
1
1
3
1
1
1
1
1
3
1
3
1
3
3
3
1
1
1
3
3
1
3
1
3
1
3
3
3
3
3
3
3
3
1
3
3
3
1
1
3
1
1
3
1
1
3
1
3
1
1
3
3
1
3
3
1
3
1
3
1
3
1
1
3
1
3
1
3
1
1
1
3
1
3
1...

output:

320555407

result:

ok 1 number(s): "320555407"

Test #35:

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

input:

100000
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

248941163

result:

ok 1 number(s): "248941163"