QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#45860#4565. Rarest InsectsZhaoZiLong50.03 239ms3964kbC++171.5kb2022-08-24 15:49:192022-08-24 15:50:25

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
1
2
2
2
2
2
2
2
2
3

output:

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

result:

ok 

Test #2:

score: 0
Accepted
time: 2ms
memory: 3848kb

input:

2
1
2

output:

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

result:

ok 

Test #3:

score: 0
Accepted
time: 2ms
memory: 3760kb

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
1
2
2
2
2
2
2
3
2

output:

8
0 0
8
2
8
0 4
8
2
8
1 4
8
0 2
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 3
8
2
8
1 3
8
0 1
8
2
8
1 1
8
0 4
8
2
8
0 3
8
2
8
1 3
8
0 1
8
2
8
3 2

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 76
8
2
8
0 115
8
2
8
1 115
8
0 32
8
2
8
1 32
8
0 197
8
2
8
1 197
8
0 137
8
2
8
1 137
8
0 72
8
2
8
1 72
8
0 134
8
2
8
1 134
8
0 114
8
2
8
1 114
8
0 161
8
2
8
1 161
8
0 9
8
2
8
1 9
8
0 139
8
2
8
1 139
8
0 130
8
2
8
1 130
8
0 81
8
2
8
1 81
8
0 3
8
2
8
1 3
8
0 16
8
2
8
1 16
8
0 26
8
2
8
1 26
8
0 171...

result:

ok 

Test #8:

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

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 0
8
2
8
0 114
8
2
8
0 13
8
2
8
0 196
8
2
8
0 136
8
2
8
0 198
8
2
8
0 125
8
2
8
0 189
8
2
8
0 160
8
2
8
0 21
8
2
8
0 138
8
2
8
0 35
8
2
8
0 80
8
2
8
0 25
8
2
8
0 20
8
2
8
0 129
8
2
8
0 170
8
2
8
0 175
8
2
8
0 49
8
2
8
0 157
8
2
8
0 104
8
2
8
0 183
8
2
8
0 94
8
2
8
0 137
8
2
8
0 145
8
2
8
0 139
8
...

result:

ok 

Test #9:

score: 0
Accepted
time: 5ms
memory: 3716kb

input:

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

output:

8
0 0
8
2
8
0 114
8
2
8
0 13
8
2
8
0 196
8
2
8
0 136
8
2
8
0 198
8
2
8
1 198
8
0 125
8
2
8
0 189
8
2
8
1 189
8
0 160
8
2
8
1 160
8
0 21
8
2
8
1 21
8
0 138
8
2
8
0 35
8
2
8
0 80
8
2
8
1 80
8
0 25
8
2
8
1 25
8
0 20
8
2
8
0 129
8
2
8
1 129
8
0 170
8
2
8
1 170
8
0 175
8
2
8
1 175
8
0 49
8
2
8
1 49
8
0 1...

result:

ok 

Test #10:

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

input:

198
1
1
1
2
1
1
2
1
2
2
2
2
2
2
1
2
2
1
2
2
1
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 0
8
2
8
0 114
8
2
8
0 13
8
2
8
0 196
8
2
8
1 196
8
0 136
8
2
8
0 57
8
2
8
0 125
8
2
8
1 125
8
0 189
8
2
8
0 160
8
2
8
1 160
8
0 21
8
2
8
1 21
8
0 138
8
2
8
1 138
8
0 35
8
2
8
1 35
8
0 80
8
2
8
1 80
8
0 25
8
2
8
1 25
8
0 20
8
2
8
0 129
8
2
8
1 129
8
0 170
8
2
8
1 170
8
0 175
8
2
8
0 49
8
2
8
1 49...

result:

ok 

Test #11:

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

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
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 76
8
2
8
0 115
8
2
8
1 115
8
0 32
8
2
8
1 32
8
0 197
8
2
8
1 197
8
0 137
8
2
8
1 137
8
0 72
8
2
8
1 72
8
0 134
8
2
8
1 134
8
0 114
8
2
8
1 114
8
0 161
8
2
8
1 161
8
0 9
8
2
8
1 9
8
0 139
8
2
8
1 139
8
0 130
8
2
8
1 130
8
0 81
8
2
8
1 81
8
0 3
8
2
8
1 3
8
0 16
8
2
8
1 16
8
0 26
8
2
8
1 26
8
0 171...

result:

ok 

Test #12:

score: 0
Accepted
time: 4ms
memory: 3844kb

input:

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

output:

8
0 69
8
2
8
0 183
8
2
8
1 183
8
0 186
8
2
8
0 126
8
2
8
1 126
8
0 68
8
2
8
1 68
8
0 30
8
2
8
0 91
8
2
8
1 91
8
0 54
8
2
8
1 54
8
0 52
8
2
8
0 57
8
2
8
0 21
8
2
8
0 115
8
2
8
1 115
8
0 51
8
2
8
0 20
8
2
8
1 20
8
0 15
8
2
8
1 15
8
0 106
8
2
8
0 99
8
2
8
1 99
8
0 35
8
2
8
0 141
8
2
8
0 171
8
2
8
0 188...

result:

ok 

Test #13:

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

input:

197
1
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 69
8
2
8
0 183
8
2
8
0 186
8
2
8
1 186
8
0 126
8
2
8
1 126
8
0 68
8
2
8
0 30
8
2
8
1 30
8
0 91
8
2
8
0 54
8
2
8
1 54
8
0 52
8
2
8
1 52
8
0 57
8
2
8
1 57
8
0 21
8
2
8
1 21
8
0 115
8
2
8
1 115
8
0 51
8
2
8
1 51
8
0 20
8
2
8
1 20
8
0 15
8
2
8
1 15
8
0 106
8
2
8
1 106
8
0 99
8
2
8
1 99
8
0 35
8
2
8
...

result:

ok 

Test #14:

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

input:

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

output:

8
0 68
8
2
8
0 182
8
2
8
0 65
8
2
8
1 65
8
0 69
8
2
8
0 62
8
2
8
0 10
8
2
8
0 90
8
2
8
0 97
8
2
8
1 97
8
0 101
8
2
8
1 101
8
0 77
8
2
8
0 27
8
2
8
0 171
8
2
8
1 171
8
0 21
8
2
8
0 39
8
2
8
1 39
8
0 195
8
2
8
1 195
8
0 16
8
2
8
1 16
8
0 119
8
2
8
1 119
8
0 83
8
2
8
1 83
8
0 140
8
2
8
1 140
8
0 170
8
...

result:

ok 

Test #15:

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

input:

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

output:

8
0 68
8
2
8
0 182
8
2
8
1 182
8
0 199
8
2
8
0 69
8
2
8
0 62
8
2
8
0 10
8
2
8
1 10
8
0 90
8
2
8
0 97
8
2
8
1 97
8
0 101
8
2
8
1 101
8
0 77
8
2
8
1 77
8
0 27
8
2
8
1 27
8
0 171
8
2
8
1 171
8
0 21
8
2
8
1 21
8
0 39
8
2
8
1 39
8
0 195
8
2
8
1 195
8
0 16
8
2
8
1 16
8
0 119
8
2
8
1 119
8
0 83
8
2
8
1 83
...

result:

ok 

Test #16:

score: 0
Accepted
time: 21ms
memory: 3848kb

input:

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

output:

8
0 68
8
2
8
0 182
8
2
8
0 65
8
2
8
1 65
8
0 69
8
2
8
1 69
8
0 62
8
2
8
1 62
8
0 10
8
2
8
1 10
8
0 90
8
2
8
0 97
8
2
8
1 97
8
0 101
8
2
8
0 77
8
2
8
0 27
8
2
8
0 171
8
2
8
0 21
8
2
8
1 21
8
0 39
8
2
8
1 39
8
0 195
8
2
8
1 195
8
0 16
8
2
8
1 16
8
0 119
8
2
8
1 119
8
0 83
8
2
8
1 83
8
0 140
8
2
8
1 14...

result:

ok 

Test #17:

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

input:

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

output:

8
0 69
8
2
8
0 183
8
2
8
0 186
8
2
8
1 186
8
0 126
8
2
8
0 68
8
2
8
0 30
8
2
8
1 30
8
0 91
8
2
8
0 54
8
2
8
1 54
8
0 52
8
2
8
0 57
8
2
8
0 21
8
2
8
1 21
8
0 115
8
2
8
1 115
8
0 51
8
2
8
1 51
8
0 20
8
2
8
0 15
8
2
8
0 106
8
2
8
1 106
8
0 99
8
2
8
0 35
8
2
8
1 35
8
0 141
8
2
8
1 141
8
0 171
8
2
8
1 17...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
1
1
1
2
2
2
2
1
1
1
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 68
8
2
8
0 182
8
2
8
0 65
8
2
8
0 69
8
2
8
0 62
8
2
8
0 10
8
2
8
0 90
8
2
8
0 97
8
2
8
1 97
8
0 101
8
2
8
1 101
8
0 77
8
2
8
1 77
8
0 27
8
2
8
1 27
8
0 171
8
2
8
0 21
8
2
8
0 39
8
2
8
0 195
8
2
8
1 195
8
0 16
8
2
8
1 16
8
0 119
8
2
8
1 119
8
0 83
8
2
8
1 83
8
0 140
8
2
8
0 170
8
2
8
1 170
8
0 12...

result:

ok 

Test #19:

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

input:

196
1
1
1
2
1
1
1
1
1
1
1
2
2
1
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
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 68
8
2
8
0 182
8
2
8
0 65
8
2
8
0 69
8
2
8
1 69
8
0 62
8
2
8
0 10
8
2
8
0 90
8
2
8
0 97
8
2
8
0 101
8
2
8
0 77
8
2
8
0 27
8
2
8
0 171
8
2
8
1 171
8
0 21
8
2
8
1 21
8
0 39
8
2
8
0 195
8
2
8
1 195
8
0 16
8
2
8
1 16
8
0 119
8
2
8
1 119
8
0 83
8
2
8
0 140
8
2
8
1 140
8
0 170
8
2
8
1 170
8
0 126
8
2
...

result:

ok 

Test #20:

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

input:

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

output:

8
0 185
8
2
8
0 110
8
2
8
0 142
8
2
8
0 129
8
2
8
0 162
8
2
8
0 7
8
2
8
1 7
8
0 10
8
2
8
0 85
8
2
8
1 85
8
0 106
8
2
8
0 114
8
2
8
1 114
8
0 80
8
2
8
0 95
8
2
8
0 64
8
2
8
1 64
8
0 43
8
2
8
1 43
8
0 101
8
2
8
1 101
8
0 169
8
2
8
1 169
8
0 143
8
2
8
0 153
8
2
8
1 153
8
0 86
8
2
8
0 182
8
2
8
1 182
8
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 185
8
2
8
0 110
8
2
8
0 142
8
2
8
0 129
8
2
8
1 129
8
0 162
8
2
8
0 7
8
2
8
0 10
8
2
8
0 85
8
2
8
0 106
8
2
8
0 114
8
2
8
0 80
8
2
8
1 80
8
0 95
8
2
8
1 95
8
0 64
8
2
8
0 43
8
2
8
0 101
8
2
8
0 169
8
2
8
0 143
8
2
8
1 143
8
0 153
8
2
8
0 86
8
2
8
1 86
8
0 182
8
2
8
0 90
8
2
8
1 90
8
0 136
8
2
8
...

result:

ok 

Test #22:

score: 0
Accepted
time: 12ms
memory: 3720kb

input:

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

output:

8
0 49
8
2
8
0 111
8
2
8
0 143
8
2
8
0 20
8
2
8
0 163
8
2
8
0 34
8
2
8
0 9
8
2
8
0 162
8
2
8
0 107
8
2
8
0 128
8
2
8
0 180
8
2
8
0 55
8
2
8
0 65
8
2
8
0 6
8
2
8
0 4
8
2
8
0 26
8
2
8
0 56
8
2
8
0 3
8
2
8
0 158
8
2
8
0 183
8
2
8
0 91
8
2
8
0 178
8
2
8
0 118
8
2
8
1 118
8
0 21
8
2
8
0 14
8
2
8
0 114
8
...

result:

ok 

Test #23:

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

input:

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

output:

8
0 185
8
2
8
0 110
8
2
8
0 142
8
2
8
0 129
8
2
8
0 162
8
2
8
0 7
8
2
8
0 10
8
2
8
0 85
8
2
8
0 106
8
2
8
0 114
8
2
8
0 80
8
2
8
0 95
8
2
8
0 64
8
2
8
0 43
8
2
8
0 101
8
2
8
0 169
8
2
8
0 143
8
2
8
0 153
8
2
8
0 86
8
2
8
1 86
8
0 182
8
2
8
0 90
8
2
8
0 136
8
2
8
0 56
8
2
8
0 175
8
2
8
0 139
8
2
8
0 ...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 13ms
memory: 3868kb

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 185
8
2
8
0 352
8
2
8
1 352
8
0 278
8
2
8
1 278
8
0 442
8
2
8
1 442
8
0 737
8
2
8
1 737
8
0 7
8
2
8
1 7
8
0 409
8
2
8
1 409
8
0 241
8
2
8
1 241
8
0 596
8
2
8
1 596
8
0 605
8
2
8
1 605
8
0 785
8
2
8
1 785
8
0 461
8
2
8
1 461
8
0 368
8
2
8
1 368
8
0 857
8
2
8
1 857
8
0 101
8
2
8
1 101
8
0 429
8
2
...

result:

ok 

Test #25:

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

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 185
8
2
8
0 352
8
2
8
0 278
8
2
8
0 442
8
2
8
0 737
8
2
8
0 7
8
2
8
0 409
8
2
8
0 241
8
2
8
0 596
8
2
8
0 605
8
2
8
0 785
8
2
8
0 461
8
2
8
0 368
8
2
8
0 857
8
2
8
0 101
8
2
8
0 429
8
2
8
0 925
8
2
8
0 388
8
2
8
0 997
8
2
8
0 842
8
2
8
0 448
8
2
8
0 433
8
2
8
0 549
8
2
8
0 488
8
2
8
0 748
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 49
8
2
8
0 353
8
2
8
0 279
8
2
8
0 443
8
2
8
0 304
8
2
8
0 308
8
2
8
0 610
8
2
8
0 162
8
2
8
0 597
8
2
8
1 597
8
0 128
8
2
8
0 375
8
2
8
0 229
8
2
8
1 229
8
0 369
8
2
8
0 565
8
2
8
0 4
8
2
8
1 4
8
0 582
8
2
8
0 56
8
2
8
1 56
8
0 954
8
2
8
0 621
8
2
8
1 621
8
0 843
8
2
8
0 449
8
2
8
1 449
8
0 403...

result:

ok 

Test #27:

score: 0
Accepted
time: 81ms
memory: 3748kb

input:

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

output:

8
0 522
8
2
8
0 933
8
2
8
0 888
8
2
8
0 331
8
2
8
0 326
8
2
8
0 512
8
2
8
0 342
8
2
8
0 769
8
2
8
1 769
8
0 545
8
2
8
0 90
8
2
8
0 277
8
2
8
0 792
8
2
8
0 667
8
2
8
0 504
8
2
8
1 504
8
0 224
8
2
8
1 224
8
0 770
8
2
8
0 946
8
2
8
0 355
8
2
8
0 922
8
2
8
0 372
8
2
8
0 395
8
2
8
0 26
8
2
8
0 379
8
2
8
...

result:

ok 

Test #28:

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

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 632
8
2
8
0 72
8
2
8
1 72
8
0 544
8
2
8
1 544
8
0 501
8
2
8
1 501
8
0 543
8
2
8
1 543
8
0 767
8
2
8
1 767
8
0 626
8
2
8
1 626
8
0 411
8
2
8
1 411
8
0 20
8
2
8
1 20
8
0 128
8
2
8
1 128
8
0 724
8
2
8
1 724
8
0 281
8
2
8
1 281
8
0 208
8
2
8
1 208
8
0 510
8
2
8
1 510
8
0 193
8
2
8
1 193
8
0 250
8
2
...

result:

ok 

Test #29:

score: 0
Accepted
time: 22ms
memory: 3864kb

input:

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

output:

8
0 77
8
2
8
0 288
8
2
8
1 288
8
0 164
8
2
8
1 164
8
0 867
8
2
8
1 867
8
0 21
8
2
8
1 21
8
0 78
8
2
8
1 78
8
0 24
8
2
8
1 24
8
0 596
8
2
8
1 596
8
0 968
8
2
8
1 968
8
0 955
8
2
8
0 122
8
2
8
0 611
8
2
8
0 130
8
2
8
1 130
8
0 144
8
2
8
0 733
8
2
8
0 117
8
2
8
0 531
8
2
8
1 531
8
0 550
8
2
8
1 550
8
0...

result:

ok 

Test #30:

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

input:

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

output:

8
0 679
8
2
8
0 315
8
2
8
0 825
8
2
8
0 866
8
2
8
1 866
8
0 615
8
2
8
1 615
8
0 275
8
2
8
0 207
8
2
8
1 207
8
0 491
8
2
8
1 491
8
0 983
8
2
8
1 983
8
0 954
8
2
8
1 954
8
0 269
8
2
8
1 269
8
0 747
8
2
8
1 747
8
0 71
8
2
8
1 71
8
0 114
8
2
8
1 114
8
0 732
8
2
8
1 732
8
0 116
8
2
8
1 116
8
0 649
8
2
8
...

result:

ok 

Test #31:

score: 0
Accepted
time: 49ms
memory: 3768kb

input:

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

output:

8
0 257
8
2
8
0 375
8
2
8
0 309
8
2
8
0 544
8
2
8
0 609
8
2
8
0 411
8
2
8
0 723
8
2
8
0 131
8
2
8
0 961
8
2
8
0 397
8
2
8
0 913
8
2
8
1 913
8
0 149
8
2
8
0 199
8
2
8
1 199
8
0 18
8
2
8
0 532
8
2
8
0 396
8
2
8
1 396
8
0 984
8
2
8
0 798
8
2
8
1 798
8
0 258
8
2
8
0 117
8
2
8
1 117
8
0 991
8
2
8
1 991
8...

result:

ok 

Test #32:

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

input:

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

output:

8
0 680
8
2
8
0 993
8
2
8
0 38
8
2
8
0 360
8
2
8
0 179
8
2
8
1 179
8
0 869
8
2
8
1 869
8
0 414
8
2
8
1 414
8
0 708
8
2
8
0 971
8
2
8
1 971
8
0 893
8
2
8
1 893
8
0 871
8
2
8
1 871
8
0 780
8
2
8
1 780
8
0 776
8
2
8
1 776
8
0 615
8
2
8
1 615
8
0 932
8
2
8
1 932
8
0 866
8
2
8
1 866
8
0 212
8
2
8
1 212
8...

result:

ok 

Test #33:

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

input:

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

output:

8
0 680
8
2
8
0 993
8
2
8
0 38
8
2
8
0 360
8
2
8
0 179
8
2
8
0 869
8
2
8
1 869
8
0 414
8
2
8
0 708
8
2
8
0 971
8
2
8
0 893
8
2
8
1 893
8
0 871
8
2
8
1 871
8
0 780
8
2
8
1 780
8
0 776
8
2
8
1 776
8
0 615
8
2
8
1 615
8
0 932
8
2
8
1 932
8
0 866
8
2
8
1 866
8
0 212
8
2
8
1 212
8
0 394
8
2
8
1 394
8
0 1...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
1
2
1
2
2
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 309
8
2
8
0 874
8
2
8
0 821
8
2
8
0 5
8
2
8
0 969
8
2
8
0 247
8
2
8
1 247
8
0 870
8
2
8
0 138
8
2
8
1 138
8
0 307
8
2
8
1 307
8
0 485
8
2
8
1 485
8
0 361
8
2
8
1 361
8
0 772
8
2
8
0 258
8
2
8
1 258
8
0 144
8
2
8
0 296
8
2
8
1 296
8
0 130
8
2
8
0 570
8
2
8
1 570
8
0 958
8
2
8
1 958
8
0 92
8
2
8
0...

result:

ok 

Test #35:

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

input:

1000
1
1
1
1
1
2
1
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 309
8
2
8
0 874
8
2
8
0 821
8
2
8
0 5
8
2
8
0 969
8
2
8
0 247
8
2
8
1 247
8
0 870
8
2
8
0 138
8
2
8
0 307
8
2
8
1 307
8
0 485
8
2
8
1 485
8
0 361
8
2
8
1 361
8
0 772
8
2
8
1 772
8
0 258
8
2
8
1 258
8
0 144
8
2
8
1 144
8
0 296
8
2
8
1 296
8
0 130
8
2
8
1 130
8
0 570
8
2
8
0 958
8
2
8
1 958
8
0 92...

result:

ok 

Test #36:

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

input:

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

output:

8
0 819
8
2
8
0 657
8
2
8
0 105
8
2
8
0 808
8
2
8
0 787
8
2
8
0 78
8
2
8
1 78
8
0 775
8
2
8
1 775
8
0 785
8
2
8
0 276
8
2
8
0 782
8
2
8
0 348
8
2
8
1 348
8
0 784
8
2
8
0 361
8
2
8
0 972
8
2
8
1 972
8
0 171
8
2
8
0 903
8
2
8
1 903
8
0 292
8
2
8
1 292
8
0 513
8
2
8
1 513
8
0 456
8
2
8
1 456
8
0 27
8
2...

result:

ok 

Test #37:

score: 0
Accepted
time: 18ms
memory: 3812kb

input:

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

output:

8
0 819
8
2
8
0 657
8
2
8
0 105
8
2
8
0 808
8
2
8
0 787
8
2
8
1 787
8
0 78
8
2
8
1 78
8
0 775
8
2
8
0 785
8
2
8
0 276
8
2
8
0 782
8
2
8
0 348
8
2
8
1 348
8
0 784
8
2
8
1 784
8
0 361
8
2
8
0 972
8
2
8
0 171
8
2
8
0 903
8
2
8
0 292
8
2
8
1 292
8
0 513
8
2
8
1 513
8
0 456
8
2
8
1 456
8
0 27
8
2
8
0 845...

result:

ok 

Test #38:

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

input:

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

output:

8
0 889
8
2
8
0 753
8
2
8
1 753
8
0 962
8
2
8
0 774
8
2
8
0 20
8
2
8
0 120
8
2
8
1 120
8
0 851
8
2
8
0 258
8
2
8
0 16
8
2
8
0 382
8
2
8
0 661
8
2
8
0 14
8
2
8
0 179
8
2
8
0 960
8
2
8
0 187
8
2
8
1 187
8
0 789
8
2
8
1 789
8
0 198
8
2
8
0 445
8
2
8
0 492
8
2
8
0 900
8
2
8
0 433
8
2
8
0 234
8
2
8
0 662...

result:

ok 

Test #39:

score: 0
Accepted
time: 45ms
memory: 3740kb

input:

997
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
2
1
1
1
1
2
1
1
2
2
1
2
1
1
1
1
1
1
2
2
2
1
2
2
1
1
1
2
1
1
1
1
2
2
2
1
2
2
2
1
1
1
2
1
2
2
2
1
1
1
1
2
2
1
2
2
2
2
2
2
1
2
1
2
1
2
1
1
2
2
2
2
1
2
2
1
1
1
1
2
1
1
2
1
2
2
1
2
1
1
2
2
2
1
1
2
2
2
1
2
2
1
2
1
1
2
2
1
1
1
2
2
2
2
2
2
2
1
2
1
2
2
1
1
2
2
...

output:

8
0 889
8
2
8
0 753
8
2
8
0 962
8
2
8
0 774
8
2
8
0 20
8
2
8
0 120
8
2
8
0 851
8
2
8
0 258
8
2
8
0 16
8
2
8
0 382
8
2
8
0 661
8
2
8
0 14
8
2
8
0 179
8
2
8
0 960
8
2
8
1 960
8
0 187
8
2
8
0 789
8
2
8
0 198
8
2
8
0 445
8
2
8
0 492
8
2
8
0 900
8
2
8
0 433
8
2
8
1 433
8
0 234
8
2
8
0 662
8
2
8
1 662
8
0...

result:

ok 

Test #40:

score: 0
Accepted
time: 24ms
memory: 3864kb

input:

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

output:

8
0 175
8
2
8
0 509
8
2
8
0 182
8
2
8
0 855
8
2
8
0 508
8
2
8
0 732
8
2
8
0 64
8
2
8
1 64
8
0 837
8
2
8
0 980
8
2
8
0 250
8
2
8
0 521
8
2
8
0 794
8
2
8
0 944
8
2
8
0 13
8
2
8
0 600
8
2
8
0 790
8
2
8
0 557
8
2
8
0 47
8
2
8
0 803
8
2
8
0 652
8
2
8
0 625
8
2
8
0 247
8
2
8
0 648
8
2
8
0 185
8
2
8
1 185
...

result:

ok 

Test #41:

score: 0
Accepted
time: 19ms
memory: 3784kb

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

output:

8
0 324
8
2
8
0 461
8
2
8
0 495
8
2
8
0 491
8
2
8
0 369
8
2
8
0 635
8
2
8
0 310
8
2
8
0 80
8
2
8
0 994
8
2
8
0 769
8
2
8
0 681
8
2
8
0 482
8
2
8
0 307
8
2
8
0 840
8
2
8
0 763
8
2
8
0 683
8
2
8
0 947
8
2
8
0 264
8
2
8
0 590
8
2
8
0 18
8
2
8
0 443
8
2
8
0 982
8
2
8
0 607
8
2
8
0 688
8
2
8
0 403
8
2
8
...

result:

ok 

Test #42:

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

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

output:

8
0 324
8
2
8
0 461
8
2
8
0 495
8
2
8
0 491
8
2
8
0 369
8
2
8
0 635
8
2
8
0 310
8
2
8
0 80
8
2
8
0 994
8
2
8
0 769
8
2
8
0 681
8
2
8
0 482
8
2
8
0 307
8
2
8
0 840
8
2
8
0 763
8
2
8
0 683
8
2
8
0 947
8
2
8
0 264
8
2
8
0 590
8
2
8
0 18
8
2
8
0 443
8
2
8
0 982
8
2
8
0 607
8
2
8
0 688
8
2
8
0 403
8
2
8
...

result:

ok 

Subtask #3:

score: 25.03
Acceptable Answer

Test #43:

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

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

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

input:

3
1
2
1
2

output:

8
0 1
8
2
8
0 2
8
2
8
1 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: 0ms
memory: 3844kb

input:

6
1
2
2
1
2
2
2
3
3
3
2
2
2
2

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

score: 75
Accepted
time: 21ms
memory: 3872kb

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 937
8
2
8
0 460
8
2
8
1 460
8
0 1954
8
2
8
1 1954
8
0 765
8
2
8
1 765
8
0 1476
8
2
8
1 1476
8
0 1660
8
2
8
1 1660
8
0 106
8
2
8
1 106
8
0 137
8
2
8
1 137
8
0 605
8
2
8
1 605
8
0 1382
8
2
8
1 1382
8
0 680
8
2
8
1 680
8
0 1626
8
2
8
1 1626
8
0 1483
8
2
8
1 1483
8
0 1889
8
2
8
1 1889
8
0 1322
8
2
8...

result:

ok 

Test #49:

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

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 1111
8
2
8
0 1500
8
2
8
0 1911
8
2
8
0 252
8
2
8
0 1537
8
2
8
0 1731
8
2
8
0 1516
8
2
8
0 734
8
2
8
0 1501
8
2
8
0 1064
8
2
8
0 1339
8
2
8
0 1658
8
2
8
0 839
8
2
8
0 986
8
2
8
0 612
8
2
8
0 184
8
2
8
0 1553
8
2
8
0 15
8
2
8
0 1091
8
2
8
0 693
8
2
8
0 1902
8
2
8
0 950
8
2
8
0 1206
8
2
8
0 1982
8
...

result:

ok 

Test #50:

score: 75
Accepted
time: 80ms
memory: 3964kb

input:

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

output:

8
0 1111
8
2
8
0 1500
8
2
8
0 1911
8
2
8
0 252
8
2
8
0 1537
8
2
8
0 1731
8
2
8
0 1516
8
2
8
0 734
8
2
8
0 1501
8
2
8
0 1064
8
2
8
1 1064
8
0 1339
8
2
8
1 1339
8
0 1658
8
2
8
0 839
8
2
8
0 986
8
2
8
0 612
8
2
8
0 184
8
2
8
0 1553
8
2
8
0 15
8
2
8
1 15
8
0 1091
8
2
8
0 693
8
2
8
1 693
8
0 1902
8
2
8
0...

result:

ok 

Test #51:

score: 70.58
Acceptable Answer
time: 65ms
memory: 3924kb

input:

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

output:

8
0 93
8
2
8
0 863
8
2
8
0 1467
8
2
8
0 728
8
2
8
0 1124
8
2
8
0 1676
8
2
8
0 131
8
2
8
0 1593
8
2
8
0 1991
8
2
8
0 768
8
2
8
1 768
8
0 90
8
2
8
0 20
8
2
8
0 1798
8
2
8
1 1798
8
0 1987
8
2
8
0 586
8
2
8
0 389
8
2
8
1 389
8
0 855
8
2
8
0 1538
8
2
8
0 107
8
2
8
0 230
8
2
8
0 608
8
2
8
0 900
8
2
8
0 10...

result:

points 0.94106666670 points  0.94106666670

Test #52:

score: 25.03
Acceptable Answer
time: 165ms
memory: 3884kb

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 451
8
2
8
0 641
8
2
8
1 641
8
0 1203
8
2
8
1 1203
8
0 273
8
2
8
1 273
8
0 717
8
2
8
1 717
8
0 1282
8
2
8
1 1282
8
0 777
8
2
8
1 777
8
0 511
8
2
8
1 511
8
0 1231
8
2
8
1 1231
8
0 1704
8
2
8
1 1704
8
0 1056
8
2
8
1 1056
8
0 1852
8
2
8
1 1852
8
0 1235
8
2
8
1 1235
8
0 1348
8
2
8
1 1348
8
0 1596
8
2...

result:

points 0.33373333330 points  0.33373333330

Test #53:

score: 75
Accepted
time: 34ms
memory: 3836kb

input:

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

output:

8
0 1719
8
2
8
0 540
8
2
8
0 342
8
2
8
0 1810
8
2
8
0 1641
8
2
8
0 169
8
2
8
1 169
8
0 1103
8
2
8
0 1932
8
2
8
1 1932
8
0 759
8
2
8
0 1965
8
2
8
1 1965
8
0 374
8
2
8
1 374
8
0 912
8
2
8
0 619
8
2
8
1 619
8
0 929
8
2
8
0 700
8
2
8
0 163
8
2
8
1 163
8
0 55
8
2
8
0 289
8
2
8
0 740
8
2
8
0 1730
8
2
8
0 ...

result:

ok 

Test #54:

score: 28.2
Acceptable Answer
time: 239ms
memory: 3888kb

input:

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

output:

8
0 1719
8
2
8
0 540
8
2
8
0 342
8
2
8
0 1810
8
2
8
0 1641
8
2
8
1 1641
8
0 169
8
2
8
1 169
8
0 1103
8
2
8
1 1103
8
0 1932
8
2
8
1 1932
8
0 759
8
2
8
1 759
8
0 1965
8
2
8
1 1965
8
0 374
8
2
8
1 374
8
0 912
8
2
8
1 912
8
0 619
8
2
8
1 619
8
0 929
8
2
8
1 929
8
0 700
8
2
8
1 700
8
0 163
8
2
8
1 163
8
...

result:

points 0.3760 points  0.3760

Test #55:

score: 57.87
Acceptable Answer
time: 147ms
memory: 3904kb

input:

2000
1
1
1
1
1
1
2
1
1
1
1
1
2
2
2
1
1
1
2
1
1
1
2
1
2
1
2
1
1
2
1
2
2
2
1
1
1
2
2
2
1
1
2
2
2
1
2
1
2
1
2
2
2
2
2
1
1
2
2
2
2
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
1
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
1
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 1579
8
2
8
0 380
8
2
8
0 1165
8
2
8
0 1032
8
2
8
0 791
8
2
8
0 1816
8
2
8
0 1850
8
2
8
1 1850
8
0 348
8
2
8
0 177
8
2
8
0 1499
8
2
8
0 1695
8
2
8
0 349
8
2
8
0 1565
8
2
8
1 1565
8
0 1471
8
2
8
1 1471
8
0 522
8
2
8
1 522
8
0 391
8
2
8
0 1819
8
2
8
0 1110
8
2
8
0 1655
8
2
8
1 1655
8
0 1399
8
2
8
0...

result:

points 0.77160 points  0.77160

Test #56:

score: 74.56
Acceptable Answer
time: 30ms
memory: 3848kb

input:

1998
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 332
8
2
8
0 1338
8
2
8
0 1849
8
2
8
0 1334
8
2
8
1 1334
8
0 250
8
2
8
1 250
8
0 567
8
2
8
0 934
8
2
8
1 934
8
0 1577
8
2
8
1 1577
8
0 187
8
2
8
1 187
8
0 617
8
2
8
0 1590
8
2
8
1 1590
8
0 1482
8
2
8
1 1482
8
0 1892
8
2
8
1 1892
8
0 1184
8
2
8
1 1184
8
0 294
8
2
8
1 294
8
0 67
8
2
8
1 67
8
0 1457...

result:

points 0.99413333330 points  0.99413333330

Test #57:

score: 74.51
Acceptable Answer
time: 81ms
memory: 3936kb

input:

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

output:

8
0 1052
8
2
8
0 1317
8
2
8
1 1317
8
0 1502
8
2
8
0 147
8
2
8
0 436
8
2
8
1 436
8
0 1406
8
2
8
1 1406
8
0 1874
8
2
8
1 1874
8
0 1592
8
2
8
0 135
8
2
8
1 135
8
0 1638
8
2
8
1 1638
8
0 561
8
2
8
0 1883
8
2
8
1 1883
8
0 701
8
2
8
1 701
8
0 1041
8
2
8
1 1041
8
0 957
8
2
8
1 957
8
0 868
8
2
8
1 868
8
0 8...

result:

points 0.99346666670 points  0.99346666670

Test #58:

score: 73.62
Acceptable Answer
time: 93ms
memory: 3804kb

input:

1997
1
1
1
1
2
1
1
2
2
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1898
8
2
8
0 1368
8
2
8
0 1355
8
2
8
0 1151
8
2
8
0 885
8
2
8
1 885
8
0 286
8
2
8
0 1629
8
2
8
0 181
8
2
8
1 181
8
0 910
8
2
8
1 910
8
0 1235
8
2
8
1 1235
8
0 1625
8
2
8
0 96
8
2
8
1 96
8
0 1967
8
2
8
0 1083
8
2
8
1 1083
8
0 1488
8
2
8
0 803
8
2
8
1 803
8
0 1333
8
2
8
1 1333
8
0 1792
8
2
8
0 188...

result:

points 0.98160 points  0.98160

Test #59:

score: 72.83
Acceptable Answer
time: 110ms
memory: 3856kb

input:

1998
1
1
1
2
2
1
1
1
1
2
2
2
1
2
2
1
2
2
2
1
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1208
8
2
8
0 397
8
2
8
0 73
8
2
8
0 360
8
2
8
1 360
8
0 1394
8
2
8
1 1394
8
0 995
8
2
8
0 434
8
2
8
0 1487
8
2
8
0 1581
8
2
8
0 1342
8
2
8
1 1342
8
0 941
8
2
8
1 941
8
0 1742
8
2
8
1 1742
8
0 1147
8
2
8
0 987
8
2
8
1 987
8
0 1523
8
2
8
1 1523
8
0 1155
8
2
8
0 95
8
2
8
1 95
8
0 1469
8
2
8
1 1469
...

result:

points 0.97106666670 points  0.97106666670

Test #60:

score: 72.3
Acceptable Answer
time: 59ms
memory: 3932kb

input:

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

output:

8
0 44
8
2
8
0 1750
8
2
8
0 1165
8
2
8
1 1165
8
0 1291
8
2
8
0 978
8
2
8
0 54
8
2
8
1 54
8
0 391
8
2
8
0 234
8
2
8
0 942
8
2
8
0 542
8
2
8
0 665
8
2
8
0 883
8
2
8
1 883
8
0 1321
8
2
8
0 1184
8
2
8
1 1184
8
0 405
8
2
8
1 405
8
0 145
8
2
8
0 1073
8
2
8
0 1960
8
2
8
1 1960
8
0 675
8
2
8
1 675
8
0 850
8...

result:

points 0.9640 points  0.9640

Test #61:

score: 72.83
Acceptable Answer
time: 60ms
memory: 3940kb

input:

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

output:

8
0 1620
8
2
8
0 185
8
2
8
0 223
8
2
8
1 223
8
0 1766
8
2
8
0 507
8
2
8
0 1554
8
2
8
0 868
8
2
8
1 868
8
0 1546
8
2
8
0 316
8
2
8
0 1132
8
2
8
1 1132
8
0 500
8
2
8
0 1394
8
2
8
0 457
8
2
8
0 896
8
2
8
0 862
8
2
8
1 862
8
0 670
8
2
8
0 752
8
2
8
1 752
8
0 1339
8
2
8
1 1339
8
0 1051
8
2
8
0 243
8
2
8
...

result:

points 0.97106666670 points  0.97106666670

Test #62:

score: 70.74
Acceptable Answer
time: 72ms
memory: 3924kb

input:

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

output:

8
0 1880
8
2
8
0 1391
8
2
8
0 720
8
2
8
0 352
8
2
8
0 689
8
2
8
0 1109
8
2
8
0 1432
8
2
8
0 320
8
2
8
1 320
8
0 1621
8
2
8
0 1311
8
2
8
0 1667
8
2
8
0 1735
8
2
8
1 1735
8
0 1178
8
2
8
0 470
8
2
8
0 58
8
2
8
0 710
8
2
8
0 498
8
2
8
0 650
8
2
8
0 1424
8
2
8
1 1424
8
0 276
8
2
8
0 930
8
2
8
0 755
8
2
8...

result:

points 0.94320 points  0.94320

Test #63:

score: 73.07
Acceptable Answer
time: 58ms
memory: 3812kb

input:

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

output:

8
0 1980
8
2
8
0 1103
8
2
8
0 1992
8
2
8
0 1473
8
2
8
0 148
8
2
8
0 1393
8
2
8
0 1268
8
2
8
0 1040
8
2
8
0 1088
8
2
8
0 1915
8
2
8
0 25
8
2
8
0 64
8
2
8
0 644
8
2
8
0 464
8
2
8
0 1336
8
2
8
0 1318
8
2
8
0 1638
8
2
8
0 744
8
2
8
0 1680
8
2
8
0 292
8
2
8
0 642
8
2
8
1 642
8
0 1844
8
2
8
0 843
8
2
8
0 ...

result:

points 0.97426666670 points  0.97426666670

Test #64:

score: 71.88
Acceptable Answer
time: 62ms
memory: 3900kb

input:

1995
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
2
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
1
1
1
2
2
2
1
2
1
1
1
1
2
1
1
1
1
1
1
2
1
1
2
2
2
2
2
1
1
2
1
2
1
2
1
2
1
1
2
1
2
1
1
1
2
1
2
2
1
1
2
1
2
1
2
1
2
2
2
2
1
1
1
1
1
2
2
1
1
1
2
1
1
2
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
2
2
1
2
1
2
2
2
2
2
2...

output:

8
0 1000
8
2
8
0 1976
8
2
8
0 1459
8
2
8
0 969
8
2
8
0 1768
8
2
8
0 1423
8
2
8
0 1577
8
2
8
0 1285
8
2
8
0 514
8
2
8
0 38
8
2
8
0 52
8
2
8
0 1303
8
2
8
0 1978
8
2
8
0 1901
8
2
8
0 1756
8
2
8
0 1110
8
2
8
0 95
8
2
8
0 1174
8
2
8
0 1474
8
2
8
0 1385
8
2
8
0 90
8
2
8
1 90
8
0 470
8
2
8
1 470
8
0 1191
8...

result:

points 0.95840 points  0.95840

Test #65:

score: 75
Accepted
time: 33ms
memory: 3820kb

input:

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

output:

8
0 1473
8
2
8
0 210
8
2
8
0 1527
8
2
8
0 854
8
2
8
0 1885
8
2
8
0 1701
8
2
8
0 198
8
2
8
0 1374
8
2
8
0 253
8
2
8
0 1291
8
2
8
0 80
8
2
8
0 622
8
2
8
0 367
8
2
8
0 1159
8
2
8
0 791
8
2
8
0 135
8
2
8
0 1938
8
2
8
1 1938
8
0 337
8
2
8
0 269
8
2
8
0 464
8
2
8
0 1054
8
2
8
0 748
8
2
8
0 1361
8
2
8
0 42...

result:

ok 

Test #66:

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

input:

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

output:

8
0 31
8
2
8
0 800
8
2
8
0 128
8
2
8
0 37
8
2
8
0 1346
8
2
8
0 1882
8
2
8
0 1674
8
2
8
0 1361
8
2
8
0 250
8
2
8
0 1282
8
2
8
0 1348
8
2
8
0 534
8
2
8
0 1082
8
2
8
0 454
8
2
8
0 596
8
2
8
0 1596
8
2
8
0 1865
8
2
8
0 148
8
2
8
1 148
8
0 269
8
2
8
0 1022
8
2
8
0 680
8
2
8
0 1179
8
2
8
0 768
8
2
8
0 363...

result:

ok 

Test #67:

score: 75
Accepted
time: 42ms
memory: 3844kb

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

output:

8
0 1219
8
2
8
0 1780
8
2
8
0 1476
8
2
8
0 414
8
2
8
0 47
8
2
8
0 1070
8
2
8
0 1224
8
2
8
0 1030
8
2
8
0 1730
8
2
8
0 169
8
2
8
0 1504
8
2
8
0 447
8
2
8
0 1253
8
2
8
0 1193
8
2
8
0 1838
8
2
8
0 1517
8
2
8
0 466
8
2
8
0 1906
8
2
8
0 1171
8
2
8
0 822
8
2
8
0 775
8
2
8
0 883
8
2
8
0 1897
8
2
8
0 1678
8...

result:

ok 

Test #68:

score: 74.76
Acceptable Answer
time: 35ms
memory: 3844kb

input:

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

output:

8
0 1219
8
2
8
0 1780
8
2
8
0 1476
8
2
8
0 414
8
2
8
1 414
8
0 47
8
2
8
0 1070
8
2
8
0 1224
8
2
8
0 1030
8
2
8
0 1730
8
2
8
0 169
8
2
8
0 1504
8
2
8
0 447
8
2
8
0 1253
8
2
8
0 1193
8
2
8
0 1838
8
2
8
0 1517
8
2
8
0 466
8
2
8
0 1906
8
2
8
0 1171
8
2
8
0 822
8
2
8
0 775
8
2
8
1 775
8
0 883
8
2
8
0 189...

result:

points 0.99680 points  0.99680

Test #69:

score: 74.76
Acceptable Answer
time: 20ms
memory: 3964kb

input:

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

output:

8
0 1532
8
2
8
0 363
8
2
8
0 1967
8
2
8
0 1631
8
2
8
0 693
8
2
8
0 1368
8
2
8
0 258
8
2
8
0 1422
8
2
8
0 1864
8
2
8
0 1414
8
2
8
1 1414
8
0 1224
8
2
8
1 1224
8
0 571
8
2
8
0 278
8
2
8
0 1159
8
2
8
1 1159
8
0 1436
8
2
8
1 1436
8
0 1507
8
2
8
0 1429
8
2
8
0 1011
8
2
8
0 1654
8
2
8
0 1178
8
2
8
1 1178
...

result:

points 0.99680 points  0.99680

Test #70:

score: 74.89
Acceptable Answer
time: 65ms
memory: 3920kb

input:

1979
1
1
1
1
1
1
2
1
1
1
1
2
1
2
1
2
2
1
2
2
2
2
1
2
1
1
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 486
8
2
8
0 1746
8
2
8
0 1710
8
2
8
0 1770
8
2
8
0 717
8
2
8
0 735
8
2
8
0 1385
8
2
8
1 1385
8
0 1012
8
2
8
0 60
8
2
8
0 1093
8
2
8
0 899
8
2
8
0 1945
8
2
8
1 1945
8
0 1553
8
2
8
0 1350
8
2
8
1 1350
8
0 1167
8
2
8
0 1901
8
2
8
1 1901
8
0 1427
8
2
8
1 1427
8
0 1948
8
2
8
0 669
8
2
8
1 669
8
0 354...

result:

points 0.99853333330 points  0.99853333330

Test #71:

score: 74.89
Acceptable Answer
time: 71ms
memory: 3872kb

input:

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

output:

8
0 323
8
2
8
0 192
8
2
8
0 454
8
2
8
0 1505
8
2
8
0 1379
8
2
8
0 629
8
2
8
0 1037
8
2
8
0 1806
8
2
8
0 1626
8
2
8
0 896
8
2
8
1 896
8
0 1635
8
2
8
0 45
8
2
8
1 45
8
0 1780
8
2
8
1 1780
8
0 157
8
2
8
0 1433
8
2
8
1 1433
8
0 76
8
2
8
1 76
8
0 1915
8
2
8
0 1074
8
2
8
0 1112
8
2
8
0 89
8
2
8
1 89
8
0 2...

result:

points 0.99853333330 points  0.99853333330

Test #72:

score: 70.81
Acceptable Answer
time: 67ms
memory: 3928kb

input:

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

output:

8
0 456
8
2
8
0 216
8
2
8
0 1554
8
2
8
0 953
8
2
8
0 1528
8
2
8
0 384
8
2
8
0 129
8
2
8
0 1807
8
2
8
0 798
8
2
8
0 1087
8
2
8
0 1744
8
2
8
0 525
8
2
8
1 525
8
0 1434
8
2
8
0 981
8
2
8
1 981
8
0 1719
8
2
8
0 363
8
2
8
1 363
8
0 846
8
2
8
1 846
8
0 156
8
2
8
0 422
8
2
8
1 422
8
0 1037
8
2
8
0 1024
8
2...

result:

points 0.94413333330 points  0.94413333330

Test #73:

score: 70.81
Acceptable Answer
time: 51ms
memory: 3824kb

input:

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

output:

8
0 149
8
2
8
0 1504
8
2
8
0 1246
8
2
8
0 283
8
2
8
0 1474
8
2
8
0 1500
8
2
8
0 771
8
2
8
0 1241
8
2
8
0 1608
8
2
8
0 1499
8
2
8
0 678
8
2
8
0 739
8
2
8
0 1196
8
2
8
0 1720
8
2
8
0 1239
8
2
8
0 663
8
2
8
0 1223
8
2
8
1 1223
8
0 1309
8
2
8
0 116
8
2
8
1 116
8
0 1628
8
2
8
1 1628
8
0 954
8
2
8
0 1822
...

result:

points 0.94413333330 points  0.94413333330

Test #74:

score: 66.24
Acceptable Answer
time: 67ms
memory: 3912kb

input:

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

output:

8
0 566
8
2
8
0 1694
8
2
8
0 1077
8
2
8
0 310
8
2
8
0 71
8
2
8
0 1392
8
2
8
0 866
8
2
8
0 810
8
2
8
0 1609
8
2
8
0 1538
8
2
8
0 116
8
2
8
1 116
8
0 1596
8
2
8
0 240
8
2
8
0 62
8
2
8
0 1736
8
2
8
0 1778
8
2
8
0 1594
8
2
8
0 1554
8
2
8
0 581
8
2
8
0 1901
8
2
8
0 787
8
2
8
0 1800
8
2
8
0 1734
8
2
8
0 1...

result:

points 0.88320 points  0.88320

Test #75:

score: 66.24
Acceptable Answer
time: 73ms
memory: 3920kb

input:

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

output:

8
0 1280
8
2
8
0 1475
8
2
8
0 1842
8
2
8
0 526
8
2
8
0 1940
8
2
8
0 245
8
2
8
0 737
8
2
8
0 836
8
2
8
0 1010
8
2
8
0 558
8
2
8
0 206
8
2
8
0 1414
8
2
8
0 1600
8
2
8
0 1723
8
2
8
0 1268
8
2
8
0 1889
8
2
8
0 178
8
2
8
1 178
8
0 1533
8
2
8
0 500
8
2
8
0 1894
8
2
8
0 1091
8
2
8
0 563
8
2
8
1 563
8
0 151...

result:

points 0.88320 points  0.88320

Test #76:

score: 74.9
Acceptable Answer
time: 53ms
memory: 3808kb

input:

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

output:

8
0 1627
8
2
8
0 1512
8
2
8
0 1345
8
2
8
0 957
8
2
8
0 281
8
2
8
0 234
8
2
8
0 831
8
2
8
0 1811
8
2
8
0 546
8
2
8
1 546
8
0 1152
8
2
8
0 1946
8
2
8
0 276
8
2
8
0 1608
8
2
8
1 1608
8
0 143
8
2
8
0 93
8
2
8
0 1672
8
2
8
0 407
8
2
8
1 407
8
0 1187
8
2
8
0 1686
8
2
8
1 1686
8
0 1446
8
2
8
0 998
8
2
8
1 ...

result:

points 0.99866666670 points  0.99866666670

Test #77:

score: 74.9
Acceptable Answer
time: 32ms
memory: 3864kb

input:

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

output:

8
0 1151
8
2
8
0 1862
8
2
8
0 674
8
2
8
0 974
8
2
8
0 130
8
2
8
0 1313
8
2
8
0 1828
8
2
8
0 1191
8
2
8
0 352
8
2
8
0 632
8
2
8
0 1510
8
2
8
0 802
8
2
8
0 1448
8
2
8
1 1448
8
0 199
8
2
8
0 1504
8
2
8
0 76
8
2
8
0 16
8
2
8
0 263
8
2
8
1 263
8
0 206
8
2
8
0 1837
8
2
8
0 1347
8
2
8
0 211
8
2
8
0 1825
8
...

result:

points 0.99866666670 points  0.99866666670

Test #78:

score: 70.81
Acceptable Answer
time: 41ms
memory: 3848kb

input:

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

output:

8
0 1123
8
2
8
0 922
8
2
8
0 1914
8
2
8
0 811
8
2
8
0 1164
8
2
8
0 1103
8
2
8
0 446
8
2
8
0 1546
8
2
8
0 1536
8
2
8
1 1536
8
0 127
8
2
8
0 995
8
2
8
0 1037
8
2
8
0 785
8
2
8
0 1023
8
2
8
0 804
8
2
8
1 804
8
0 906
8
2
8
0 1911
8
2
8
0 1607
8
2
8
0 670
8
2
8
1 670
8
0 763
8
2
8
0 1213
8
2
8
1 1213
8
0...

result:

points 0.94413333330 points  0.94413333330

Test #79:

score: 70.81
Acceptable Answer
time: 50ms
memory: 3932kb

input:

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

output:

8
0 1077
8
2
8
0 1586
8
2
8
0 170
8
2
8
1 170
8
0 1923
8
2
8
0 231
8
2
8
0 1171
8
2
8
0 1090
8
2
8
0 1575
8
2
8
0 1360
8
2
8
0 118
8
2
8
0 1514
8
2
8
0 1380
8
2
8
0 1414
8
2
8
0 1236
8
2
8
0 576
8
2
8
0 330
8
2
8
1 330
8
0 1051
8
2
8
0 1456
8
2
8
0 1106
8
2
8
0 540
8
2
8
0 966
8
2
8
0 1428
8
2
8
0 5...

result:

points 0.94413333330 points  0.94413333330

Test #80:

score: 74.8
Acceptable Answer
time: 39ms
memory: 3944kb

input:

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

output:

8
0 1493
8
2
8
0 786
8
2
8
0 133
8
2
8
0 938
8
2
8
0 1806
8
2
8
0 1301
8
2
8
0 1766
8
2
8
0 1473
8
2
8
0 716
8
2
8
1 716
8
0 1812
8
2
8
0 1633
8
2
8
0 852
8
2
8
0 1913
8
2
8
0 71
8
2
8
0 143
8
2
8
0 1791
8
2
8
0 1541
8
2
8
0 537
8
2
8
1 537
8
0 151
8
2
8
0 1909
8
2
8
0 259
8
2
8
0 1971
8
2
8
0 846
8...

result:

points 0.99733333330 points  0.99733333330

Test #81:

score: 74.8
Acceptable Answer
time: 29ms
memory: 3868kb

input:

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

output:

8
0 1223
8
2
8
0 546
8
2
8
0 354
8
2
8
0 1394
8
2
8
0 1794
8
2
8
0 1096
8
2
8
0 347
8
2
8
0 503
8
2
8
0 1330
8
2
8
1 1330
8
0 1553
8
2
8
0 1353
8
2
8
0 1531
8
2
8
0 915
8
2
8
0 918
8
2
8
0 352
8
2
8
0 988
8
2
8
0 931
8
2
8
0 1435
8
2
8
0 1902
8
2
8
0 269
8
2
8
1 269
8
0 200
8
2
8
0 1660
8
2
8
0 1737...

result:

points 0.99733333330 points  0.99733333330

Test #82:

score: 74.93
Acceptable Answer
time: 31ms
memory: 3940kb

input:

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

output:

8
0 1854
8
2
8
0 290
8
2
8
0 884
8
2
8
0 988
8
2
8
1 988
8
0 1518
8
2
8
0 1811
8
2
8
0 1220
8
2
8
0 454
8
2
8
0 1588
8
2
8
0 727
8
2
8
1 727
8
0 1921
8
2
8
0 1109
8
2
8
0 1869
8
2
8
1 1869
8
0 1432
8
2
8
0 895
8
2
8
0 1800
8
2
8
0 1726
8
2
8
0 81
8
2
8
0 1529
8
2
8
0 745
8
2
8
1 745
8
0 33
8
2
8
0 1...

result:

points 0.99906666670 points  0.99906666670

Test #83:

score: 74.93
Acceptable Answer
time: 69ms
memory: 3948kb

input:

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

output:

8
0 391
8
2
8
0 445
8
2
8
0 1232
8
2
8
0 1061
8
2
8
0 1604
8
2
8
0 891
8
2
8
0 254
8
2
8
0 120
8
2
8
0 434
8
2
8
0 425
8
2
8
0 834
8
2
8
1 834
8
0 1068
8
2
8
0 984
8
2
8
0 316
8
2
8
0 978
8
2
8
0 92
8
2
8
0 333
8
2
8
1 333
8
0 690
8
2
8
0 1740
8
2
8
0 1468
8
2
8
0 959
8
2
8
0 8
8
2
8
0 1194
8
2
8
1 ...

result:

points 0.99906666670 points  0.99906666670

Test #84:

score: 45.61
Acceptable Answer
time: 16ms
memory: 3880kb

input:

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

output:

8
0 391
8
2
8
0 445
8
2
8
1 445
8
0 336
8
2
8
0 87
8
2
8
1 87
8
0 294
8
2
8
1 294
8
0 50
8
2
8
1 50
8
0 254
8
2
8
1 254
8
0 120
8
2
8
1 120
8
0 434
8
2
8
1 434
8
0 425
8
2
8
1 425
8
0 214
8
2
8
1 214
8
0 11
8
2
8
1 11
8
0 323
8
2
8
1 323
8
0 316
8
2
8
1 316
8
0 282
8
2
8
1 282
8
0 92
8
2
8
1 92
8
0 ...

result:

points 0.60813333330 points  0.60813333330

Test #85:

score: 32.28
Acceptable Answer
time: 123ms
memory: 3880kb

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

output:

8
0 1531
8
2
8
0 457
8
2
8
1 457
8
0 653
8
2
8
1 653
8
0 1289
8
2
8
1 1289
8
0 1172
8
2
8
1 1172
8
0 1106
8
2
8
1 1106
8
0 550
8
2
8
0 1484
8
2
8
1 1484
8
0 749
8
2
8
1 749
8
0 93
8
2
8
1 93
8
0 1683
8
2
8
1 1683
8
0 173
8
2
8
1 173
8
0 191
8
2
8
1 191
8
0 909
8
2
8
1 909
8
0 821
8
2
8
1 821
8
0 538...

result:

points 0.43040 points  0.43040

Test #86:

score: 75
Accepted
time: 41ms
memory: 3936kb

input:

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

output:

8
0 678
8
2
8
0 1
8
2
8
1 1
8
0 297
8
2
8
0 1727
8
2
8
1 1727
8
0 514
8
2
8
1 514
8
0 1126
8
2
8
1 1126
8
0 1729
8
2
8
1 1729
8
0 332
8
2
8
1 332
8
0 1412
8
2
8
1 1412
8
0 1917
8
2
8
1 1917
8
0 459
8
2
8
1 459
8
0 1134
8
2
8
1 1134
8
0 519
8
2
8
1 519
8
0 556
8
2
8
1 556
8
0 1804
8
2
8
1 1804
8
0 10...

result:

ok 

Test #87:

score: 75
Accepted
time: 57ms
memory: 3768kb

input:

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

output:

8
0 1308
8
2
8
0 1240
8
2
8
0 1597
8
2
8
0 689
8
2
8
0 132
8
2
8
1 132
8
0 1030
8
2
8
0 384
8
2
8
1 384
8
0 131
8
2
8
1 131
8
0 865
8
2
8
1 865
8
0 660
8
2
8
1 660
8
0 582
8
2
8
1 582
8
0 1171
8
2
8
0 128
8
2
8
1 128
8
0 351
8
2
8
1 351
8
0 374
8
2
8
1 374
8
0 1067
8
2
8
0 595
8
2
8
1 595
8
0 1279
8...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1308
8
2
8
0 1240
8
2
8
1 1240
8
0 1597
8
2
8
1 1597
8
0 689
8
2
8
0 132
8
2
8
0 1030
8
2
8
1 1030
8
0 384
8
2
8
0 131
8
2
8
0 865
8
2
8
0 660
8
2
8
0 582
8
2
8
0 1171
8
2
8
1 1171
8
0 128
8
2
8
0 351
8
2
8
0 374
8
2
8
0 1067
8
2
8
1 1067
8
0 595
8
2
8
0 1279
8
2
8
1 1279
8
0 1120
8
2
8
1 1120
8...

result:

ok 

Test #89:

score: 75
Accepted
time: 49ms
memory: 3932kb

input:

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

output:

8
0 402
8
2
8
0 272
8
2
8
1 272
8
0 1085
8
2
8
0 1236
8
2
8
0 502
8
2
8
0 1561
8
2
8
1 1561
8
0 1377
8
2
8
0 1801
8
2
8
1 1801
8
0 355
8
2
8
1 355
8
0 78
8
2
8
1 78
8
0 218
8
2
8
1 218
8
0 909
8
2
8
0 805
8
2
8
0 614
8
2
8
0 840
8
2
8
0 117
8
2
8
1 117
8
0 1938
8
2
8
1 1938
8
0 352
8
2
8
1 352
8
0 1...

result:

ok