QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#45958#4565. Rarest InsectsZhangYiDe99.17 87ms3896kbC++175.7kb2022-08-24 18:46:132022-08-24 18:49:32

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
2
1
2
2
1
1
2
2
1

output:

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

result:

ok 

Test #2:

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

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
2
1
2
1
2
1
2
2

output:

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

result:

ok 

Test #6:

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

input:

8
1
1
1
2
2
2
2
2
1
2
2
1
2
2
2
1

output:

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

result:

ok 

Test #7:

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

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 154
8
2
8
0 57
8
2
8
1 57
8
0 11
8
2
8
1 11
8
0 28
8
2
8
1 28
8
0 72
8
2
8
1 72
8
0 55
8
2
8
1 55
8
0 146
8
2
8
1 146
8
0 34
8
2
8
1 34
8
0 176
8
2
8
1 176
8
0 60
8
2
8
1 60
8
0 65
8
2
8
1 65
8
0 66
8
2
8
1 66
8
0 163
8
2
8
1 163
8
0 38
8
2
8
1 38
8
0 107
8
2
8
1 107
8
0 147
8
2
8
1 147
8
0 37
8...

result:

ok 

Test #8:

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

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 99
8
2
8
0 161
8
2
8
0 173
8
2
8
0 5
8
2
8
0 104
8
2
8
0 48
8
2
8
0 92
8
2
8
0 4
8
2
8
0 160
8
2
8
0 140
8
2
8
0 101
8
2
8
0 74
8
2
8
0 89
8
2
8
0 62
8
2
8
0 126
8
2
8
0 198
8
2
8
0 56
8
2
8
0 132
8
2
8
0 167
8
2
8
0 197
8
2
8
0 58
8
2
8
0 47
8
2
8
0 73
8
2
8
0 151
8
2
8
0 115
8
2
8
0 31
8
2
8
0...

result:

ok 

Test #9:

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

input:

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

output:

8
0 59
8
2
8
0 178
8
2
8
1 178
8
0 10
8
2
8
0 94
8
2
8
0 74
8
2
8
0 119
8
2
8
0 182
8
2
8
1 182
8
0 172
8
2
8
0 139
8
2
8
1 139
8
0 34
8
2
8
0 177
8
2
8
0 179
8
2
8
1 179
8
0 189
8
2
8
1 189
8
0 196
8
2
8
1 196
8
0 78
8
2
8
1 78
8
0 173
8
2
8
1 173
8
0 131
8
2
8
1 131
8
0 5
8
2
8
1 5
8
0 145
8
2
8
1...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
2
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
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 103
8
2
8
0 194
8
2
8
0 183
8
2
8
0 76
8
2
8
0 64
8
2
8
1 64
8
0 23
8
2
8
0 196
8
2
8
1 196
8
0 35
8
2
8
0 57
8
2
8
1 57
8
0 78
8
2
8
1 78
8
0 58
8
2
8
1 58
8
0 66
8
2
8
0 11
8
2
8
1 11
8
0 139
8
2
8
1 139
8
0 8
8
2
8
0 184
8
2
8
1 184
8
0 179
8
2
8
0 88
8
2
8
1 88
8
0 98
8
2
8
1 98
8
0 62
8
2
8...

result:

ok 

Test #11:

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

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

output:

8
0 57
8
2
8
0 117
8
2
8
1 117
8
0 177
8
2
8
1 177
8
0 22
8
2
8
1 22
8
0 185
8
2
8
1 185
8
0 58
8
2
8
1 58
8
0 126
8
2
8
1 126
8
0 28
8
2
8
1 28
8
0 187
8
2
8
1 187
8
0 72
8
2
8
1 72
8
0 14
8
2
8
1 14
8
0 17
8
2
8
1 17
8
0 142
8
2
8
1 142
8
0 49
8
2
8
1 49
8
0 180
8
2
8
1 180
8
0 74
8
2
8
1 74
8
0 7...

result:

ok 

Test #12:

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

input:

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

output:

8
0 19
8
2
8
0 78
8
2
8
0 163
8
2
8
1 163
8
0 150
8
2
8
0 165
8
2
8
0 182
8
2
8
1 182
8
0 16
8
2
8
1 16
8
0 92
8
2
8
1 92
8
0 129
8
2
8
1 129
8
0 88
8
2
8
0 55
8
2
8
1 55
8
0 183
8
2
8
1 183
8
0 74
8
2
8
0 134
8
2
8
0 9
8
2
8
1 9
8
0 158
8
2
8
1 158
8
0 185
8
2
8
0 68
8
2
8
1 68
8
0 12
8
2
8
1 12
8
...

result:

ok 

Test #13:

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

input:

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

output:

8
0 13
8
2
8
0 90
8
2
8
0 62
8
2
8
0 93
8
2
8
0 155
8
2
8
1 155
8
0 26
8
2
8
1 26
8
0 156
8
2
8
1 156
8
0 173
8
2
8
1 173
8
0 27
8
2
8
1 27
8
0 92
8
2
8
1 92
8
0 113
8
2
8
1 113
8
0 91
8
2
8
1 91
8
0 61
8
2
8
1 61
8
0 146
8
2
8
1 146
8
0 33
8
2
8
1 33
8
0 55
8
2
8
1 55
8
0 81
8
2
8
1 81
8
0 159
8
2
...

result:

ok 

Test #14:

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

input:

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

output:

8
0 162
8
2
8
0 104
8
2
8
0 82
8
2
8
0 66
8
2
8
1 66
8
0 1
8
2
8
0 3
8
2
8
0 39
8
2
8
1 39
8
0 72
8
2
8
1 72
8
0 190
8
2
8
0 68
8
2
8
1 68
8
0 174
8
2
8
1 174
8
0 113
8
2
8
0 62
8
2
8
1 62
8
0 83
8
2
8
1 83
8
0 133
8
2
8
1 133
8
0 105
8
2
8
0 153
8
2
8
0 67
8
2
8
1 67
8
0 112
8
2
8
0 50
8
2
8
1 50
8...

result:

ok 

Test #15:

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

input:

200
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 28
8
2
8
0 141
8
2
8
0 136
8
2
8
0 140
8
2
8
1 140
8
0 8
8
2
8
1 8
8
0 74
8
2
8
1 74
8
0 194
8
2
8
0 58
8
2
8
0 182
8
2
8
1 182
8
0 18
8
2
8
1 18
8
0 168
8
2
8
1 168
8
0 104
8
2
8
1 104
8
0 11
8
2
8
1 11
8
0 151
8
2
8
1 151
8
0 95
8
2
8
1 95
8
0 162
8
2
8
1 162
8
0 20
8
2
8
1 20
8
0 65
8
2
8
1 6...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
1
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 19
8
2
8
0 176
8
2
8
0 151
8
2
8
0 129
8
2
8
0 158
8
2
8
0 67
8
2
8
1 67
8
0 38
8
2
8
1 38
8
0 47
8
2
8
0 145
8
2
8
1 145
8
0 64
8
2
8
1 64
8
0 189
8
2
8
0 75
8
2
8
1 75
8
0 71
8
2
8
1 71
8
0 90
8
2
8
1 90
8
0 53
8
2
8
1 53
8
0 113
8
2
8
1 113
8
0 109
8
2
8
1 109
8
0 134
8
2
8
1 134
8
0 190
8
2
...

result:

ok 

Test #17:

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

input:

199
1
1
1
1
1
2
2
2
1
2
2
2
2
2
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
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 66
8
2
8
0 51
8
2
8
0 157
8
2
8
0 160
8
2
8
0 168
8
2
8
0 151
8
2
8
1 151
8
0 172
8
2
8
1 172
8
0 40
8
2
8
1 40
8
0 25
8
2
8
0 23
8
2
8
1 23
8
0 192
8
2
8
1 192
8
0 6
8
2
8
1 6
8
0 42
8
2
8
1 42
8
0 17
8
2
8
1 17
8
0 70
8
2
8
0 91
8
2
8
1 91
8
0 197
8
2
8
1 197
8
0 3
8
2
8
1 3
8
0 68
8
2
8
1 68
...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
1
1
1
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 178
8
2
8
0 124
8
2
8
0 175
8
2
8
0 143
8
2
8
0 43
8
2
8
0 64
8
2
8
0 99
8
2
8
0 173
8
2
8
0 71
8
2
8
0 154
8
2
8
1 154
8
0 29
8
2
8
1 29
8
0 33
8
2
8
0 6
8
2
8
1 6
8
0 49
8
2
8
1 49
8
0 89
8
2
8
1 89
8
0 47
8
2
8
0 37
8
2
8
1 37
8
0 167
8
2
8
1 167
8
0 103
8
2
8
1 103
8
0 44
8
2
8
0 96
8
2
8
1 ...

result:

ok 

Test #19:

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

input:

196
1
1
1
1
1
1
2
1
2
2
1
1
2
1
1
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
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 44
8
2
8
0 108
8
2
8
0 8
8
2
8
0 185
8
2
8
0 98
8
2
8
0 85
8
2
8
0 25
8
2
8
1 25
8
0 138
8
2
8
0 183
8
2
8
1 183
8
0 26
8
2
8
1 26
8
0 6
8
2
8
0 126
8
2
8
0 111
8
2
8
1 111
8
0 190
8
2
8
0 157
8
2
8
0 143
8
2
8
0 149
8
2
8
1 149
8
0 112
8
2
8
0 135
8
2
8
1 135
8
0 175
8
2
8
1 175
8
0 106
8
2
8
1...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
2
1
1
2
2
2
2
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 176
8
2
8
0 174
8
2
8
0 91
8
2
8
0 126
8
2
8
0 153
8
2
8
0 12
8
2
8
0 17
8
2
8
1 17
8
0 0
8
2
8
0 177
8
2
8
0 9
8
2
8
1 9
8
0 43
8
2
8
1 43
8
0 111
8
2
8
1 111
8
0 55
8
2
8
1 55
8
0 164
8
2
8
1 164
8
0 41
8
2
8
1 41
8
0 133
8
2
8
0 183
8
2
8
0 89
8
2
8
1 89
8
0 178
8
2
8
1 178
8
0 61
8
2
8
1 61
...

result:

ok 

Test #21:

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

input:

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

output:

8
0 186
8
2
8
0 167
8
2
8
0 159
8
2
8
0 189
8
2
8
0 30
8
2
8
0 157
8
2
8
0 176
8
2
8
0 36
8
2
8
0 108
8
2
8
0 3
8
2
8
0 41
8
2
8
0 175
8
2
8
1 175
8
0 23
8
2
8
1 23
8
0 55
8
2
8
0 16
8
2
8
0 52
8
2
8
0 181
8
2
8
1 181
8
0 99
8
2
8
0 188
8
2
8
1 188
8
0 88
8
2
8
0 142
8
2
8
0 117
8
2
8
0 168
8
2
8
0 ...

result:

ok 

Test #22:

score: 0
Accepted
time: 4ms
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
1
1
1
1
1
1
2
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
2
1
2
2
1
1
1
1
1
1
1
1
2
1
2
2
1
2
1
1
1
2
2
1
2
2
2
1
2
2
2
1
1
1
2
2
1
1
2
2
2
1
2
2
2
2
1
2
2
1
2
2
2
2
1
2
2
1
2
1
1
2
2
1
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
1
1
2
2
1
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
1
...

output:

8
0 26
8
2
8
0 185
8
2
8
0 144
8
2
8
0 160
8
2
8
0 154
8
2
8
0 87
8
2
8
0 75
8
2
8
0 55
8
2
8
0 31
8
2
8
0 108
8
2
8
0 151
8
2
8
0 33
8
2
8
0 194
8
2
8
0 13
8
2
8
0 22
8
2
8
0 44
8
2
8
0 76
8
2
8
0 7
8
2
8
0 10
8
2
8
0 192
8
2
8
0 138
8
2
8
0 181
8
2
8
0 178
8
2
8
0 6
8
2
8
0 0
8
2
8
0 8
8
2
8
0 89
...

result:

ok 

Test #23:

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

input:

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

output:

8
0 167
8
2
8
0 186
8
2
8
0 15
8
2
8
0 163
8
2
8
0 181
8
2
8
0 193
8
2
8
0 135
8
2
8
0 171
8
2
8
0 12
8
2
8
0 81
8
2
8
0 190
8
2
8
0 86
8
2
8
0 6
8
2
8
0 16
8
2
8
0 33
8
2
8
0 71
8
2
8
1 71
8
0 158
8
2
8
0 131
8
2
8
0 117
8
2
8
0 182
8
2
8
0 148
8
2
8
0 62
8
2
8
0 121
8
2
8
0 89
8
2
8
0 63
8
2
8
1 6...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 28ms
memory: 3776kb

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 706
8
2
8
0 141
8
2
8
1 141
8
0 539
8
2
8
1 539
8
0 18
8
2
8
1 18
8
0 300
8
2
8
1 300
8
0 354
8
2
8
1 354
8
0 287
8
2
8
1 287
8
0 666
8
2
8
1 666
8
0 274
8
2
8
1 274
8
0 321
8
2
8
1 321
8
0 352
8
2
8
1 352
8
0 332
8
2
8
1 332
8
0 373
8
2
8
1 373
8
0 43
8
2
8
1 43
8
0 97
8
2
8
1 97
8
0 429
8
2
8
...

result:

ok 

Test #25:

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

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 578
8
2
8
0 150
8
2
8
0 214
8
2
8
0 57
8
2
8
0 910
8
2
8
0 690
8
2
8
0 784
8
2
8
0 600
8
2
8
0 783
8
2
8
0 506
8
2
8
0 301
8
2
8
0 47
8
2
8
0 171
8
2
8
0 62
8
2
8
0 576
8
2
8
0 162
8
2
8
0 802
8
2
8
0 799
8
2
8
0 154
8
2
8
0 780
8
2
8
0 339
8
2
8
0 423
8
2
8
0 950
8
2
8
0 5
8
2
8
0 754
8
2
8
0 1...

result:

ok 

Test #26:

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

input:

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

output:

8
0 702
8
2
8
0 511
8
2
8
0 10
8
2
8
0 744
8
2
8
0 968
8
2
8
0 554
8
2
8
0 308
8
2
8
1 308
8
0 546
8
2
8
0 998
8
2
8
0 902
8
2
8
0 889
8
2
8
0 30
8
2
8
1 30
8
0 172
8
2
8
0 525
8
2
8
1 525
8
0 986
8
2
8
1 986
8
0 156
8
2
8
0 741
8
2
8
0 60
8
2
8
1 60
8
0 839
8
2
8
1 839
8
0 401
8
2
8
1 401
8
0 375
8...

result:

ok 

Test #27:

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

input:

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

output:

8
0 746
8
2
8
0 325
8
2
8
0 273
8
2
8
0 221
8
2
8
1 221
8
0 627
8
2
8
0 309
8
2
8
1 309
8
0 929
8
2
8
0 498
8
2
8
0 216
8
2
8
0 439
8
2
8
0 895
8
2
8
1 895
8
0 674
8
2
8
0 80
8
2
8
0 682
8
2
8
0 209
8
2
8
1 209
8
0 342
8
2
8
0 619
8
2
8
1 619
8
0 766
8
2
8
0 232
8
2
8
1 232
8
0 956
8
2
8
0 702
8
2
8...

result:

ok 

Test #28:

score: 0
Accepted
time: 23ms
memory: 3832kb

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 852
8
2
8
0 529
8
2
8
1 529
8
0 880
8
2
8
1 880
8
0 28
8
2
8
1 28
8
0 609
8
2
8
1 609
8
0 318
8
2
8
1 318
8
0 928
8
2
8
1 928
8
0 135
8
2
8
1 135
8
0 74
8
2
8
1 74
8
0 645
8
2
8
1 645
8
0 107
8
2
8
1 107
8
0 829
8
2
8
1 829
8
0 582
8
2
8
1 582
8
0 883
8
2
8
1 883
8
0 553
8
2
8
1 553
8
0 652
8
2
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 79
8
2
8
0 441
8
2
8
0 40
8
2
8
0 405
8
2
8
0 791
8
2
8
0 78
8
2
8
1 78
8
0 621
8
2
8
0 581
8
2
8
1 581
8
0 407
8
2
8
0 428
8
2
8
0 465
8
2
8
1 465
8
0 531
8
2
8
1 531
8
0 242
8
2
8
0 14
8
2
8
0 699
8
2
8
0 375
8
2
8
1 375
8
0 378
8
2
8
1 378
8
0 224
8
2
8
0 223
8
2
8
0 230
8
2
8
0 814
8
2
8
1 8...

result:

ok 

Test #30:

score: 0
Accepted
time: 46ms
memory: 3872kb

input:

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

output:

8
0 297
8
2
8
0 750
8
2
8
0 436
8
2
8
1 436
8
0 702
8
2
8
1 702
8
0 738
8
2
8
1 738
8
0 849
8
2
8
0 996
8
2
8
1 996
8
0 489
8
2
8
1 489
8
0 68
8
2
8
1 68
8
0 152
8
2
8
1 152
8
0 414
8
2
8
0 652
8
2
8
1 652
8
0 423
8
2
8
1 423
8
0 685
8
2
8
1 685
8
0 330
8
2
8
1 330
8
0 29
8
2
8
1 29
8
0 912
8
2
8
1 ...

result:

ok 

Test #31:

score: 0
Accepted
time: 36ms
memory: 3780kb

input:

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

output:

8
0 590
8
2
8
0 474
8
2
8
0 571
8
2
8
0 455
8
2
8
1 455
8
0 45
8
2
8
0 935
8
2
8
0 857
8
2
8
0 685
8
2
8
0 972
8
2
8
0 516
8
2
8
0 525
8
2
8
0 816
8
2
8
0 508
8
2
8
1 508
8
0 619
8
2
8
0 281
8
2
8
0 340
8
2
8
0 797
8
2
8
0 316
8
2
8
1 316
8
0 129
8
2
8
0 655
8
2
8
0 547
8
2
8
1 547
8
0 102
8
2
8
0 5...

result:

ok 

Test #32:

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

input:

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

output:

8
0 72
8
2
8
0 603
8
2
8
1 603
8
0 998
8
2
8
1 998
8
0 635
8
2
8
0 820
8
2
8
0 45
8
2
8
1 45
8
0 449
8
2
8
1 449
8
0 368
8
2
8
0 253
8
2
8
1 253
8
0 686
8
2
8
1 686
8
0 835
8
2
8
1 835
8
0 653
8
2
8
1 653
8
0 167
8
2
8
1 167
8
0 504
8
2
8
1 504
8
0 324
8
2
8
1 324
8
0 612
8
2
8
1 612
8
0 827
8
2
8
1...

result:

ok 

Test #33:

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

input:

996
1
1
2
1
1
2
1
1
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
2
2
2
2
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 635
8
2
8
0 419
8
2
8
0 324
8
2
8
1 324
8
0 931
8
2
8
0 660
8
2
8
0 577
8
2
8
1 577
8
0 538
8
2
8
0 631
8
2
8
0 123
8
2
8
0 338
8
2
8
1 338
8
0 420
8
2
8
1 420
8
0 625
8
2
8
1 625
8
0 201
8
2
8
1 201
8
0 866
8
2
8
1 866
8
0 100
8
2
8
1 100
8
0 702
8
2
8
1 702
8
0 658
8
2
8
1 658
8
0 497
8
2
8
1 ...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 385
8
2
8
0 340
8
2
8
0 585
8
2
8
0 353
8
2
8
0 653
8
2
8
0 373
8
2
8
0 797
8
2
8
0 784
8
2
8
0 366
8
2
8
1 366
8
0 692
8
2
8
1 692
8
0 533
8
2
8
1 533
8
0 181
8
2
8
0 920
8
2
8
1 920
8
0 298
8
2
8
1 298
8
0 786
8
2
8
1 786
8
0 319
8
2
8
1 319
8
0 557
8
2
8
1 557
8
0 212
8
2
8
1 212
8
0 900
8
2
...

result:

ok 

Test #35:

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

input:

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

output:

8
0 318
8
2
8
0 336
8
2
8
0 905
8
2
8
0 158
8
2
8
1 158
8
0 771
8
2
8
0 620
8
2
8
0 443
8
2
8
0 79
8
2
8
1 79
8
0 932
8
2
8
0 0
8
2
8
0 331
8
2
8
1 331
8
0 913
8
2
8
1 913
8
0 78
8
2
8
0 676
8
2
8
1 676
8
0 474
8
2
8
1 474
8
0 648
8
2
8
0 249
8
2
8
1 249
8
0 62
8
2
8
1 62
8
0 473
8
2
8
1 473
8
0 159...

result:

ok 

Test #36:

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

input:

997
1
1
1
1
2
2
1
2
2
1
1
2
2
1
1
1
2
2
2
2
1
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
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 384
8
2
8
0 924
8
2
8
0 690
8
2
8
0 393
8
2
8
0 309
8
2
8
1 309
8
0 179
8
2
8
1 179
8
0 967
8
2
8
0 230
8
2
8
1 230
8
0 32
8
2
8
1 32
8
0 756
8
2
8
0 682
8
2
8
0 541
8
2
8
1 541
8
0 894
8
2
8
1 894
8
0 145
8
2
8
0 547
8
2
8
0 308
8
2
8
0 110
8
2
8
1 110
8
0 96
8
2
8
1 96
8
0 481
8
2
8
1 481
8
0 ...

result:

ok 

Test #37:

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

input:

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

output:

8
0 852
8
2
8
0 618
8
2
8
0 170
8
2
8
1 170
8
0 93
8
2
8
1 93
8
0 827
8
2
8
0 520
8
2
8
0 361
8
2
8
0 362
8
2
8
0 586
8
2
8
0 363
8
2
8
0 208
8
2
8
0 705
8
2
8
1 705
8
0 136
8
2
8
1 136
8
0 845
8
2
8
1 845
8
0 33
8
2
8
1 33
8
0 881
8
2
8
1 881
8
0 226
8
2
8
0 545
8
2
8
1 545
8
0 117
8
2
8
1 117
8
0 ...

result:

ok 

Test #38:

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

input:

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

output:

8
0 478
8
2
8
0 955
8
2
8
0 231
8
2
8
0 48
8
2
8
0 267
8
2
8
1 267
8
0 302
8
2
8
0 895
8
2
8
0 748
8
2
8
0 704
8
2
8
0 625
8
2
8
0 537
8
2
8
0 335
8
2
8
0 294
8
2
8
0 186
8
2
8
1 186
8
0 792
8
2
8
0 797
8
2
8
0 853
8
2
8
0 136
8
2
8
1 136
8
0 983
8
2
8
0 466
8
2
8
1 466
8
0 671
8
2
8
0 764
8
2
8
1 7...

result:

ok 

Test #39:

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

input:

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

output:

8
0 616
8
2
8
0 549
8
2
8
0 380
8
2
8
0 923
8
2
8
0 263
8
2
8
0 141
8
2
8
0 375
8
2
8
0 533
8
2
8
0 377
8
2
8
1 377
8
0 762
8
2
8
0 600
8
2
8
0 626
8
2
8
1 626
8
0 595
8
2
8
0 821
8
2
8
1 821
8
0 512
8
2
8
1 512
8
0 197
8
2
8
0 279
8
2
8
0 207
8
2
8
0 763
8
2
8
0 862
8
2
8
1 862
8
0 467
8
2
8
0 928
...

result:

ok 

Test #40:

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

input:

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

output:

8
0 732
8
2
8
0 411
8
2
8
0 323
8
2
8
0 68
8
2
8
0 330
8
2
8
0 480
8
2
8
0 333
8
2
8
0 443
8
2
8
0 863
8
2
8
0 427
8
2
8
0 778
8
2
8
0 420
8
2
8
0 757
8
2
8
0 819
8
2
8
0 75
8
2
8
0 460
8
2
8
0 688
8
2
8
0 803
8
2
8
0 991
8
2
8
0 573
8
2
8
0 982
8
2
8
0 906
8
2
8
0 878
8
2
8
1 878
8
0 95
8
2
8
0 513...

result:

ok 

Test #41:

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

input:

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

output:

8
0 496
8
2
8
0 43
8
2
8
1 43
8
0 382
8
2
8
0 403
8
2
8
0 699
8
2
8
0 388
8
2
8
0 31
8
2
8
0 292
8
2
8
0 703
8
2
8
0 777
8
2
8
0 535
8
2
8
0 713
8
2
8
0 690
8
2
8
0 193
8
2
8
0 421
8
2
8
0 749
8
2
8
0 26
8
2
8
0 235
8
2
8
0 934
8
2
8
0 883
8
2
8
0 940
8
2
8
0 628
8
2
8
0 689
8
2
8
0 700
8
2
8
0 265
...

result:

ok 

Test #42:

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

input:

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

output:

8
0 55
8
2
8
0 910
8
2
8
0 222
8
2
8
0 470
8
2
8
0 468
8
2
8
0 567
8
2
8
0 919
8
2
8
0 417
8
2
8
0 284
8
2
8
0 176
8
2
8
0 519
8
2
8
0 333
8
2
8
0 988
8
2
8
0 397
8
2
8
0 615
8
2
8
0 6
8
2
8
0 708
8
2
8
0 445
8
2
8
0 576
8
2
8
1 576
8
0 967
8
2
8
0 830
8
2
8
0 814
8
2
8
1 814
8
0 414
8
2
8
0 923
8
2...

result:

ok 

Subtask #3:

score: 74.17
Acceptable Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

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

result:

ok 

Test #46:

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

input:

6
1
1
2
2
2
2
1
2
2
2
2
1

output:

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

result:

ok 

Test #47:

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

input:

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

output:

8
0 5
8
2
8
0 3
8
2
8
0 0
8
2
8
1 0
8
0 4
8
2
8
1 4
8
0 1
8
2
8
1 1
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 8
8
2
8
1 8
8
0 9
8
2
8
1 9
8
1 5
8
1 3
8
0 9
8
2
8
0 8
8
2
8
0 7
8
2
8
0 2
8
2
8
0 6
8
2
8
1 6
8
0 1
8
2
8
1 1
8
0 4
8
2
8
1 4
8
0 0
8
2
8
1 0
8
0 3
8
2
8
1 3
8
0 5
8
2
8
1 5
8
0 ...

result:

ok 

Test #48:

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

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 1178
8
2
8
0 566
8
2
8
1 566
8
0 576
8
2
8
1 576
8
0 86
8
2
8
1 86
8
0 271
8
2
8
1 271
8
0 542
8
2
8
1 542
8
0 431
8
2
8
1 431
8
0 799
8
2
8
1 799
8
0 1223
8
2
8
1 1223
8
0 860
8
2
8
1 860
8
0 435
8
2
8
1 435
8
0 1351
8
2
8
1 1351
8
0 1526
8
2
8
1 1526
8
0 1915
8
2
8
1 1915
8
0 1765
8
2
8
1 1765...

result:

ok 

Test #49:

score: 75
Accepted
time: 12ms
memory: 3800kb

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 1302
8
2
8
0 188
8
2
8
0 224
8
2
8
0 1553
8
2
8
0 1777
8
2
8
0 714
8
2
8
0 808
8
2
8
0 1405
8
2
8
0 36
8
2
8
0 1202
8
2
8
0 341
8
2
8
0 1675
8
2
8
0 1194
8
2
8
0 1725
8
2
8
0 1527
8
2
8
0 467
8
2
8
0 327
8
2
8
0 310
8
2
8
0 1845
8
2
8
0 1251
8
2
8
0 1031
8
2
8
0 896
8
2
8
0 1562
8
2
8
0 901
8
2
...

result:

ok 

Test #50:

score: 74.75
Acceptable Answer
time: 41ms
memory: 3784kb

input:

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

output:

8
0 648
8
2
8
0 1314
8
2
8
0 796
8
2
8
1 796
8
0 644
8
2
8
0 821
8
2
8
0 1914
8
2
8
0 1650
8
2
8
0 116
8
2
8
0 1785
8
2
8
0 194
8
2
8
0 864
8
2
8
1 864
8
0 1356
8
2
8
1 1356
8
0 1516
8
2
8
0 1899
8
2
8
0 1980
8
2
8
0 176
8
2
8
0 1584
8
2
8
0 398
8
2
8
0 1229
8
2
8
0 1696
8
2
8
0 1113
8
2
8
0 1502
8
...

result:

points 0.99666666670 points  0.99666666670

Test #51:

score: 75
Accepted
time: 29ms
memory: 3840kb

input:

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

output:

8
0 1268
8
2
8
0 1865
8
2
8
0 1228
8
2
8
0 1031
8
2
8
0 1418
8
2
8
0 775
8
2
8
0 747
8
2
8
0 1115
8
2
8
1 1115
8
0 1116
8
2
8
0 342
8
2
8
0 267
8
2
8
0 906
8
2
8
1 906
8
0 1386
8
2
8
0 1220
8
2
8
1 1220
8
0 515
8
2
8
0 486
8
2
8
0 1119
8
2
8
1 1119
8
0 82
8
2
8
0 1071
8
2
8
1 1071
8
0 1338
8
2
8
0 1...

result:

ok 

Test #52:

score: 75
Accepted
time: 20ms
memory: 3724kb

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 1842
8
2
8
0 409
8
2
8
1 409
8
0 2
8
2
8
1 2
8
0 1538
8
2
8
1 1538
8
0 1960
8
2
8
1 1960
8
0 460
8
2
8
1 460
8
0 1529
8
2
8
1 1529
8
0 1554
8
2
8
1 1554
8
0 1468
8
2
8
1 1468
8
0 1531
8
2
8
1 1531
8
0 471
8
2
8
1 471
8
0 68
8
2
8
1 68
8
0 54
8
2
8
1 54
8
0 992
8
2
8
1 992
8
0 1892
8
2
8
1 1892
8...

result:

ok 

Test #53:

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

input:

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

output:

8
0 602
8
2
8
0 1915
8
2
8
0 288
8
2
8
0 1388
8
2
8
1 1388
8
0 1701
8
2
8
0 428
8
2
8
0 125
8
2
8
0 1495
8
2
8
0 1770
8
2
8
0 897
8
2
8
0 1840
8
2
8
1 1840
8
0 199
8
2
8
1 199
8
0 1254
8
2
8
1 1254
8
0 1656
8
2
8
0 703
8
2
8
0 462
8
2
8
0 352
8
2
8
0 1339
8
2
8
0 341
8
2
8
0 305
8
2
8
1 305
8
0 1688...

result:

ok 

Test #54:

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

input:

2000
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1112
8
2
8
0 1070
8
2
8
0 752
8
2
8
1 752
8
0 955
8
2
8
0 155
8
2
8
1 155
8
0 1719
8
2
8
1 1719
8
0 1347
8
2
8
1 1347
8
0 73
8
2
8
1 73
8
0 912
8
2
8
0 673
8
2
8
1 673
8
0 203
8
2
8
1 203
8
0 1943
8
2
8
1 1943
8
0 598
8
2
8
1 598
8
0 1583
8
2
8
1 1583
8
0 199
8
2
8
1 199
8
0 1555
8
2
8
1 1555
8
...

result:

ok 

Test #55:

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

input:

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

output:

8
0 508
8
2
8
0 1655
8
2
8
0 1242
8
2
8
0 1804
8
2
8
0 234
8
2
8
0 1422
8
2
8
0 1750
8
2
8
0 1839
8
2
8
0 1274
8
2
8
0 474
8
2
8
0 536
8
2
8
0 1217
8
2
8
1 1217
8
0 1820
8
2
8
0 660
8
2
8
0 493
8
2
8
0 880
8
2
8
0 1575
8
2
8
0 200
8
2
8
0 1384
8
2
8
0 1976
8
2
8
0 564
8
2
8
0 684
8
2
8
1 684
8
0 743...

result:

ok 

Test #56:

score: 75
Accepted
time: 60ms
memory: 3864kb

input:

1998
1
1
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
2
2
2
2
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 1244
8
2
8
0 645
8
2
8
0 65
8
2
8
1 65
8
0 1900
8
2
8
1 1900
8
0 1014
8
2
8
1 1014
8
0 898
8
2
8
1 898
8
0 476
8
2
8
0 1995
8
2
8
0 233
8
2
8
0 834
8
2
8
1 834
8
0 1496
8
2
8
1 1496
8
0 359
8
2
8
1 359
8
0 1177
8
2
8
1 1177
8
0 1589
8
2
8
1 1589
8
0 1988
8
2
8
1 1988
8
0 62
8
2
8
1 62
8
0 1101
8...

result:

ok 

Test #57:

score: 74.95
Acceptable Answer
time: 34ms
memory: 3888kb

input:

1999
1
1
1
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1037
8
2
8
0 965
8
2
8
0 1223
8
2
8
0 1349
8
2
8
1 1349
8
0 371
8
2
8
0 916
8
2
8
1 916
8
0 1695
8
2
8
0 1853
8
2
8
0 1462
8
2
8
1 1462
8
0 434
8
2
8
0 626
8
2
8
1 626
8
0 1060
8
2
8
1 1060
8
0 1239
8
2
8
1 1239
8
0 178
8
2
8
1 178
8
0 501
8
2
8
1 501
8
0 496
8
2
8
0 1038
8
2
8
1 1038
8
0 1623
8...

result:

points 0.99933333330 points  0.99933333330

Test #58:

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

input:

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

output:

8
0 1509
8
2
8
0 781
8
2
8
0 802
8
2
8
0 20
8
2
8
0 1175
8
2
8
0 1655
8
2
8
1 1655
8
0 1464
8
2
8
0 1182
8
2
8
1 1182
8
0 1649
8
2
8
1 1649
8
0 1827
8
2
8
1 1827
8
0 143
8
2
8
1 143
8
0 457
8
2
8
1 457
8
0 1740
8
2
8
1 1740
8
0 132
8
2
8
0 1089
8
2
8
1 1089
8
0 679
8
2
8
1 679
8
0 508
8
2
8
1 508
8
...

result:

ok 

Test #59:

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

input:

1998
1
1
1
2
2
1
1
1
1
2
2
2
2
1
2
2
2
1
2
1
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
2
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 295
8
2
8
0 467
8
2
8
0 1074
8
2
8
0 1875
8
2
8
1 1875
8
0 1105
8
2
8
1 1105
8
0 1849
8
2
8
0 1530
8
2
8
0 916
8
2
8
0 1241
8
2
8
0 1083
8
2
8
1 1083
8
0 1432
8
2
8
1 1432
8
0 1856
8
2
8
1 1856
8
0 626
8
2
8
1 626
8
0 1494
8
2
8
0 650
8
2
8
1 650
8
0 1517
8
2
8
1 1517
8
0 334
8
2
8
1 334
8
0 468...

result:

ok 

Test #60:

score: 74.91
Acceptable Answer
time: 87ms
memory: 3864kb

input:

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

output:

8
0 1559
8
2
8
0 875
8
2
8
0 72
8
2
8
1 72
8
0 181
8
2
8
0 1988
8
2
8
0 903
8
2
8
1 903
8
0 759
8
2
8
1 759
8
0 90
8
2
8
0 528
8
2
8
0 84
8
2
8
0 1455
8
2
8
0 1541
8
2
8
1 1541
8
0 162
8
2
8
1 162
8
0 1089
8
2
8
1 1089
8
0 1283
8
2
8
0 1391
8
2
8
0 579
8
2
8
0 118
8
2
8
1 118
8
0 866
8
2
8
1 866
8
0...

result:

points 0.99880 points  0.99880

Test #61:

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

input:

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

output:

8
0 679
8
2
8
0 491
8
2
8
0 42
8
2
8
0 1920
8
2
8
0 554
8
2
8
0 836
8
2
8
0 937
8
2
8
0 760
8
2
8
1 760
8
0 905
8
2
8
0 351
8
2
8
0 1378
8
2
8
0 1237
8
2
8
1 1237
8
0 363
8
2
8
0 384
8
2
8
1 384
8
0 731
8
2
8
0 611
8
2
8
0 995
8
2
8
1 995
8
0 715
8
2
8
0 429
8
2
8
1 429
8
0 1043
8
2
8
0 97
8
2
8
0 2...

result:

ok 

Test #62:

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

input:

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

output:

8
0 1861
8
2
8
0 527
8
2
8
0 1306
8
2
8
0 45
8
2
8
0 1296
8
2
8
0 607
8
2
8
0 1227
8
2
8
0 1621
8
2
8
0 545
8
2
8
0 247
8
2
8
0 1112
8
2
8
0 757
8
2
8
0 1358
8
2
8
0 1250
8
2
8
0 1956
8
2
8
0 257
8
2
8
1 257
8
0 640
8
2
8
1 640
8
0 1026
8
2
8
0 1643
8
2
8
0 742
8
2
8
1 742
8
0 1098
8
2
8
0 1370
8
2
...

result:

ok 

Test #63:

score: 74.93
Acceptable Answer
time: 56ms
memory: 3780kb

input:

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

output:

8
0 637
8
2
8
0 1208
8
2
8
0 849
8
2
8
0 387
8
2
8
0 1321
8
2
8
0 233
8
2
8
0 110
8
2
8
0 462
8
2
8
0 1841
8
2
8
1 1841
8
0 1891
8
2
8
0 656
8
2
8
0 988
8
2
8
0 1011
8
2
8
0 1594
8
2
8
0 1360
8
2
8
0 1751
8
2
8
0 382
8
2
8
0 423
8
2
8
0 1107
8
2
8
0 1782
8
2
8
0 342
8
2
8
0 1030
8
2
8
0 690
8
2
8
0 ...

result:

points 0.99906666670 points  0.99906666670

Test #64:

score: 75
Accepted
time: 27ms
memory: 3784kb

input:

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

output:

8
0 927
8
2
8
0 1469
8
2
8
0 770
8
2
8
0 872
8
2
8
0 94
8
2
8
0 460
8
2
8
0 1836
8
2
8
0 781
8
2
8
0 1301
8
2
8
0 1040
8
2
8
0 401
8
2
8
1 401
8
0 879
8
2
8
0 485
8
2
8
0 1194
8
2
8
0 266
8
2
8
0 1808
8
2
8
0 755
8
2
8
1 755
8
0 449
8
2
8
0 1570
8
2
8
1 1570
8
0 220
8
2
8
0 433
8
2
8
0 1736
8
2
8
0 ...

result:

ok 

Test #65:

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

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

output:

8
0 135
8
2
8
0 1362
8
2
8
0 1015
8
2
8
0 33
8
2
8
0 1917
8
2
8
0 1453
8
2
8
0 1594
8
2
8
0 921
8
2
8
0 1490
8
2
8
0 758
8
2
8
0 2
8
2
8
0 1732
8
2
8
0 1163
8
2
8
0 846
8
2
8
0 1017
8
2
8
0 692
8
2
8
0 1833
8
2
8
0 1928
8
2
8
0 1499
8
2
8
0 1038
8
2
8
0 1214
8
2
8
0 1355
8
2
8
0 792
8
2
8
0 42
8
2
8...

result:

ok 

Test #66:

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

input:

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

output:

8
0 622
8
2
8
0 1455
8
2
8
0 114
8
2
8
0 328
8
2
8
0 108
8
2
8
0 146
8
2
8
0 1413
8
2
8
0 224
8
2
8
0 1793
8
2
8
0 1092
8
2
8
0 746
8
2
8
0 1075
8
2
8
0 506
8
2
8
0 1299
8
2
8
1 1299
8
0 489
8
2
8
0 530
8
2
8
0 867
8
2
8
0 1565
8
2
8
0 1770
8
2
8
0 403
8
2
8
0 1926
8
2
8
0 193
8
2
8
0 1618
8
2
8
0 4...

result:

ok 

Test #67:

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

input:

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

output:

8
0 1289
8
2
8
0 1120
8
2
8
0 394
8
2
8
0 1317
8
2
8
0 938
8
2
8
0 170
8
2
8
0 1972
8
2
8
0 413
8
2
8
0 468
8
2
8
0 852
8
2
8
0 1375
8
2
8
0 1324
8
2
8
0 360
8
2
8
0 907
8
2
8
0 92
8
2
8
0 254
8
2
8
0 751
8
2
8
0 1802
8
2
8
0 701
8
2
8
0 659
8
2
8
0 890
8
2
8
0 1015
8
2
8
0 573
8
2
8
1 573
8
0 81
8
...

result:

ok 

Test #68:

score: 74.88
Acceptable Answer
time: 50ms
memory: 3788kb

input:

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

output:

8
0 1322
8
2
8
0 1647
8
2
8
0 1182
8
2
8
0 1368
8
2
8
0 1960
8
2
8
0 183
8
2
8
0 1970
8
2
8
0 855
8
2
8
0 1713
8
2
8
1 1713
8
0 853
8
2
8
0 474
8
2
8
1 474
8
0 573
8
2
8
0 1162
8
2
8
0 200
8
2
8
0 1217
8
2
8
0 619
8
2
8
1 619
8
0 1340
8
2
8
1 1340
8
0 77
8
2
8
0 631
8
2
8
1 631
8
0 22
8
2
8
0 218
8
...

result:

points 0.99840 points  0.99840

Test #69:

score: 74.88
Acceptable Answer
time: 42ms
memory: 3836kb

input:

1979
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
1
1
2
1
2
2
2
1
2
2
1
1
1
1
1
2
1
1
1
1
2
1
2
1
2
2
2
2
1
1
1
2
1
2
2
2
1
1
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
1
1
1
2
1
2
2
2
2
1
2
1
2
1
2
2
2
2
2
1
1
2
1
1
2
2
2
2
2
2
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
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 1160
8
2
8
0 755
8
2
8
0 1736
8
2
8
0 1027
8
2
8
0 790
8
2
8
0 1694
8
2
8
0 826
8
2
8
0 506
8
2
8
0 182
8
2
8
0 1646
8
2
8
0 370
8
2
8
0 1060
8
2
8
0 1951
8
2
8
0 1558
8
2
8
1 1558
8
0 1005
8
2
8
0 133
8
2
8
0 457
8
2
8
0 1480
8
2
8
1 1480
8
0 331
8
2
8
0 264
8
2
8
1 264
8
0 388
8
2
...

result:

points 0.99840 points  0.99840

Test #70:

score: 74.46
Acceptable Answer
time: 52ms
memory: 3792kb

input:

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

output:

8
0 350
8
2
8
0 519
8
2
8
0 23
8
2
8
0 1341
8
2
8
0 1682
8
2
8
0 1424
8
2
8
0 1777
8
2
8
0 1436
8
2
8
0 196
8
2
8
0 1181
8
2
8
0 560
8
2
8
0 718
8
2
8
1 718
8
0 1101
8
2
8
0 1567
8
2
8
0 151
8
2
8
0 1745
8
2
8
0 1849
8
2
8
1 1849
8
0 1719
8
2
8
1 1719
8
0 1301
8
2
8
0 601
8
2
8
1 601
8
0 1179
8
2
8
...

result:

points 0.99280 points  0.99280

Test #71:

score: 74.48
Acceptable Answer
time: 72ms
memory: 3792kb

input:

1979
1
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
2
2
2
2
2
1
2
2
2
2
1
1
2
1
1
2
2
1
1
2
1
2
2
2
1
2
2
2
1
2
1
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
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
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 162
8
2
8
0 1338
8
2
8
0 1545
8
2
8
0 1117
8
2
8
0 723
8
2
8
0 1292
8
2
8
0 146
8
2
8
0 663
8
2
8
0 1183
8
2
8
0 1708
8
2
8
0 789
8
2
8
0 707
8
2
8
0 747
8
2
8
0 1496
8
2
8
1 1496
8
0 1947
8
2
8
0 1736
8
2
8
1 1736
8
0 267
8
2
8
1 267
8
0 530
8
2
8
1 530
8
0 35
8
2
8
1 35
8
0 489
8
2
8
1 489
8
0...

result:

points 0.99306666670 points  0.99306666670

Test #72:

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

input:

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

output:

8
0 639
8
2
8
0 912
8
2
8
0 1670
8
2
8
0 1370
8
2
8
0 859
8
2
8
0 197
8
2
8
0 803
8
2
8
0 136
8
2
8
1 136
8
0 626
8
2
8
1 626
8
0 1255
8
2
8
0 1522
8
2
8
0 1493
8
2
8
1 1493
8
0 255
8
2
8
0 1527
8
2
8
0 1111
8
2
8
1 1111
8
0 1265
8
2
8
0 534
8
2
8
0 227
8
2
8
0 632
8
2
8
0 1963
8
2
8
1 1963
8
0 299
...

result:

ok 

Test #73:

score: 75
Accepted
time: 29ms
memory: 3868kb

input:

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

output:

8
0 1974
8
2
8
0 531
8
2
8
0 1528
8
2
8
0 13
8
2
8
0 845
8
2
8
0 211
8
2
8
0 1719
8
2
8
0 856
8
2
8
1 856
8
0 1472
8
2
8
0 423
8
2
8
0 307
8
2
8
0 860
8
2
8
0 1799
8
2
8
0 1240
8
2
8
1 1240
8
0 1604
8
2
8
0 963
8
2
8
1 963
8
0 168
8
2
8
0 1902
8
2
8
1 1902
8
0 137
8
2
8
0 116
8
2
8
0 400
8
2
8
1 400...

result:

ok 

Test #74:

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

input:

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

output:

8
0 477
8
2
8
0 1848
8
2
8
0 561
8
2
8
0 395
8
2
8
0 686
8
2
8
0 1312
8
2
8
0 1157
8
2
8
0 507
8
2
8
0 523
8
2
8
0 802
8
2
8
1 802
8
0 662
8
2
8
0 1291
8
2
8
0 404
8
2
8
0 1323
8
2
8
1 1323
8
0 1962
8
2
8
1 1962
8
0 1837
8
2
8
1 1837
8
0 364
8
2
8
0 1723
8
2
8
0 114
8
2
8
0 909
8
2
8
1 909
8
0 934
8...

result:

ok 

Test #75:

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

input:

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

output:

8
0 1341
8
2
8
0 1530
8
2
8
0 1686
8
2
8
0 1459
8
2
8
0 122
8
2
8
0 774
8
2
8
0 1088
8
2
8
0 826
8
2
8
0 1912
8
2
8
0 999
8
2
8
0 965
8
2
8
0 1368
8
2
8
0 581
8
2
8
0 1243
8
2
8
0 577
8
2
8
0 1663
8
2
8
0 1300
8
2
8
0 1556
8
2
8
0 367
8
2
8
0 1359
8
2
8
1 1359
8
0 717
8
2
8
0 625
8
2
8
0 451
8
2
8
0...

result:

ok 

Test #76:

score: 74.17
Acceptable Answer
time: 34ms
memory: 3860kb

input:

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

output:

8
0 1475
8
2
8
0 63
8
2
8
0 430
8
2
8
0 456
8
2
8
0 1967
8
2
8
0 1796
8
2
8
0 994
8
2
8
0 288
8
2
8
0 1328
8
2
8
0 660
8
2
8
0 1598
8
2
8
0 270
8
2
8
0 1880
8
2
8
0 287
8
2
8
1 287
8
0 1404
8
2
8
0 1653
8
2
8
1 1653
8
0 1266
8
2
8
0 812
8
2
8
0 1019
8
2
8
1 1019
8
0 151
8
2
8
0 1270
8
2
8
0 1173
8
2...

result:

points 0.98893333330 points  0.98893333330

Test #77:

score: 74.21
Acceptable Answer
time: 61ms
memory: 3888kb

input:

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

output:

8
0 1514
8
2
8
0 993
8
2
8
1 993
8
0 783
8
2
8
0 949
8
2
8
0 1350
8
2
8
0 1412
8
2
8
0 1307
8
2
8
0 795
8
2
8
0 1100
8
2
8
0 1582
8
2
8
0 728
8
2
8
0 123
8
2
8
0 1891
8
2
8
0 638
8
2
8
0 1609
8
2
8
0 1415
8
2
8
0 834
8
2
8
1 834
8
0 680
8
2
8
0 928
8
2
8
0 1466
8
2
8
0 1727
8
2
8
1 1727
8
0 468
8
2
...

result:

points 0.98946666670 points  0.98946666670

Test #78:

score: 75
Accepted
time: 46ms
memory: 3760kb

input:

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

output:

8
0 1540
8
2
8
0 871
8
2
8
0 1197
8
2
8
0 184
8
2
8
0 1396
8
2
8
0 609
8
2
8
0 362
8
2
8
0 949
8
2
8
0 1680
8
2
8
0 501
8
2
8
0 1020
8
2
8
1 1020
8
0 741
8
2
8
0 1745
8
2
8
0 691
8
2
8
0 858
8
2
8
0 1462
8
2
8
0 1634
8
2
8
0 1106
8
2
8
0 1171
8
2
8
0 1527
8
2
8
0 1040
8
2
8
0 1123
8
2
8
0 257
8
2
8
...

result:

ok 

Test #79:

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

input:

1980
1
1
1
1
2
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
2
1
2
2
1
1
1
1
2
1
1
2
1
1
1
1
1
1
1
2
2
1
1
2
2
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
1
1
1
2
2
2
2
2
2
1
2
1
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2...

output:

8
0 762
8
2
8
0 1589
8
2
8
0 1512
8
2
8
0 514
8
2
8
0 1353
8
2
8
1 1353
8
0 1735
8
2
8
0 588
8
2
8
0 851
8
2
8
0 764
8
2
8
0 1933
8
2
8
0 6
8
2
8
0 51
8
2
8
0 1099
8
2
8
1 1099
8
0 1839
8
2
8
0 270
8
2
8
0 1129
8
2
8
0 1033
8
2
8
0 1256
8
2
8
0 110
8
2
8
1 110
8
0 581
8
2
8
0 207
8
2
8
1 207
8
0 114...

result:

ok 

Test #80:

score: 75
Accepted
time: 71ms
memory: 3784kb

input:

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

output:

8
0 1756
8
2
8
0 994
8
2
8
0 1036
8
2
8
0 1940
8
2
8
0 867
8
2
8
0 678
8
2
8
0 601
8
2
8
0 1941
8
2
8
0 1601
8
2
8
0 203
8
2
8
0 982
8
2
8
0 958
8
2
8
0 1621
8
2
8
1 1621
8
0 1012
8
2
8
0 65
8
2
8
0 671
8
2
8
1 671
8
0 711
8
2
8
0 1318
8
2
8
0 1169
8
2
8
0 1025
8
2
8
0 571
8
2
8
0 1325
8
2
8
0 1549
...

result:

ok 

Test #81:

score: 75
Accepted
time: 48ms
memory: 3732kb

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

output:

8
0 500
8
2
8
0 1515
8
2
8
0 887
8
2
8
0 1822
8
2
8
0 1577
8
2
8
0 1359
8
2
8
0 645
8
2
8
0 366
8
2
8
0 1511
8
2
8
0 1634
8
2
8
0 869
8
2
8
0 1077
8
2
8
0 1486
8
2
8
0 1029
8
2
8
0 138
8
2
8
0 412
8
2
8
0 929
8
2
8
0 38
8
2
8
0 1892
8
2
8
0 922
8
2
8
0 758
8
2
8
1 758
8
0 680
8
2
8
0 1925
8
2
8
0 68...

result:

ok 

Test #82:

score: 74.2
Acceptable Answer
time: 53ms
memory: 3872kb

input:

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

output:

8
0 795
8
2
8
0 375
8
2
8
0 193
8
2
8
0 1468
8
2
8
0 1738
8
2
8
0 1774
8
2
8
1 1774
8
0 100
8
2
8
0 653
8
2
8
0 1274
8
2
8
0 523
8
2
8
0 1984
8
2
8
0 472
8
2
8
0 1713
8
2
8
0 1585
8
2
8
0 1871
8
2
8
1 1871
8
0 1728
8
2
8
1 1728
8
0 1813
8
2
8
0 1406
8
2
8
0 1748
8
2
8
1 1748
8
0 880
8
2
8
1 880
8
0 ...

result:

points 0.98933333330 points  0.98933333330

Test #83:

score: 74.2
Acceptable Answer
time: 58ms
memory: 3764kb

input:

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

output:

8
0 1453
8
2
8
0 1667
8
2
8
0 413
8
2
8
0 1422
8
2
8
0 1305
8
2
8
0 661
8
2
8
0 1890
8
2
8
0 1368
8
2
8
1 1368
8
0 222
8
2
8
0 1664
8
2
8
0 1825
8
2
8
0 1691
8
2
8
0 1677
8
2
8
0 190
8
2
8
0 174
8
2
8
0 1782
8
2
8
0 1606
8
2
8
1 1606
8
0 1863
8
2
8
1 1863
8
0 1548
8
2
8
1 1548
8
0 553
8
2
8
0 943
8
...

result:

points 0.98933333330 points  0.98933333330

Test #84:

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

input:

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

output:

8
0 520
8
2
8
0 337
8
2
8
1 337
8
0 521
8
2
8
1 521
8
0 272
8
2
8
1 272
8
0 56
8
2
8
1 56
8
0 345
8
2
8
1 345
8
0 472
8
2
8
0 151
8
2
8
1 151
8
0 359
8
2
8
1 359
8
0 65
8
2
8
1 65
8
0 158
8
2
8
1 158
8
0 83
8
2
8
1 83
8
0 116
8
2
8
1 116
8
0 5
8
2
8
1 5
8
0 451
8
2
8
1 451
8
0 512
8
2
8
1 512
8
0 33...

result:

ok 

Test #85:

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

input:

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

output:

8
0 169
8
2
8
0 1824
8
2
8
0 198
8
2
8
1 198
8
0 1766
8
2
8
1 1766
8
0 1674
8
2
8
1 1674
8
0 100
8
2
8
1 100
8
0 1744
8
2
8
1 1744
8
0 722
8
2
8
1 722
8
0 838
8
2
8
1 838
8
0 735
8
2
8
1 735
8
0 780
8
2
8
1 780
8
0 1596
8
2
8
0 367
8
2
8
1 367
8
0 939
8
2
8
1 939
8
0 360
8
2
8
1 360
8
0 800
8
2
8
1 ...

result:

ok 

Test #86:

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

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 802
8
2
8
0 601
8
2
8
1 601
8
0 653
8
2
8
0 571
8
2
8
1 571
8
0 63
8
2
8
1 63
8
0 207
8
2
8
1 207
8
0 624
8
2
8
1 624
8
0 760
8
2
8
1 760
8
0 1973
8
2
8
1 1973
8
0 240
8
2
8
1 240
8
0 639
8
2
8
1 639
8
0 214
8
2
8
1 214
8
0 258
8
2
8
1 258
8
0 263
8
2
8
1 263
8
0 1080
8
2
8
1 1080
8
0 1196
8
2
8...

result:

ok 

Test #87:

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

input:

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

output:

8
0 164
8
2
8
0 1992
8
2
8
0 1727
8
2
8
0 494
8
2
8
1 494
8
0 804
8
2
8
1 804
8
0 1560
8
2
8
0 1739
8
2
8
0 121
8
2
8
1 121
8
0 1163
8
2
8
0 1691
8
2
8
0 1737
8
2
8
0 895
8
2
8
1 895
8
0 1806
8
2
8
0 561
8
2
8
1 561
8
0 1567
8
2
8
0 39
8
2
8
1 39
8
0 1610
8
2
8
0 496
8
2
8
1 496
8
0 1767
8
2
8
0 585...

result:

ok 

Test #88:

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

input:

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

output:

8
0 681
8
2
8
0 1421
8
2
8
0 895
8
2
8
0 391
8
2
8
0 379
8
2
8
0 640
8
2
8
0 1915
8
2
8
1 1915
8
0 128
8
2
8
0 1185
8
2
8
1 1185
8
0 322
8
2
8
0 1684
8
2
8
1 1684
8
0 1250
8
2
8
1 1250
8
0 954
8
2
8
0 1384
8
2
8
1 1384
8
0 590
8
2
8
0 375
8
2
8
0 1919
8
2
8
1 1919
8
0 1931
8
2
8
1 1931
8
0 304
8
2
8...

result:

ok 

Test #89:

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

input:

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

output:

8
0 587
8
2
8
0 1372
8
2
8
0 914
8
2
8
0 1407
8
2
8
0 298
8
2
8
0 367
8
2
8
1 367
8
0 351
8
2
8
1 351
8
0 523
8
2
8
0 453
8
2
8
1 453
8
0 1419
8
2
8
0 1387
8
2
8
0 741
8
2
8
0 1884
8
2
8
1 1884
8
0 1112
8
2
8
0 241
8
2
8
1 241
8
0 1834
8
2
8
1 1834
8
0 558
8
2
8
0 132
8
2
8
1 132
8
0 204
8
2
8
1 204...

result:

ok