QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#430229#4565. Rarest Insectsucup-team267999.89 18ms4220kbC++171.5kb2024-06-03 16:16:352024-06-03 16:16:35

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
2
1
2
2
2
2
3

output:

8
0 2
8
2
8
0 0
8
2
8
0 3
8
2
8
1 3
8
0 1
8
2
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 3
8
2
8
0 4
8
2
8
0 5
8
2
8
1 5
8
1 3
8
1 4
8
3 1

result:

ok 

Test #2:

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

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
1
2
2
2
2
3

output:

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

result:

ok 

Test #6:

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

input:

8
1
1
2
2
2
2
1
2
2
3
3
3
2

output:

8
0 2
8
2
8
0 0
8
2
8
0 3
8
2
8
1 3
8
0 1
8
2
8
1 1
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 7
8
2
8
0 6
8
2
8
1 6
8
0 3
8
2
8
0 1
8
2
8
1 1
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 6
8
2
8
1 3
8
1 6
8
3 1

result:

ok 

Test #7:

score: 10
Accepted
time: 2ms
memory: 3972kb

input:

199
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
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:

8
0 3
8
2
8
0 73
8
2
8
1 73
8
0 65
8
2
8
1 65
8
0 159
8
2
8
1 159
8
0 140
8
2
8
1 140
8
0 182
8
2
8
1 182
8
0 8
8
2
8
1 8
8
0 185
8
2
8
1 185
8
0 24
8
2
8
1 24
8
0 170
8
2
8
1 170
8
0 176
8
2
8
1 176
8
0 94
8
2
8
1 94
8
0 153
8
2
8
1 153
8
0 177
8
2
8
1 177
8
0 194
8
2
8
1 194
8
0 172
8
2
8
1 172
8
...

result:

ok 

Test #8:

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

input:

200
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
0 126
8
2
8
0 156
8
2
8
0 59
8
2
8
0 184
8
2
8
0 103
8
2
8
0 95
8
2
8
0 53
8
2
8
0 32
8
2
8
0 152
8
2
8
0 176
8
2
8
0 58
8
2
8
0 65
8
2
8
0 2
8
2
8
0 112
8
2
8
0 75
8
2
8
0 155
8
2
8
0 197
8
2
8
0 160
8
2
8
0 167
8
2
8
0 196
8
2
8
0 33
8
2
8
0 47
8
2
8
...

result:

ok 

Test #9:

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

input:

200
1
1
1
1
1
2
1
1
1
2
1
1
2
2
2
2
1
1
2
1
2
2
2
2
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
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:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
0 126
8
2
8
0 156
8
2
8
1 156
8
0 59
8
2
8
0 184
8
2
8
0 103
8
2
8
0 95
8
2
8
1 95
8
0 53
8
2
8
0 32
8
2
8
0 152
8
2
8
1 152
8
0 176
8
2
8
1 176
8
0 58
8
2
8
1 58
8
0 65
8
2
8
1 65
8
0 2
8
2
8
0 112
8
2
8
0 75
8
2
8
1 75
8
0 155
8
2
8
0 197
8
2
8
1 197
...

result:

ok 

Test #10:

score: 10
Accepted
time: 5ms
memory: 3908kb

input:

198
1
1
1
1
1
2
1
2
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
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
1
2
2
1
2
2
2
2
2
2
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
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:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
0 126
8
2
8
0 156
8
2
8
1 156
8
0 59
8
2
8
0 184
8
2
8
1 184
8
0 103
8
2
8
0 95
8
2
8
0 53
8
2
8
1 53
8
0 32
8
2
8
0 152
8
2
8
1 152
8
0 176
8
2
8
0 58
8
2
8
1 58
8
0 65
8
2
8
1 65
8
0 2
8
2
8
1 2
8
0 112
8
2
8
1 112
8
0 75
8
2
8
1 75
8
0 155
8
2
8
1 15...

result:

ok 

Test #11:

score: 10
Accepted
time: 3ms
memory: 3900kb

input:

199
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
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:

8
0 3
8
2
8
0 73
8
2
8
1 73
8
0 65
8
2
8
1 65
8
0 159
8
2
8
1 159
8
0 140
8
2
8
1 140
8
0 182
8
2
8
1 182
8
0 8
8
2
8
1 8
8
0 185
8
2
8
1 185
8
0 24
8
2
8
1 24
8
0 170
8
2
8
1 170
8
0 176
8
2
8
1 176
8
0 94
8
2
8
1 94
8
0 153
8
2
8
1 153
8
0 177
8
2
8
1 177
8
0 194
8
2
8
1 194
8
0 172
8
2
8
1 172
8
...

result:

ok 

Test #12:

score: 10
Accepted
time: 2ms
memory: 3940kb

input:

197
1
2
2
1
1
2
1
1
1
1
2
1
1
2
1
1
1
2
1
2
1
2
1
1
1
2
2
2
2
1
2
2
2
2
1
1
1
1
2
2
2
2
1
1
1
2
2
2
1
1
2
1
2
2
2
1
1
2
2
2
2
1
1
1
2
2
2
2
2
1
2
2
1
2
1
2
1
2
1
1
1
1
2
1
2
1
1
2
1
2
2
1
2
1
1
2
1
2
1
2
2
1
2
1
2
1
1
2
2
2
2
2
2
2
1
1
2
1
1
1
1
2
2
2
2
1
2
2
2
2
2
1
2
1
1
1
1
1
1
1
1
2
1
2
2
1
2
2
...

output:

8
0 3
8
2
8
0 73
8
2
8
1 73
8
0 65
8
2
8
1 65
8
0 159
8
2
8
0 140
8
2
8
0 182
8
2
8
1 182
8
0 8
8
2
8
0 185
8
2
8
0 24
8
2
8
0 170
8
2
8
0 176
8
2
8
1 176
8
0 94
8
2
8
0 153
8
2
8
0 177
8
2
8
1 177
8
0 194
8
2
8
0 172
8
2
8
0 82
8
2
8
0 113
8
2
8
1 113
8
0 66
8
2
8
0 120
8
2
8
1 120
8
0 30
8
2
8
0 1...

result:

ok 

Test #13:

score: 10
Accepted
time: 3ms
memory: 3940kb

input:

197
1
1
1
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
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
1
2
2
2
2
2
2
2
2
2
...

output:

8
0 3
8
2
8
0 73
8
2
8
0 65
8
2
8
0 159
8
2
8
1 159
8
0 140
8
2
8
1 140
8
0 182
8
2
8
0 8
8
2
8
1 8
8
0 185
8
2
8
1 185
8
0 24
8
2
8
1 24
8
0 170
8
2
8
1 170
8
0 176
8
2
8
1 176
8
0 94
8
2
8
1 94
8
0 153
8
2
8
1 153
8
0 177
8
2
8
1 177
8
0 194
8
2
8
1 194
8
0 172
8
2
8
1 172
8
0 82
8
2
8
1 82
8
0 11...

result:

ok 

Test #14:

score: 10
Accepted
time: 3ms
memory: 3968kb

input:

198
1
1
1
1
2
2
1
2
1
2
1
1
2
2
2
2
2
2
1
2
2
1
1
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
0 126
8
2
8
1 126
8
0 156
8
2
8
1 156
8
0 59
8
2
8
0 184
8
2
8
1 184
8
0 103
8
2
8
0 95
8
2
8
1 95
8
0 53
8
2
8
0 32
8
2
8
0 152
8
2
8
1 152
8
0 176
8
2
8
1 176
8
0 58
8
2
8
1 58
8
0 65
8
2
8
1 65
8
0 2
8
2
8
1 2
8
0 112
8
2
8
1 112
8
0 75
8
2
8
0 155
8...

result:

ok 

Test #15:

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

input:

200
1
1
2
2
2
1
1
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
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:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
1 64
8
0 158
8
2
8
1 158
8
0 126
8
2
8
1 126
8
0 156
8
2
8
0 59
8
2
8
0 184
8
2
8
1 184
8
0 103
8
2
8
1 103
8
0 95
8
2
8
1 95
8
0 53
8
2
8
1 53
8
0 32
8
2
8
0 152
8
2
8
1 152
8
0 176
8
2
8
1 176
8
0 58
8
2
8
1 58
8
0 65
8
2
8
1 65
8
0 2
8
2
8
1 2
8
0 112
8
2
8
1 11...

result:

ok 

Test #16:

score: 10
Accepted
time: 4ms
memory: 3900kb

input:

196
1
1
1
1
1
2
2
2
2
1
2
2
2
1
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
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:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
0 126
8
2
8
0 156
8
2
8
1 156
8
0 59
8
2
8
1 59
8
0 184
8
2
8
1 184
8
0 103
8
2
8
1 103
8
0 95
8
2
8
0 53
8
2
8
1 53
8
0 32
8
2
8
1 32
8
0 152
8
2
8
1 152
8
0 176
8
2
8
0 58
8
2
8
1 58
8
0 65
8
2
8
0 2
8
2
8
1 2
8
0 112
8
2
8
1 112
8
0 75
8
2
8
1 75
8
0...

result:

ok 

Test #17:

score: 10
Accepted
time: 4ms
memory: 3908kb

input:

199
1
1
1
2
2
1
2
1
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
1
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
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:

8
0 3
8
2
8
0 73
8
2
8
0 65
8
2
8
0 159
8
2
8
1 159
8
0 140
8
2
8
1 140
8
0 182
8
2
8
0 8
8
2
8
1 8
8
0 185
8
2
8
0 24
8
2
8
0 170
8
2
8
1 170
8
0 176
8
2
8
1 176
8
0 94
8
2
8
0 153
8
2
8
1 153
8
0 177
8
2
8
1 177
8
0 194
8
2
8
1 194
8
0 172
8
2
8
1 172
8
0 82
8
2
8
1 82
8
0 113
8
2
8
0 66
8
2
8
1 6...

result:

ok 

Test #18:

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

input:

196
1
1
2
1
1
1
2
1
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
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
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:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
1 64
8
0 158
8
2
8
0 126
8
2
8
0 156
8
2
8
0 59
8
2
8
1 59
8
0 184
8
2
8
0 103
8
2
8
0 95
8
2
8
0 53
8
2
8
0 32
8
2
8
1 32
8
0 152
8
2
8
1 152
8
0 176
8
2
8
1 176
8
0 58
8
2
8
0 65
8
2
8
1 65
8
0 2
8
2
8
1 2
8
0 112
8
2
8
1 112
8
0 75
8
2
8
1 75
8
0 155
8
2
8
1 155...

result:

ok 

Test #19:

score: 10
Accepted
time: 4ms
memory: 3916kb

input:

196
1
1
1
2
1
1
1
2
1
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
1
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
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
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:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
1 158
8
0 126
8
2
8
0 156
8
2
8
0 59
8
2
8
0 184
8
2
8
1 184
8
0 103
8
2
8
0 95
8
2
8
0 53
8
2
8
1 53
8
0 32
8
2
8
1 32
8
0 152
8
2
8
1 152
8
0 176
8
2
8
0 58
8
2
8
1 58
8
0 65
8
2
8
0 2
8
2
8
1 2
8
0 112
8
2
8
1 112
8
0 75
8
2
8
1 75
8
0 155
8
2
8
0 84...

result:

ok 

Test #20:

score: 10
Accepted
time: 3ms
memory: 3936kb

input:

196
1
1
1
2
1
2
1
2
1
1
1
2
1
2
2
1
2
2
1
1
1
1
2
1
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
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
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:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
1 158
8
0 126
8
2
8
0 156
8
2
8
1 156
8
0 59
8
2
8
0 184
8
2
8
1 184
8
0 103
8
2
8
0 95
8
2
8
0 53
8
2
8
0 32
8
2
8
1 32
8
0 152
8
2
8
0 176
8
2
8
1 176
8
0 58
8
2
8
1 58
8
0 65
8
2
8
0 2
8
2
8
1 2
8
0 112
8
2
8
1 112
8
0 75
8
2
8
0 155
8
2
8
0 84
8
2
8...

result:

ok 

Test #21:

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

input:

200
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
2
1
2
1
2
2
1
1
1
2
1
1
1
2
1
1
1
2
2
2
1
1
1
2
1
2
1
2
2
1
2
1
2
2
2
2
1
2
1
2
2
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
1
2
1
1
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
2
2
2
2
2
2
1
1
2
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
...

output:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
0 126
8
2
8
0 156
8
2
8
0 59
8
2
8
0 184
8
2
8
0 103
8
2
8
0 95
8
2
8
0 53
8
2
8
0 32
8
2
8
1 32
8
0 152
8
2
8
1 152
8
0 176
8
2
8
0 58
8
2
8
0 65
8
2
8
0 2
8
2
8
0 112
8
2
8
1 112
8
0 75
8
2
8
0 155
8
2
8
1 155
8
0 197
8
2
8
0 160
8
2
8
1 160
8
0 167
8...

result:

ok 

Test #22:

score: 10
Accepted
time: 2ms
memory: 3900kb

input:

199
1
1
1
1
2
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
2
1
1
2
2
1
1
1
1
2
1
1
1
1
1
1
2
1
2
2
1
1
2
2
1
1
1
2
1
2
1
2
2
1
1
1
1
2
1
2
1
2
2
2
1
1
2
1
2
1
1
1
1
1
2
2
2
2
1
2
1
2
2
1
2
1
1
2
2
2
1
1
1
1
2
2
2
1
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
...

output:

8
0 3
8
2
8
0 73
8
2
8
0 65
8
2
8
0 159
8
2
8
0 140
8
2
8
1 140
8
0 182
8
2
8
0 8
8
2
8
0 185
8
2
8
0 24
8
2
8
0 170
8
2
8
0 176
8
2
8
0 94
8
2
8
0 153
8
2
8
1 153
8
0 177
8
2
8
0 194
8
2
8
1 194
8
0 172
8
2
8
0 82
8
2
8
0 113
8
2
8
1 113
8
0 66
8
2
8
0 120
8
2
8
0 30
8
2
8
0 161
8
2
8
0 121
8
2
8
0...

result:

ok 

Test #23:

score: 10
Accepted
time: 2ms
memory: 4164kb

input:

198
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
1
2
1
1
1
1
1
2
1
2
1
2
1
1
1
1
1
2
1
1
1
1
2
1
1
1
2
1
1
1
2
2
2
1
1
2
2
1
1
2
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
2
1
2
2
2
1
1
1
2
2
1
1
2
1
1
1
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
1
2
2
1
2
1
1
1
2
1
2
...

output:

8
0 9
8
2
8
0 149
8
2
8
0 64
8
2
8
0 158
8
2
8
0 126
8
2
8
0 156
8
2
8
0 59
8
2
8
0 184
8
2
8
0 103
8
2
8
0 95
8
2
8
0 53
8
2
8
0 32
8
2
8
0 152
8
2
8
0 176
8
2
8
1 176
8
0 58
8
2
8
0 65
8
2
8
1 65
8
0 2
8
2
8
0 112
8
2
8
0 75
8
2
8
0 155
8
2
8
0 197
8
2
8
0 160
8
2
8
0 167
8
2
8
1 167
8
0 196
8
2
8...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 2ms
memory: 3880kb

input:

1000
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
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:

8
0 320
8
2
8
0 149
8
2
8
1 149
8
0 394
8
2
8
1 394
8
0 705
8
2
8
1 705
8
0 643
8
2
8
1 643
8
0 344
8
2
8
1 344
8
0 693
8
2
8
1 693
8
0 922
8
2
8
1 922
8
0 103
8
2
8
1 103
8
0 95
8
2
8
1 95
8
0 216
8
2
8
1 216
8
0 642
8
2
8
1 642
8
0 473
8
2
8
1 473
8
0 340
8
2
8
1 340
8
0 476
8
2
8
1 476
8
0 428
8
...

result:

ok 

Test #25:

score: 15
Accepted
time: 6ms
memory: 3848kb

input:

1000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 320
8
2
8
0 149
8
2
8
0 394
8
2
8
0 705
8
2
8
0 643
8
2
8
0 344
8
2
8
0 693
8
2
8
0 922
8
2
8
0 103
8
2
8
0 95
8
2
8
0 216
8
2
8
0 642
8
2
8
0 473
8
2
8
0 340
8
2
8
0 476
8
2
8
0 428
8
2
8
0 945
8
2
8
0 364
8
2
8
0 75
8
2
8
0 695
8
2
8
0 706
8
2
8
0 459
8
2
8
0 599
8
2
8
0 828
8
2
8
0 863
8
2
8
...

result:

ok 

Test #26:

score: 15
Accepted
time: 0ms
memory: 3876kb

input:

999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
2
1
2
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
1
2
1
2
2
2
2
2
1
2
2
2
2
1
2
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
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
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 364
8
2
8
0 101
8
2
8
0 566
8
2
8
0 454
8
2
8
0 565
8
2
8
0 808
8
2
8
0 107
8
2
8
0 167
8
2
8
0 187
8
2
8
0 311
8
2
8
0 166
8
2
8
0 649
8
2
8
0 724
8
2
8
0 570
8
2
8
0 737
8
2
8
1 737
8
0 424
8
2
8
1 424
8
0 104
8
2
8
0 765
8
2
8
1 765
8
0 94
8
2
8
0 387
8
2
8
0 994
8
2
8
0 837
8
2
8
1 837
8
0 3...

result:

ok 

Test #27:

score: 15
Accepted
time: 4ms
memory: 3908kb

input:

999
1
1
2
1
1
1
1
1
1
1
2
2
1
2
1
2
1
2
2
2
1
1
2
1
1
1
1
2
1
2
1
2
2
1
2
2
1
2
2
2
2
1
2
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
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
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
2
2
2
2
2
2
2
2
...

output:

8
0 364
8
2
8
0 101
8
2
8
0 566
8
2
8
1 566
8
0 454
8
2
8
0 565
8
2
8
0 808
8
2
8
0 107
8
2
8
0 167
8
2
8
0 187
8
2
8
0 311
8
2
8
0 166
8
2
8
1 166
8
0 649
8
2
8
1 649
8
0 724
8
2
8
0 570
8
2
8
1 570
8
0 737
8
2
8
0 424
8
2
8
1 424
8
0 104
8
2
8
0 765
8
2
8
1 765
8
0 94
8
2
8
1 94
8
0 387
8
2
8
1 38...

result:

ok 

Test #28:

score: 15
Accepted
time: 2ms
memory: 3984kb

input:

996
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
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:

8
0 189
8
2
8
0 233
8
2
8
1 233
8
0 361
8
2
8
1 361
8
0 564
8
2
8
1 564
8
0 661
8
2
8
1 661
8
0 490
8
2
8
1 490
8
0 237
8
2
8
1 237
8
0 166
8
2
8
1 166
8
0 407
8
2
8
1 407
8
0 575
8
2
8
1 575
8
0 157
8
2
8
1 157
8
0 648
8
2
8
1 648
8
0 153
8
2
8
1 153
8
0 75
8
2
8
1 75
8
0 736
8
2
8
1 736
8
0 15
8
2...

result:

ok 

Test #29:

score: 15
Accepted
time: 0ms
memory: 4204kb

input:

995
1
1
1
1
1
2
2
2
2
1
1
2
2
2
2
2
1
2
1
2
1
2
1
2
2
1
2
2
2
2
2
1
1
2
2
1
2
2
1
1
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
1
2
2
1
2
2
2
2
1
2
1
2
2
1
1
1
1
1
2
1
2
1
2
2
1
2
2
2
1
1
1
2
2
1
1
2
1
2
1
1
2
2
1
1
1
2
1
2
2
1
2
2
1
2
1
1
2
1
1
2
1
1
1
1
1
2
2
1
1
1
1
2
1
2
2
1
2
1
2
2
2
2
2
1
1
2
1
1
1
1
1
2
2
...

output:

8
0 364
8
2
8
0 101
8
2
8
0 566
8
2
8
0 454
8
2
8
0 565
8
2
8
0 808
8
2
8
1 808
8
0 107
8
2
8
1 107
8
0 167
8
2
8
1 167
8
0 187
8
2
8
1 187
8
0 311
8
2
8
0 166
8
2
8
0 649
8
2
8
1 649
8
0 724
8
2
8
1 724
8
0 570
8
2
8
1 570
8
0 737
8
2
8
1 737
8
0 424
8
2
8
1 424
8
0 104
8
2
8
0 765
8
2
8
1 765
8
0 ...

result:

ok 

Test #30:

score: 15
Accepted
time: 0ms
memory: 3896kb

input:

998
1
1
2
2
1
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
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:

8
0 189
8
2
8
0 233
8
2
8
0 361
8
2
8
1 361
8
0 564
8
2
8
1 564
8
0 661
8
2
8
0 490
8
2
8
1 490
8
0 237
8
2
8
1 237
8
0 166
8
2
8
1 166
8
0 407
8
2
8
0 575
8
2
8
1 575
8
0 157
8
2
8
1 157
8
0 648
8
2
8
1 648
8
0 153
8
2
8
1 153
8
0 75
8
2
8
1 75
8
0 736
8
2
8
1 736
8
0 15
8
2
8
1 15
8
0 583
8
2
8
1 ...

result:

ok 

Test #31:

score: 15
Accepted
time: 10ms
memory: 4204kb

input:

998
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
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
1
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
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
2
2
2
2
2
2
2
...

output:

8
0 189
8
2
8
0 233
8
2
8
0 361
8
2
8
1 361
8
0 564
8
2
8
0 661
8
2
8
0 490
8
2
8
0 237
8
2
8
0 166
8
2
8
0 407
8
2
8
0 575
8
2
8
0 157
8
2
8
0 648
8
2
8
1 648
8
0 153
8
2
8
0 75
8
2
8
0 736
8
2
8
0 15
8
2
8
0 583
8
2
8
0 764
8
2
8
0 861
8
2
8
1 861
8
0 386
8
2
8
0 56
8
2
8
0 836
8
2
8
0 245
8
2
8
0...

result:

ok 

Test #32:

score: 15
Accepted
time: 10ms
memory: 3912kb

input:

1000
1
1
2
2
1
1
2
2
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
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:

8
0 189
8
2
8
0 233
8
2
8
0 361
8
2
8
1 361
8
0 564
8
2
8
1 564
8
0 661
8
2
8
0 490
8
2
8
0 237
8
2
8
1 237
8
0 166
8
2
8
1 166
8
0 407
8
2
8
1 407
8
0 575
8
2
8
1 575
8
0 157
8
2
8
1 157
8
0 648
8
2
8
1 648
8
0 153
8
2
8
1 153
8
0 75
8
2
8
1 75
8
0 736
8
2
8
0 15
8
2
8
1 15
8
0 583
8
2
8
1 583
8
0 ...

result:

ok 

Test #33:

score: 15
Accepted
time: 3ms
memory: 3908kb

input:

996
1
1
1
2
1
2
1
2
2
2
1
2
1
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
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:

8
0 189
8
2
8
0 233
8
2
8
0 361
8
2
8
0 564
8
2
8
1 564
8
0 661
8
2
8
0 490
8
2
8
1 490
8
0 237
8
2
8
0 166
8
2
8
1 166
8
0 407
8
2
8
1 407
8
0 575
8
2
8
1 575
8
0 157
8
2
8
0 648
8
2
8
1 648
8
0 153
8
2
8
0 75
8
2
8
1 75
8
0 736
8
2
8
0 15
8
2
8
1 15
8
0 583
8
2
8
1 583
8
0 764
8
2
8
1 764
8
0 861
...

result:

ok 

Test #34:

score: 15
Accepted
time: 4ms
memory: 4200kb

input:

1000
1
1
1
1
2
1
2
1
1
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
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
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:

8
0 189
8
2
8
0 233
8
2
8
0 361
8
2
8
0 564
8
2
8
0 661
8
2
8
1 661
8
0 490
8
2
8
0 237
8
2
8
1 237
8
0 166
8
2
8
0 407
8
2
8
0 575
8
2
8
1 575
8
0 157
8
2
8
0 648
8
2
8
1 648
8
0 153
8
2
8
1 153
8
0 75
8
2
8
1 75
8
0 736
8
2
8
1 736
8
0 15
8
2
8
0 583
8
2
8
1 583
8
0 764
8
2
8
1 764
8
0 861
8
2
8
1...

result:

ok 

Test #35:

score: 15
Accepted
time: 0ms
memory: 3908kb

input:

1000
1
1
1
1
2
1
2
2
2
1
1
1
2
1
2
1
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
2
2
2
2
2
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
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:

8
0 252
8
2
8
0 164
8
2
8
0 131
8
2
8
0 930
8
2
8
0 898
8
2
8
1 898
8
0 407
8
2
8
0 110
8
2
8
1 110
8
0 438
8
2
8
1 438
8
0 843
8
2
8
1 843
8
0 439
8
2
8
0 388
8
2
8
0 159
8
2
8
0 342
8
2
8
1 342
8
0 537
8
2
8
0 514
8
2
8
1 514
8
0 962
8
2
8
0 486
8
2
8
1 486
8
0 16
8
2
8
0 269
8
2
8
1 269
8
0 822
8...

result:

ok 

Test #36:

score: 15
Accepted
time: 0ms
memory: 3904kb

input:

997
1
1
1
1
2
1
1
1
2
1
2
1
2
2
1
2
1
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
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
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:

8
0 378
8
2
8
0 165
8
2
8
0 192
8
2
8
0 931
8
2
8
0 899
8
2
8
1 899
8
0 780
8
2
8
0 111
8
2
8
0 439
8
2
8
0 791
8
2
8
1 791
8
0 600
8
2
8
0 846
8
2
8
1 846
8
0 97
8
2
8
0 343
8
2
8
1 343
8
0 53
8
2
8
1 53
8
0 515
8
2
8
0 963
8
2
8
1 963
8
0 524
8
2
8
0 320
8
2
8
1 320
8
0 812
8
2
8
0 823
8
2
8
1 823...

result:

ok 

Test #37:

score: 15
Accepted
time: 4ms
memory: 3908kb

input:

995
1
1
1
1
1
1
1
1
2
1
2
2
1
1
1
2
2
1
2
1
2
2
2
2
2
1
2
2
1
1
2
2
2
1
2
1
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
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:

8
0 378
8
2
8
0 165
8
2
8
0 192
8
2
8
0 931
8
2
8
0 899
8
2
8
0 780
8
2
8
0 111
8
2
8
0 439
8
2
8
0 791
8
2
8
1 791
8
0 600
8
2
8
0 846
8
2
8
1 846
8
0 97
8
2
8
1 97
8
0 343
8
2
8
0 53
8
2
8
0 515
8
2
8
0 963
8
2
8
1 963
8
0 524
8
2
8
1 524
8
0 320
8
2
8
0 812
8
2
8
1 812
8
0 823
8
2
8
0 800
8
2
8
1...

result:

ok 

Test #38:

score: 15
Accepted
time: 0ms
memory: 3916kb

input:

997
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
2
2
2
2
2
2
1
1
2
1
2
1
2
1
1
2
2
2
1
2
2
2
2
1
2
2
1
2
2
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
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
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 378
8
2
8
0 165
8
2
8
0 192
8
2
8
0 931
8
2
8
0 899
8
2
8
0 780
8
2
8
0 111
8
2
8
0 439
8
2
8
0 791
8
2
8
1 791
8
0 600
8
2
8
0 846
8
2
8
0 97
8
2
8
0 343
8
2
8
0 53
8
2
8
0 515
8
2
8
0 963
8
2
8
0 524
8
2
8
1 524
8
0 320
8
2
8
0 812
8
2
8
0 823
8
2
8
0 800
8
2
8
1 800
8
0 843
8
2
8
0 405
8
2
8
...

result:

ok 

Test #39:

score: 15
Accepted
time: 0ms
memory: 3908kb

input:

997
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
2
1
1
1
2
1
1
1
1
2
1
2
1
1
1
1
1
1
1
2
2
1
1
2
2
1
1
2
2
2
2
2
2
1
2
2
1
2
1
2
1
2
1
2
1
1
1
2
2
1
2
1
1
2
1
1
2
2
2
2
1
2
1
2
1
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
1
2
1
1
2
2
2
1
2
2
2
1
2
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
...

output:

8
0 378
8
2
8
0 165
8
2
8
0 192
8
2
8
0 931
8
2
8
0 899
8
2
8
0 780
8
2
8
0 111
8
2
8
0 439
8
2
8
0 791
8
2
8
0 600
8
2
8
0 846
8
2
8
0 97
8
2
8
0 343
8
2
8
0 53
8
2
8
0 515
8
2
8
0 963
8
2
8
0 524
8
2
8
0 320
8
2
8
0 812
8
2
8
0 823
8
2
8
0 800
8
2
8
1 800
8
0 843
8
2
8
0 405
8
2
8
0 841
8
2
8
0 77...

result:

ok 

Test #40:

score: 15
Accepted
time: 2ms
memory: 3900kb

input:

996
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
2
1
1
1
2
1
1
2
2
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
2
1
2
2
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
2
2
1
1
2
1
2
2
1
1
2
1
2
2
2
1
1
1
1
1
1
1
1
2
1
2
1
2
1
1
2
2
1
1
2
1
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
1
1
1
1
2
2
1
1
2
1
1
2
2
1
1
...

output:

8
0 252
8
2
8
0 164
8
2
8
0 131
8
2
8
0 930
8
2
8
0 898
8
2
8
1 898
8
0 407
8
2
8
0 110
8
2
8
0 438
8
2
8
0 843
8
2
8
0 439
8
2
8
0 388
8
2
8
0 159
8
2
8
0 342
8
2
8
0 537
8
2
8
0 514
8
2
8
0 962
8
2
8
0 486
8
2
8
0 16
8
2
8
0 269
8
2
8
0 822
8
2
8
0 781
8
2
8
0 842
8
2
8
1 842
8
0 404
8
2
8
0 840
8...

result:

ok 

Test #41:

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

input:

995
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
1
1
1
1
1
2
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
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
1
1
1
2
2
2
1
1
2
1
1
1
1
1
...

output:

8
0 378
8
2
8
0 165
8
2
8
0 192
8
2
8
0 931
8
2
8
0 899
8
2
8
1 899
8
0 780
8
2
8
0 111
8
2
8
0 439
8
2
8
0 791
8
2
8
0 600
8
2
8
0 846
8
2
8
0 97
8
2
8
0 343
8
2
8
0 53
8
2
8
0 515
8
2
8
0 963
8
2
8
0 524
8
2
8
0 320
8
2
8
0 812
8
2
8
0 823
8
2
8
0 800
8
2
8
0 843
8
2
8
0 405
8
2
8
1 405
8
0 841
8
...

result:

ok 

Test #42:

score: 15
Accepted
time: 6ms
memory: 3916kb

input:

995
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
1
1
1
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
2
2
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8
0 378
8
2
8
0 165
8
2
8
0 192
8
2
8
0 931
8
2
8
0 899
8
2
8
0 780
8
2
8
0 111
8
2
8
0 439
8
2
8
0 791
8
2
8
0 600
8
2
8
0 846
8
2
8
0 97
8
2
8
0 343
8
2
8
0 53
8
2
8
0 515
8
2
8
0 963
8
2
8
0 524
8
2
8
0 320
8
2
8
0 812
8
2
8
0 823
8
2
8
0 800
8
2
8
0 843
8
2
8
0 405
8
2
8
0 841
8
2
8
0 774
8
2
8
...

result:

ok 

Subtask #3:

score: 74.89
Acceptable Answer

Test #43:

score: 75
Accepted
time: 0ms
memory: 3980kb

input:

2
1
2

output:

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

result:

ok 

Test #44:

score: 75
Accepted
time: 0ms
memory: 3892kb

input:

2
1
1

output:

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

result:

ok 

Test #45:

score: 75
Accepted
time: 0ms
memory: 3900kb

input:

3
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
1
2
2
2
2
2
3
3
3

output:

8
0 1
8
2
8
0 2
8
2
8
0 5
8
2
8
1 5
8
0 0
8
2
8
1 0
8
0 4
8
2
8
1 4
8
0 3
8
2
8
1 3
8
0 5
8
2
8
0 0
8
2
8
1 0
8
0 4
8
2
8
1 4
8
0 3
8
2
8
1 3
8
1 5
8
3 1

result:

ok 

Test #47:

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

input:

10
1
1
2
2
2
2
2
2
2
2
2
3
4
3
4
4
3
4
4
5
5
4
5
6

output:

8
0 1
8
2
8
0 8
8
2
8
0 5
8
2
8
1 5
8
0 9
8
2
8
1 9
8
0 4
8
2
8
1 4
8
0 3
8
2
8
1 3
8
0 0
8
2
8
1 0
8
0 6
8
2
8
1 6
8
0 2
8
2
8
1 2
8
0 7
8
2
8
1 7
8
0 5
8
2
8
0 9
8
2
8
0 4
8
2
8
1 4
8
0 3
8
2
8
0 0
8
2
8
1 0
8
0 6
8
2
8
1 6
8
0 2
8
2
8
0 7
8
2
8
1 7
8
0 4
8
2
8
0 0
8
2
8
1 0
8
0 6
8
2
8
1 6
8
0 7
...

result:

ok 

Test #48:

score: 75
Accepted
time: 4ms
memory: 3948kb

input:

2000
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
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:

8
0 1456
8
2
8
0 1627
8
2
8
1 1627
8
0 1524
8
2
8
1 1524
8
0 1033
8
2
8
1 1033
8
0 1920
8
2
8
1 1920
8
0 1353
8
2
8
1 1353
8
0 110
8
2
8
1 110
8
0 438
8
2
8
1 438
8
0 1257
8
2
8
1 1257
8
0 439
8
2
8
1 439
8
0 1962
8
2
8
1 1962
8
0 1466
8
2
8
1 1466
8
0 342
8
2
8
1 342
8
0 537
8
2
8
1 537
8
0 514
8
2...

result:

ok 

Test #49:

score: 75
Accepted
time: 18ms
memory: 3860kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 1575
8
2
8
0 389
8
2
8
0 1749
8
2
8
0 1788
8
2
8
0 164
8
2
8
0 1728
8
2
8
0 1360
8
2
8
0 364
8
2
8
0 651
8
2
8
0 1703
8
2
8
0 520
8
2
8
0 1759
8
2
8
0 1055
8
2
8
0 1384
8
2
8
0 1196
8
2
8
0 1417
8
2
8
0 1516
8
2
8
0 952
8
2
8
0 637
8
2
8
0 2
8
2
8
0 1327
8
2
8
0 238
8
2
8
0 1204
8
2
8
0 182
8
2
...

result:

ok 

Test #50:

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

input:

2000
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
2
1
2
1
2
2
2
2
1
1
1
1
2
2
1
2
2
1
2
1
2
1
2
2
1
2
2
1
2
2
2
2
1
1
2
2
1
2
2
2
2
2
2
1
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
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
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1575
8
2
8
0 389
8
2
8
0 1749
8
2
8
0 1788
8
2
8
0 164
8
2
8
0 1728
8
2
8
1 1728
8
0 1360
8
2
8
0 364
8
2
8
0 651
8
2
8
0 1703
8
2
8
0 520
8
2
8
0 1759
8
2
8
0 1055
8
2
8
0 1384
8
2
8
1 1384
8
0 1196
8
2
8
1 1196
8
0 1417
8
2
8
0 1516
8
2
8
0 952
8
2
8
0 637
8
2
8
0 2
8
2
8
0 1327
8
2
8
0 238
8
...

result:

ok 

Test #51:

score: 75
Accepted
time: 4ms
memory: 3940kb

input:

2000
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
2
2
2
2
1
1
1
2
2
1
2
2
1
1
1
1
2
2
2
2
2
1
2
2
1
2
1
2
2
1
1
1
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1575
8
2
8
0 389
8
2
8
0 1749
8
2
8
0 1788
8
2
8
0 164
8
2
8
0 1728
8
2
8
0 1360
8
2
8
0 364
8
2
8
0 651
8
2
8
1 651
8
0 1703
8
2
8
0 520
8
2
8
0 1759
8
2
8
0 1055
8
2
8
0 1384
8
2
8
0 1196
8
2
8
1 1196
8
0 1417
8
2
8
0 1516
8
2
8
0 952
8
2
8
0 637
8
2
8
1 637
8
0 2
8
2
8
1 2
8
0 1327
8
2
8
1 13...

result:

ok 

Test #52:

score: 75
Accepted
time: 8ms
memory: 4208kb

input:

2000
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
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:

8
0 1575
8
2
8
0 389
8
2
8
1 389
8
0 1749
8
2
8
1 1749
8
0 1788
8
2
8
1 1788
8
0 164
8
2
8
1 164
8
0 1728
8
2
8
1 1728
8
0 1360
8
2
8
1 1360
8
0 364
8
2
8
1 364
8
0 651
8
2
8
1 651
8
0 1703
8
2
8
1 1703
8
0 520
8
2
8
1 520
8
0 1759
8
2
8
1 1759
8
0 1055
8
2
8
1 1055
8
0 1384
8
2
8
1 1384
8
0 1196
8
...

result:

ok 

Test #53:

score: 75
Accepted
time: 4ms
memory: 4172kb

input:

2000
1
1
2
2
2
1
2
1
1
1
1
2
2
2
1
2
2
2
1
2
1
2
1
2
2
1
2
1
2
1
1
2
2
1
1
2
2
2
2
1
1
2
2
1
1
1
2
1
2
1
2
2
1
1
2
1
2
1
1
1
1
1
1
2
1
1
2
1
2
2
2
2
2
2
1
2
2
2
2
1
1
1
1
2
2
2
1
2
2
2
2
1
2
1
2
1
1
2
1
2
2
2
1
1
2
1
1
2
2
1
1
2
2
1
1
1
1
2
1
1
1
1
2
1
1
1
2
2
2
1
1
2
2
1
1
1
1
2
1
1
2
2
1
2
1
2
2
2...

output:

8
0 1575
8
2
8
0 389
8
2
8
0 1749
8
2
8
1 1749
8
0 1788
8
2
8
1 1788
8
0 164
8
2
8
1 164
8
0 1728
8
2
8
0 1360
8
2
8
1 1360
8
0 364
8
2
8
0 651
8
2
8
0 1703
8
2
8
0 520
8
2
8
0 1759
8
2
8
1 1759
8
0 1055
8
2
8
1 1055
8
0 1384
8
2
8
1 1384
8
0 1196
8
2
8
0 1417
8
2
8
1 1417
8
0 1516
8
2
8
1 1516
8
0 ...

result:

ok 

Test #54:

score: 75
Accepted
time: 3ms
memory: 4212kb

input:

2000
1
1
2
2
1
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
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:

8
0 1575
8
2
8
0 389
8
2
8
0 1749
8
2
8
1 1749
8
0 1788
8
2
8
1 1788
8
0 164
8
2
8
0 1728
8
2
8
0 1360
8
2
8
1 1360
8
0 364
8
2
8
1 364
8
0 651
8
2
8
1 651
8
0 1703
8
2
8
1 1703
8
0 520
8
2
8
1 520
8
0 1759
8
2
8
1 1759
8
0 1055
8
2
8
1 1055
8
0 1384
8
2
8
1 1384
8
0 1196
8
2
8
1 1196
8
0 1417
8
2
8...

result:

ok 

Test #55:

score: 75
Accepted
time: 3ms
memory: 4200kb

input:

2000
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
2
2
1
2
2
1
2
2
1
2
2
2
2
2
1
2
1
2
2
1
1
2
1
2
2
2
1
2
1
2
2
2
2
1
2
1
1
1
2
1
2
2
2
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1087
8
2
8
0 1433
8
2
8
0 778
8
2
8
0 1097
8
2
8
0 122
8
2
8
0 637
8
2
8
0 1706
8
2
8
0 1934
8
2
8
0 747
8
2
8
1 747
8
0 482
8
2
8
0 1485
8
2
8
0 1958
8
2
8
0 1857
8
2
8
0 998
8
2
8
0 1792
8
2
8
1 1792
8
0 602
8
2
8
0 1884
8
2
8
0 1300
8
2
8
0 73
8
2
8
0 213
8
2
8
1 213
8
0 385
8
2
8
1 385
8
0 1...

result:

ok 

Test #56:

score: 75
Accepted
time: 4ms
memory: 4204kb

input:

1998
1
2
1
2
2
2
2
1
2
2
1
2
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
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:

8
0 1087
8
2
8
0 1433
8
2
8
1 1433
8
0 778
8
2
8
0 1097
8
2
8
1 1097
8
0 122
8
2
8
1 122
8
0 637
8
2
8
1 637
8
0 1706
8
2
8
1 1706
8
0 1934
8
2
8
0 747
8
2
8
1 747
8
0 482
8
2
8
1 482
8
0 1485
8
2
8
0 1958
8
2
8
1 1958
8
0 1857
8
2
8
1 1857
8
0 998
8
2
8
1 998
8
0 1792
8
2
8
1 1792
8
0 602
8
2
8
1 6...

result:

ok 

Test #57:

score: 75
Accepted
time: 0ms
memory: 3944kb

input:

1999
1
1
2
1
2
1
1
2
1
1
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
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:

8
0 631
8
2
8
0 1678
8
2
8
0 852
8
2
8
1 852
8
0 335
8
2
8
0 358
8
2
8
1 358
8
0 976
8
2
8
0 1707
8
2
8
0 1935
8
2
8
1 1935
8
0 83
8
2
8
0 483
8
2
8
0 107
8
2
8
1 107
8
0 1959
8
2
8
1 1959
8
0 389
8
2
8
0 999
8
2
8
1 999
8
0 1793
8
2
8
1 1793
8
0 1156
8
2
8
1 1156
8
0 1885
8
2
8
1 1885
8
0 1301
8
2
...

result:

ok 

Test #58:

score: 75
Accepted
time: 9ms
memory: 3896kb

input:

1997
1
1
1
1
1
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
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
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:

8
0 631
8
2
8
0 1678
8
2
8
0 852
8
2
8
0 335
8
2
8
0 358
8
2
8
0 976
8
2
8
0 1707
8
2
8
0 1935
8
2
8
1 1935
8
0 83
8
2
8
1 83
8
0 483
8
2
8
1 483
8
0 107
8
2
8
1 107
8
0 1959
8
2
8
1 1959
8
0 389
8
2
8
0 999
8
2
8
1 999
8
0 1793
8
2
8
1 1793
8
0 1156
8
2
8
1 1156
8
0 1885
8
2
8
1 1885
8
0 1301
8
2
8...

result:

ok 

Test #59:

score: 75
Accepted
time: 7ms
memory: 4208kb

input:

1998
1
1
1
1
2
1
1
2
2
2
2
2
1
2
2
2
1
2
1
2
2
1
2
1
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
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:

8
0 939
8
2
8
0 1302
8
2
8
0 1419
8
2
8
0 546
8
2
8
0 101
8
2
8
1 101
8
0 1298
8
2
8
0 822
8
2
8
0 1032
8
2
8
1 1032
8
0 40
8
2
8
1 40
8
0 583
8
2
8
1 583
8
0 1438
8
2
8
1 1438
8
0 484
8
2
8
1 484
8
0 532
8
2
8
0 1330
8
2
8
1 1330
8
0 72
8
2
8
1 72
8
0 1655
8
2
8
1 1655
8
0 1729
8
2
8
0 789
8
2
8
1 ...

result:

ok 

Test #60:

score: 74.98
Acceptable Answer
time: 0ms
memory: 4220kb

input:

1996
1
1
1
1
2
1
2
2
2
1
2
2
1
2
1
2
2
1
1
2
2
2
2
2
2
1
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
1
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
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:

8
0 939
8
2
8
0 1302
8
2
8
0 1419
8
2
8
0 546
8
2
8
0 101
8
2
8
1 101
8
0 1298
8
2
8
0 822
8
2
8
1 822
8
0 1032
8
2
8
1 1032
8
0 40
8
2
8
1 40
8
0 583
8
2
8
0 1438
8
2
8
1 1438
8
0 484
8
2
8
1 484
8
0 532
8
2
8
0 1330
8
2
8
1 1330
8
0 72
8
2
8
0 1655
8
2
8
1 1655
8
0 1729
8
2
8
1 1729
8
0 789
8
2
8
...

result:

points 0.99973333330 points  0.99973333330

Test #61:

score: 75
Accepted
time: 3ms
memory: 3976kb

input:

2000
1
1
1
2
2
1
2
1
1
1
1
1
1
2
1
2
2
1
2
2
2
1
1
2
2
2
2
1
2
1
2
2
2
2
1
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
1
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
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:

8
0 939
8
2
8
0 1302
8
2
8
0 1419
8
2
8
0 546
8
2
8
1 546
8
0 101
8
2
8
1 101
8
0 1298
8
2
8
0 822
8
2
8
1 822
8
0 1032
8
2
8
0 40
8
2
8
0 583
8
2
8
0 1438
8
2
8
0 484
8
2
8
0 532
8
2
8
0 1330
8
2
8
1 1330
8
0 72
8
2
8
0 1655
8
2
8
1 1655
8
0 1729
8
2
8
1 1729
8
0 789
8
2
8
0 1598
8
2
8
1 1598
8
0 3...

result:

ok 

Test #62:

score: 75
Accepted
time: 7ms
memory: 4200kb

input:

1998
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
2
1
1
1
1
1
1
2
2
2
1
1
2
2
1
2
2
1
2
1
2
2
1
1
1
2
1
2
2
1
2
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
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
1
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2...

output:

8
0 939
8
2
8
0 1302
8
2
8
0 1419
8
2
8
0 546
8
2
8
0 101
8
2
8
0 1298
8
2
8
0 822
8
2
8
0 1032
8
2
8
1 1032
8
0 40
8
2
8
0 583
8
2
8
0 1438
8
2
8
0 484
8
2
8
0 532
8
2
8
0 1330
8
2
8
0 72
8
2
8
0 1655
8
2
8
0 1729
8
2
8
0 789
8
2
8
0 1598
8
2
8
1 1598
8
0 369
8
2
8
0 1071
8
2
8
1 1071
8
0 248
8
2
8...

result:

ok 

Test #63:

score: 75
Accepted
time: 0ms
memory: 3912kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
2
1
1
2
2
1
1
1
1
1
1
1
1
1
1
2
2
2
1
2
1
1
2
1
2
1
1
1
1
2
1
2
1
1
1
1
1
2
1
1
1
1
1
1
2
1
1
2
1
1
2
1
2
2
1
2
2
2
1
2
1
2
1
1
2
2
2
1
2
2
1
1
1
2
2
1
1
2
1
1
1
2
2
2
1
2
1
2
2
2
2
1
2
2
2
2
2
2
1
1
2
2
2
1
1
2
2
2
2
2
2
1
2
1
2
2
1
2
2
2
1
1
2
2
2
2
2...

output:

8
0 1142
8
2
8
0 638
8
2
8
0 1957
8
2
8
0 691
8
2
8
0 249
8
2
8
0 431
8
2
8
0 391
8
2
8
0 1964
8
2
8
0 1646
8
2
8
0 1459
8
2
8
0 1016
8
2
8
0 199
8
2
8
1 199
8
0 1587
8
2
8
0 1045
8
2
8
0 974
8
2
8
0 1270
8
2
8
0 1815
8
2
8
0 441
8
2
8
0 274
8
2
8
0 479
8
2
8
0 723
8
2
8
1 723
8
0 1761
8
2
8
1 1761
...

result:

ok 

Test #64:

score: 75
Accepted
time: 3ms
memory: 3972kb

input:

1995
1
1
1
1
1
1
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
2
2
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
2
2
1
1
1
1
2
1
1
1
2
1
2
1
2
2
2
1
1
1
2
1
2
1
1
2
1
1
1
2
2
2
1
1
2
2
2
2
1
2
2
2
1
2
2
2
1
1
1
1
2
2
1
2
2
1
1
2
2
2
1
1
1
1
1
1
1
1
1
2
2
1
2
2
1
2
1
2
1
1...

output:

8
0 1143
8
2
8
0 639
8
2
8
0 1656
8
2
8
0 466
8
2
8
0 17
8
2
8
0 82
8
2
8
0 228
8
2
8
0 1965
8
2
8
0 1814
8
2
8
0 888
8
2
8
0 1017
8
2
8
0 2
8
2
8
0 726
8
2
8
0 1074
8
2
8
0 975
8
2
8
0 1271
8
2
8
0 1547
8
2
8
0 1326
8
2
8
0 846
8
2
8
0 1772
8
2
8
0 1644
8
2
8
0 1473
8
2
8
0 1443
8
2
8
0 1130
8
2
8
...

result:

ok 

Test #65:

score: 75
Accepted
time: 0ms
memory: 3984kb

input:

1999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
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
1
1
1
1
1
2
1
2
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
2
1
1
1
1
1
1
1
2
2
2...

output:

8
0 1143
8
2
8
0 639
8
2
8
0 1656
8
2
8
0 466
8
2
8
0 17
8
2
8
0 82
8
2
8
0 228
8
2
8
0 1965
8
2
8
0 1814
8
2
8
0 888
8
2
8
0 1017
8
2
8
0 2
8
2
8
0 726
8
2
8
0 1074
8
2
8
0 975
8
2
8
0 1271
8
2
8
0 1547
8
2
8
0 1326
8
2
8
0 846
8
2
8
0 1772
8
2
8
0 1644
8
2
8
0 1473
8
2
8
0 1443
8
2
8
0 1130
8
2
8
...

result:

ok 

Test #66:

score: 75
Accepted
time: 9ms
memory: 4200kb

input:

1998
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
1
1
1
2
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
2
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
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
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1...

output:

8
0 1142
8
2
8
0 638
8
2
8
0 1957
8
2
8
0 691
8
2
8
0 249
8
2
8
0 431
8
2
8
0 391
8
2
8
0 1964
8
2
8
1 1964
8
0 1646
8
2
8
0 1459
8
2
8
0 1016
8
2
8
0 199
8
2
8
0 1587
8
2
8
0 1045
8
2
8
0 974
8
2
8
0 1270
8
2
8
0 1815
8
2
8
0 441
8
2
8
0 274
8
2
8
0 479
8
2
8
0 723
8
2
8
0 1761
8
2
8
0 1442
8
2
8
0...

result:

ok 

Test #67:

score: 75
Accepted
time: 0ms
memory: 4176kb

input:

1999
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
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
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1...

output:

8
0 1143
8
2
8
0 639
8
2
8
0 1656
8
2
8
0 466
8
2
8
0 17
8
2
8
0 82
8
2
8
0 228
8
2
8
1 228
8
0 1965
8
2
8
0 1814
8
2
8
0 888
8
2
8
0 1017
8
2
8
0 2
8
2
8
0 726
8
2
8
0 1074
8
2
8
0 975
8
2
8
0 1271
8
2
8
0 1547
8
2
8
0 1326
8
2
8
0 846
8
2
8
0 1772
8
2
8
0 1644
8
2
8
0 1473
8
2
8
0 1443
8
2
8
0 113...

result:

ok 

Test #68:

score: 75
Accepted
time: 3ms
memory: 3908kb

input:

1979
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
1
1
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2...

output:

8
0 1493
8
2
8
0 877
8
2
8
0 1029
8
2
8
0 1707
8
2
8
0 1847
8
2
8
1 1847
8
0 290
8
2
8
0 1654
8
2
8
0 464
8
2
8
1 464
8
0 1860
8
2
8
0 1401
8
2
8
0 841
8
2
8
0 271
8
2
8
0 1636
8
2
8
0 1976
8
2
8
0 1024
8
2
8
0 1044
8
2
8
0 1651
8
2
8
0 1855
8
2
8
1 1855
8
0 1912
8
2
8
0 1101
8
2
8
0 320
8
2
8
0 136...

result:

ok 

Test #69:

score: 75
Accepted
time: 5ms
memory: 3912kb

input:

1979
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
2
1
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
1
1
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
1
2...

output:

8
0 1493
8
2
8
0 877
8
2
8
0 1029
8
2
8
0 1707
8
2
8
0 1847
8
2
8
1 1847
8
0 290
8
2
8
0 1654
8
2
8
0 464
8
2
8
1 464
8
0 1860
8
2
8
0 1401
8
2
8
0 841
8
2
8
0 271
8
2
8
0 1636
8
2
8
0 1976
8
2
8
0 1024
8
2
8
0 1044
8
2
8
0 1651
8
2
8
0 1855
8
2
8
1 1855
8
0 1912
8
2
8
0 1101
8
2
8
0 320
8
2
8
0 136...

result:

ok 

Test #70:

score: 74.89
Acceptable Answer
time: 0ms
memory: 3976kb

input:

1979
1
1
2
1
1
1
1
2
1
1
2
1
1
1
2
2
1
1
2
2
2
1
1
1
2
2
2
1
2
2
1
1
2
1
2
1
1
2
2
2
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
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
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
2
2
2
2
2
2
2...

output:

8
0 1493
8
2
8
0 877
8
2
8
0 1029
8
2
8
1 1029
8
0 1707
8
2
8
0 1847
8
2
8
0 290
8
2
8
0 1654
8
2
8
0 464
8
2
8
1 464
8
0 1860
8
2
8
0 1401
8
2
8
0 841
8
2
8
1 841
8
0 271
8
2
8
0 1636
8
2
8
0 1976
8
2
8
0 1024
8
2
8
1 1024
8
0 1044
8
2
8
1 1044
8
0 1651
8
2
8
0 1855
8
2
8
0 1912
8
2
8
1 1912
8
0 11...

result:

points 0.99853333330 points  0.99853333330

Test #71:

score: 74.89
Acceptable Answer
time: 9ms
memory: 3940kb

input:

1979
1
1
2
1
1
1
1
2
1
1
2
1
1
1
2
2
1
1
2
2
2
1
1
2
2
1
2
1
2
2
1
1
2
1
2
1
1
2
2
2
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
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
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
2
2
2
2
2
2
2...

output:

8
0 1493
8
2
8
0 877
8
2
8
0 1029
8
2
8
1 1029
8
0 1707
8
2
8
0 1847
8
2
8
0 290
8
2
8
0 1654
8
2
8
0 464
8
2
8
1 464
8
0 1860
8
2
8
0 1401
8
2
8
0 841
8
2
8
1 841
8
0 271
8
2
8
0 1636
8
2
8
0 1976
8
2
8
0 1024
8
2
8
1 1024
8
0 1044
8
2
8
1 1044
8
0 1651
8
2
8
0 1855
8
2
8
0 1912
8
2
8
1 1912
8
0 11...

result:

points 0.99853333330 points  0.99853333330

Test #72:

score: 75
Accepted
time: 8ms
memory: 3920kb

input:

1981
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
2
1
1
1
2
1
1
2
1
1
1
2
2
2
2
2
1
2
2
1
1
2
2
1
1
1
2
2
1
2
2
2
2
1
1
2
2
2
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
1
2
2
2
1
1
2
2
1
1
1
2
2
1
2
1
2
2
2
1
2
1
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2...

output:

8
0 1887
8
2
8
0 1476
8
2
8
0 1387
8
2
8
0 280
8
2
8
0 458
8
2
8
0 771
8
2
8
0 874
8
2
8
0 1631
8
2
8
0 1495
8
2
8
0 1728
8
2
8
0 1407
8
2
8
0 1186
8
2
8
0 663
8
2
8
0 1652
8
2
8
0 913
8
2
8
0 1707
8
2
8
0 261
8
2
8
0 1184
8
2
8
1 1184
8
0 1692
8
2
8
0 1788
8
2
8
0 1149
8
2
8
1 1149
8
0 1048
8
2
8
1...

result:

ok 

Test #73:

score: 75
Accepted
time: 5ms
memory: 3908kb

input:

1981
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
1
2
2
1
2
2
1
1
1
1
2
2
2
1
2
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
2
2
1
1
1
2
1
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1887
8
2
8
0 1476
8
2
8
0 1387
8
2
8
0 280
8
2
8
0 458
8
2
8
0 771
8
2
8
0 874
8
2
8
0 1631
8
2
8
0 1495
8
2
8
1 1495
8
0 1728
8
2
8
0 1407
8
2
8
0 1186
8
2
8
0 663
8
2
8
0 1652
8
2
8
0 913
8
2
8
0 1707
8
2
8
0 261
8
2
8
0 1184
8
2
8
1 1184
8
0 1692
8
2
8
0 1788
8
2
8
0 1149
8
2
8
1 1149
8
0 104...

result:

ok 

Test #74:

score: 75
Accepted
time: 5ms
memory: 4196kb

input:

1989
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
2
2
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
1
1
2
2
1
2
1
2
1
1
1
1
1
2
2
1
2
2
1
2
1
1
1
2
1
1
2
2
2
1
1
1
1
2
1
1
2
1
1
1
2
2
2
1
1
1
2
1
2
1
1
1
1
2
2
1
2
2
2
2
1
1
2
1
1
1
2
2
1
1
1
1
2
2
1
2
2
2
2
1
2
1
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
1
2...

output:

8
0 1887
8
2
8
0 1476
8
2
8
0 1387
8
2
8
0 280
8
2
8
0 458
8
2
8
0 771
8
2
8
0 874
8
2
8
0 1631
8
2
8
0 1495
8
2
8
0 1728
8
2
8
0 1407
8
2
8
0 1186
8
2
8
0 663
8
2
8
0 1652
8
2
8
0 913
8
2
8
0 1707
8
2
8
1 1707
8
0 261
8
2
8
0 1184
8
2
8
0 1692
8
2
8
0 1788
8
2
8
1 1788
8
0 1149
8
2
8
0 1048
8
2
8
0...

result:

ok 

Test #75:

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

input:

1989
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
2
2
2
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
1
1
2
2
1
2
1
2
1
1
1
1
1
2
2
1
2
2
1
2
1
1
1
2
1
1
2
2
2
1
1
1
1
2
1
1
2
1
1
1
2
2
2
1
1
1
2
1
2
1
1
1
1
2
2
1
2
2
2
2
1
1
2
1
1
1
2
2
1
1
1
1
2
2
1
2
2
2
2
1
2
1
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
1
2...

output:

8
0 1887
8
2
8
0 1476
8
2
8
0 1387
8
2
8
0 280
8
2
8
0 458
8
2
8
0 771
8
2
8
0 874
8
2
8
0 1631
8
2
8
0 1495
8
2
8
0 1728
8
2
8
0 1407
8
2
8
0 1186
8
2
8
0 663
8
2
8
0 1652
8
2
8
0 913
8
2
8
0 1707
8
2
8
1 1707
8
0 261
8
2
8
0 1184
8
2
8
0 1692
8
2
8
0 1788
8
2
8
1 1788
8
0 1149
8
2
8
0 1048
8
2
8
0...

result:

ok 

Test #76:

score: 74.9
Acceptable Answer
time: 6ms
memory: 3912kb

input:

1970
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
1
1
2
1
1
1
2
1
1
2
2
2
1
2
1
1
2
1
1
1
1
1
1
1
2
2
2
1
1
2
1
1
1
1
2
1
2
1
2
1
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
1
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
1
1
2
2...

output:

8
0 1886
8
2
8
0 465
8
2
8
0 1386
8
2
8
0 1051
8
2
8
0 759
8
2
8
1 759
8
0 983
8
2
8
0 520
8
2
8
0 1630
8
2
8
0 1713
8
2
8
0 883
8
2
8
0 1406
8
2
8
0 788
8
2
8
0 1479
8
2
8
0 217
8
2
8
0 985
8
2
8
0 1706
8
2
8
0 260
8
2
8
0 1122
8
2
8
0 484
8
2
8
1 484
8
0 53
8
2
8
1 53
8
0 1407
8
2
8
1 1407
8
0 591...

result:

points 0.99866666670 points  0.99866666670

Test #77:

score: 74.9
Acceptable Answer
time: 0ms
memory: 3944kb

input:

1970
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
1
1
1
1
2
2
1
1
1
1
1
2
1
1
1
1
2
2
2
1
1
2
1
2
1
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
1
1
2
2
1
2
2
2
2
1
2
2
2
1
2
2
2
1
2
1
1
2
2
2
2
1
2
2
2
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
1
1
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2...

output:

8
0 1428
8
2
8
0 883
8
2
8
0 773
8
2
8
0 477
8
2
8
0 457
8
2
8
0 677
8
2
8
0 1961
8
2
8
0 168
8
2
8
0 1842
8
2
8
0 1911
8
2
8
0 120
8
2
8
0 1110
8
2
8
0 511
8
2
8
1 511
8
0 1827
8
2
8
0 669
8
2
8
0 1926
8
2
8
0 304
8
2
8
1 304
8
0 1633
8
2
8
0 548
8
2
8
1 548
8
0 1249
8
2
8
0 861
8
2
8
0 660
8
2
8
0...

result:

points 0.99866666670 points  0.99866666670

Test #78:

score: 75
Accepted
time: 17ms
memory: 4168kb

input:

1980
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
2
1
1
1
2
2
1
1
1
1
1
1
2
1
2
2
2
2
2
1
1
1
1
1
2
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
1
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
1
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
1
2
2
1
2
2
2
1
1
2
2
2
2
2
2
2
2
2...

output:

8
0 1428
8
2
8
0 883
8
2
8
0 773
8
2
8
0 477
8
2
8
0 457
8
2
8
0 677
8
2
8
0 1961
8
2
8
0 168
8
2
8
0 1842
8
2
8
0 1911
8
2
8
0 120
8
2
8
0 1110
8
2
8
0 511
8
2
8
0 1827
8
2
8
1 1827
8
0 669
8
2
8
0 1926
8
2
8
0 304
8
2
8
0 1633
8
2
8
0 548
8
2
8
0 1249
8
2
8
0 861
8
2
8
0 660
8
2
8
0 355
8
2
8
0 46...

result:

ok 

Test #79:

score: 75
Accepted
time: 6ms
memory: 3924kb

input:

1980
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
2
1
1
1
2
2
1
1
1
1
1
1
2
1
2
2
2
2
2
1
1
1
1
1
2
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
1
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
2
1
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
1
2
2
1
2
2
2
1
1
2
2
2
2
2
2
2
2
2...

output:

8
0 1428
8
2
8
0 883
8
2
8
0 773
8
2
8
0 477
8
2
8
0 457
8
2
8
0 677
8
2
8
0 1961
8
2
8
0 168
8
2
8
0 1842
8
2
8
0 1911
8
2
8
0 120
8
2
8
0 1110
8
2
8
0 511
8
2
8
0 1827
8
2
8
1 1827
8
0 669
8
2
8
0 1926
8
2
8
0 304
8
2
8
0 1633
8
2
8
0 548
8
2
8
0 1249
8
2
8
0 861
8
2
8
0 660
8
2
8
0 355
8
2
8
0 46...

result:

ok 

Test #80:

score: 75
Accepted
time: 13ms
memory: 4208kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
2
1
2
1
2
1
1
1
1
2
2
2
1
1
1
2
1
2
2
2
2
2
1
2
2
2
1
1
2
1
1
1
2
2
1
2
1
2
2
2
1
1
1
2
2
2
1
2
2
1
1
1
1
1
2
1
2
1
2
1
2
1
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
1
1
2
1
2
2
2
2
2
2
1
1
2
2
1
2
2
2
1
2
2
2
1
2
2...

output:

8
0 1806
8
2
8
0 837
8
2
8
0 516
8
2
8
0 1317
8
2
8
0 854
8
2
8
0 393
8
2
8
0 413
8
2
8
0 1878
8
2
8
0 551
8
2
8
0 1989
8
2
8
0 768
8
2
8
0 1464
8
2
8
0 1810
8
2
8
0 1245
8
2
8
0 1721
8
2
8
1 1721
8
0 229
8
2
8
0 743
8
2
8
0 1513
8
2
8
0 848
8
2
8
0 749
8
2
8
0 297
8
2
8
0 56
8
2
8
0 443
8
2
8
0 119...

result:

ok 

Test #81:

score: 75
Accepted
time: 4ms
memory: 3916kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
2
1
2
1
2
1
1
1
1
2
2
2
1
1
1
2
1
2
2
2
2
2
1
2
2
2
1
1
2
1
1
1
2
2
1
2
1
2
2
2
1
1
1
2
2
2
1
2
2
1
1
1
1
1
2
1
2
1
2
1
2
1
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
2
2
1
1
2
1
2
2
2
2
2
2
1
1
2
2
1
2
2
2
1
2
2
2
1
2
2...

output:

8
0 1806
8
2
8
0 837
8
2
8
0 516
8
2
8
0 1317
8
2
8
0 854
8
2
8
0 393
8
2
8
0 413
8
2
8
0 1878
8
2
8
0 551
8
2
8
0 1989
8
2
8
0 768
8
2
8
0 1464
8
2
8
0 1810
8
2
8
0 1245
8
2
8
0 1721
8
2
8
1 1721
8
0 229
8
2
8
0 743
8
2
8
0 1513
8
2
8
0 848
8
2
8
0 749
8
2
8
0 297
8
2
8
0 56
8
2
8
0 443
8
2
8
0 119...

result:

ok 

Test #82:

score: 74.93
Acceptable Answer
time: 8ms
memory: 4212kb

input:

2000
1
1
1
1
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
1
2
1
1
2
2
2
1
1
2
1
2
1
2
2
2
1
2
1
2
1
2
2
2
2
2
2
1
2
1
2
2
2
1
1
1
1
2
1
2
2
1
2
2
2
1
2
1
2
2
2
2
1
2
2
2
1
2
1
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2...

output:

8
0 1806
8
2
8
0 837
8
2
8
0 516
8
2
8
0 1317
8
2
8
0 854
8
2
8
0 393
8
2
8
0 413
8
2
8
0 1878
8
2
8
0 551
8
2
8
0 1989
8
2
8
0 768
8
2
8
0 1464
8
2
8
0 1810
8
2
8
0 1245
8
2
8
0 1721
8
2
8
0 229
8
2
8
0 743
8
2
8
0 1513
8
2
8
0 848
8
2
8
0 749
8
2
8
0 297
8
2
8
1 297
8
0 56
8
2
8
0 443
8
2
8
1 443
...

result:

points 0.99906666670 points  0.99906666670

Test #83:

score: 74.93
Acceptable Answer
time: 7ms
memory: 3912kb

input:

2000
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
2
1
2
1
2
1
2
2
2
2
2
2
2
1
1
2
1
1
2
1
1
1
2
2
2
2
1
2
2
2
2
2
1
1
2
1
2
2
1
2
2
2
2
1
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
1
2
1
1
1
2
1
2
2
2
2
2
2
1
1
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2...

output:

8
0 1806
8
2
8
0 837
8
2
8
0 516
8
2
8
0 1317
8
2
8
0 854
8
2
8
0 393
8
2
8
0 413
8
2
8
0 1878
8
2
8
0 551
8
2
8
0 1989
8
2
8
0 768
8
2
8
0 1464
8
2
8
1 1464
8
0 1810
8
2
8
0 1245
8
2
8
0 1721
8
2
8
0 229
8
2
8
0 743
8
2
8
0 1513
8
2
8
0 848
8
2
8
0 749
8
2
8
0 297
8
2
8
1 297
8
0 56
8
2
8
0 443
8
2...

result:

points 0.99906666670 points  0.99906666670

Test #84:

score: 75
Accepted
time: 2ms
memory: 3916kb

input:

540
1
1
2
1
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
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
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:

8
0 260
8
2
8
0 377
8
2
8
0 516
8
2
8
1 516
8
0 139
8
2
8
0 244
8
2
8
1 244
8
0 393
8
2
8
1 393
8
0 413
8
2
8
0 130
8
2
8
1 130
8
0 142
8
2
8
1 142
8
0 397
8
2
8
1 397
8
0 348
8
2
8
1 348
8
0 531
8
2
8
1 531
8
0 102
8
2
8
1 102
8
0 247
8
2
8
1 247
8
0 152
8
2
8
1 152
8
0 229
8
2
8
1 229
8
0 13
8
2
8...

result:

ok 

Test #85:

score: 75
Accepted
time: 7ms
memory: 3908kb

input:

1834
1
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
1
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
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:

8
0 1185
8
2
8
0 204
8
2
8
1 204
8
0 1729
8
2
8
1 1729
8
0 742
8
2
8
1 742
8
0 524
8
2
8
1 524
8
0 1060
8
2
8
1 1060
8
0 1481
8
2
8
0 35
8
2
8
1 35
8
0 264
8
2
8
1 264
8
0 1350
8
2
8
1 1350
8
0 379
8
2
8
1 379
8
0 145
8
2
8
1 145
8
0 1311
8
2
8
1 1311
8
0 1604
8
2
8
1 1604
8
0 235
8
2
8
1 235
8
0 17...

result:

ok 

Test #86:

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

input:

2000
1
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
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:

8
0 1185
8
2
8
0 204
8
2
8
0 1908
8
2
8
1 1908
8
0 742
8
2
8
1 742
8
0 524
8
2
8
1 524
8
0 1060
8
2
8
1 1060
8
0 1481
8
2
8
1 1481
8
0 35
8
2
8
1 35
8
0 264
8
2
8
1 264
8
0 1350
8
2
8
1 1350
8
0 379
8
2
8
1 379
8
0 145
8
2
8
1 145
8
0 1311
8
2
8
1 1311
8
0 1604
8
2
8
1 1604
8
0 1933
8
2
8
1 1933
8
0...

result:

ok 

Test #87:

score: 75
Accepted
time: 3ms
memory: 4172kb

input:

2000
1
1
1
2
2
1
1
2
2
1
2
2
1
1
1
1
2
2
2
2
2
2
1
2
1
1
2
2
1
2
2
1
1
2
1
2
1
2
1
2
2
2
1
1
1
1
1
2
1
2
2
1
1
2
2
1
1
1
2
1
1
2
1
2
1
2
2
1
2
1
2
1
2
2
1
1
2
2
1
1
2
1
1
2
2
2
1
1
2
2
1
2
2
1
2
2
1
2
2
1
2
1
1
1
2
2
2
2
2
1
2
2
2
1
2
2
1
1
2
1
1
1
1
1
2
2
1
1
1
2
1
1
1
2
1
1
2
2
1
1
1
2
2
2
2
1
1
2...

output:

8
0 1185
8
2
8
0 204
8
2
8
0 1908
8
2
8
0 742
8
2
8
1 742
8
0 524
8
2
8
1 524
8
0 1060
8
2
8
0 1481
8
2
8
0 35
8
2
8
1 35
8
0 264
8
2
8
1 264
8
0 1350
8
2
8
0 379
8
2
8
1 379
8
0 145
8
2
8
1 145
8
0 1311
8
2
8
0 1604
8
2
8
0 1933
8
2
8
0 1740
8
2
8
0 451
8
2
8
1 451
8
0 142
8
2
8
1 142
8
0 190
8
2
8...

result:

ok 

Test #88:

score: 75
Accepted
time: 9ms
memory: 3988kb

input:

2000
1
1
2
1
1
2
2
1
1
2
1
1
2
2
2
2
1
1
1
1
1
1
2
1
2
2
1
1
2
1
1
2
2
1
2
1
2
1
2
1
1
1
2
2
2
2
2
1
2
1
1
2
2
1
1
2
2
2
1
2
2
1
2
1
2
1
1
2
1
2
1
2
1
1
2
2
1
1
2
2
1
2
2
1
1
1
2
2
1
1
2
1
1
2
1
1
2
1
1
2
1
2
2
2
1
1
1
1
1
2
1
1
1
2
1
1
2
2
1
2
2
2
2
2
1
1
2
2
2
1
2
2
2
1
2
2
1
1
2
2
2
1
1
1
1
2
2
1...

output:

8
0 1185
8
2
8
0 204
8
2
8
0 1908
8
2
8
1 1908
8
0 742
8
2
8
0 524
8
2
8
0 1060
8
2
8
1 1060
8
0 1481
8
2
8
1 1481
8
0 35
8
2
8
0 264
8
2
8
0 1350
8
2
8
1 1350
8
0 379
8
2
8
0 145
8
2
8
0 1311
8
2
8
1 1311
8
0 1604
8
2
8
1 1604
8
0 1933
8
2
8
1 1933
8
0 1740
8
2
8
1 1740
8
0 451
8
2
8
0 142
8
2
8
0 ...

result:

ok 

Test #89:

score: 75
Accepted
time: 0ms
memory: 3916kb

input:

2000
1
1
2
1
1
1
1
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
1
1
2
1
2
1
2
1
1
1
2
2
1
1
2
1
1
2
2
1
2
1
1
2
1
2
2
1
2
2
1
2
2
2
2
2
1
2
2
1
2
1
1
2
2
2
2
2
1
1
1
1
1
2
1
2
2
1
1
1
2
1
1
1
2
2
2
2
1
1
2
2
1
1
1
1
1
1
1
1
2
1
2
2
2
2
2
2
2
2
1
1
1
2
2
1
2
2
1
2
1
1
2
1
2
1
2
2
2
2
2
1
1
1
1
1
2
1
2
1
2
1
2
2
1
2...

output:

8
0 1185
8
2
8
0 204
8
2
8
0 1908
8
2
8
1 1908
8
0 742
8
2
8
0 524
8
2
8
0 1060
8
2
8
0 1481
8
2
8
0 35
8
2
8
1 35
8
0 264
8
2
8
1 264
8
0 1350
8
2
8
0 379
8
2
8
1 379
8
0 145
8
2
8
1 145
8
0 1311
8
2
8
0 1604
8
2
8
1 1604
8
0 1933
8
2
8
1 1933
8
0 1740
8
2
8
1 1740
8
0 451
8
2
8
1 451
8
0 142
8
2
8...

result:

ok