QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#45953#4565. Rarest InsectsMaMengQi99.19 99ms3892kbC++175.7kb2022-08-24 18:41:492022-08-24 18:41:59

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
2
1
1
2
2
1
1
2
1

output:

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

result:

ok 

Test #2:

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

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
1
2
2
2
1
2
1
2
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 121
8
2
8
0 112
8
2
8
1 112
8
0 161
8
2
8
1 161
8
0 11
8
2
8
1 11
8
0 10
8
2
8
1 10
8
0 119
8
2
8
1 119
8
0 34
8
2
8
1 34
8
0 101
8
2
8
1 101
8
0 140
8
2
8
1 140
8
0 2
8
2
8
1 2
8
0 169
8
2
8
1 169
8
0 107
8
2
8
1 107
8
0 38
8
2
8
1 38
8
0 94
8
2
8
1 94
8
0 170
8
2
8
1 170
8
0 167
8
2
8
1 167
8
...

result:

ok 

Test #8:

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

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 175
8
2
8
0 42
8
2
8
0 156
8
2
8
0 180
8
2
8
0 88
8
2
8
0 26
8
2
8
0 150
8
2
8
0 57
8
2
8
0 160
8
2
8
0 163
8
2
8
0 96
8
2
8
0 112
8
2
8
0 130
8
2
8
0 136
8
2
8
0 168
8
2
8
0 59
8
2
8
0 151
8
2
8
0 40
8
2
8
0 14
8
2
8
0 142
8
2
8
0 166
8
2
8
0 58
8
2
8
0 114
8
2
8
0 144
8
2
8
0 172
8
2
8
0 171
8...

result:

ok 

Test #9:

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

input:

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

output:

8
0 193
8
2
8
0 28
8
2
8
0 122
8
2
8
0 105
8
2
8
0 163
8
2
8
0 174
8
2
8
0 79
8
2
8
0 98
8
2
8
1 98
8
0 5
8
2
8
0 49
8
2
8
1 49
8
0 103
8
2
8
0 151
8
2
8
0 196
8
2
8
0 74
8
2
8
0 54
8
2
8
1 54
8
0 191
8
2
8
1 191
8
0 150
8
2
8
1 150
8
0 176
8
2
8
1 176
8
0 43
8
2
8
1 43
8
0 37
8
2
8
0 32
8
2
8
1 32
...

result:

ok 

Test #10:

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

input:

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

output:

8
0 79
8
2
8
0 156
8
2
8
0 67
8
2
8
0 43
8
2
8
0 148
8
2
8
1 148
8
0 139
8
2
8
0 22
8
2
8
0 191
8
2
8
0 128
8
2
8
1 128
8
0 124
8
2
8
0 66
8
2
8
1 66
8
0 18
8
2
8
1 18
8
0 44
8
2
8
1 44
8
0 112
8
2
8
1 112
8
0 134
8
2
8
1 134
8
0 116
8
2
8
1 116
8
0 96
8
2
8
1 96
8
0 163
8
2
8
1 163
8
0 157
8
2
8
0 ...

result:

ok 

Test #11:

score: 0
Accepted
time: 6ms
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 113
8
2
8
0 100
8
2
8
1 100
8
0 120
8
2
8
1 120
8
0 117
8
2
8
1 117
8
0 41
8
2
8
1 41
8
0 64
8
2
8
1 64
8
0 177
8
2
8
1 177
8
0 29
8
2
8
1 29
8
0 144
8
2
8
1 144
8
0 42
8
2
8
1 42
8
0 77
8
2
8
1 77
8
0 1
8
2
8
1 1
8
0 53
8
2
8
1 53
8
0 70
8
2
8
1 70
8
0 34
8
2
8
1 34
8
0 141
8
2
8
1 141
8
0 65
8...

result:

ok 

Test #12:

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

input:

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

output:

8
0 185
8
2
8
0 157
8
2
8
0 73
8
2
8
0 26
8
2
8
1 26
8
0 79
8
2
8
0 22
8
2
8
0 118
8
2
8
0 170
8
2
8
0 2
8
2
8
1 2
8
0 18
8
2
8
0 177
8
2
8
1 177
8
0 135
8
2
8
1 135
8
0 14
8
2
8
1 14
8
0 71
8
2
8
0 178
8
2
8
1 178
8
0 19
8
2
8
0 164
8
2
8
0 72
8
2
8
1 72
8
0 148
8
2
8
0 144
8
2
8
1 144
8
0 138
8
2
...

result:

ok 

Test #13:

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

input:

197
1
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 154
8
2
8
0 44
8
2
8
0 83
8
2
8
1 83
8
0 177
8
2
8
0 57
8
2
8
1 57
8
0 4
8
2
8
1 4
8
0 107
8
2
8
1 107
8
0 179
8
2
8
0 60
8
2
8
1 60
8
0 175
8
2
8
1 175
8
0 27
8
2
8
1 27
8
0 101
8
2
8
1 101
8
0 156
8
2
8
1 156
8
0 143
8
2
8
1 143
8
0 65
8
2
8
1 65
8
0 56
8
2
8
1 56
8
0 98
8
2
8
1 98
8
0 43
8
2
...

result:

ok 

Test #14:

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

input:

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

output:

8
0 152
8
2
8
0 194
8
2
8
0 187
8
2
8
0 36
8
2
8
0 22
8
2
8
0 11
8
2
8
0 135
8
2
8
1 135
8
0 109
8
2
8
1 109
8
0 39
8
2
8
0 165
8
2
8
1 165
8
0 51
8
2
8
0 192
8
2
8
1 192
8
0 33
8
2
8
0 83
8
2
8
0 20
8
2
8
1 20
8
0 34
8
2
8
1 34
8
0 112
8
2
8
1 112
8
0 137
8
2
8
1 137
8
0 52
8
2
8
1 52
8
0 78
8
2
8
...

result:

ok 

Test #15:

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

input:

200
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 125
8
2
8
0 172
8
2
8
0 91
8
2
8
1 91
8
0 164
8
2
8
1 164
8
0 137
8
2
8
0 146
8
2
8
0 140
8
2
8
1 140
8
0 187
8
2
8
1 187
8
0 84
8
2
8
1 84
8
0 54
8
2
8
1 54
8
0 169
8
2
8
0 35
8
2
8
1 35
8
0 85
8
2
8
1 85
8
0 147
8
2
8
1 147
8
0 161
8
2
8
1 161
8
0 113
8
2
8
1 113
8
0 36
8
2
8
1 36
8
0 170
8
2
...

result:

ok 

Test #16:

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

input:

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

output:

8
0 186
8
2
8
0 79
8
2
8
0 78
8
2
8
0 42
8
2
8
0 190
8
2
8
0 133
8
2
8
0 145
8
2
8
0 10
8
2
8
1 10
8
0 120
8
2
8
1 120
8
0 181
8
2
8
1 181
8
0 156
8
2
8
1 156
8
0 29
8
2
8
1 29
8
0 147
8
2
8
1 147
8
0 2
8
2
8
1 2
8
0 151
8
2
8
1 151
8
0 114
8
2
8
1 114
8
0 87
8
2
8
0 13
8
2
8
1 13
8
0 73
8
2
8
1 73
...

result:

ok 

Test #17:

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

input:

199
1
1
1
1
2
1
2
1
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 97
8
2
8
0 58
8
2
8
0 44
8
2
8
0 17
8
2
8
0 29
8
2
8
1 29
8
0 194
8
2
8
0 116
8
2
8
1 116
8
0 48
8
2
8
0 115
8
2
8
0 133
8
2
8
1 133
8
0 68
8
2
8
1 68
8
0 95
8
2
8
1 95
8
0 195
8
2
8
0 87
8
2
8
1 87
8
0 65
8
2
8
1 65
8
0 27
8
2
8
1 27
8
0 79
8
2
8
1 79
8
0 54
8
2
8
0 4
8
2
8
1 4
8
0 45
8
2
8
1 4...

result:

ok 

Test #18:

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

input:

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

output:

8
0 64
8
2
8
0 1
8
2
8
1 1
8
0 133
8
2
8
0 49
8
2
8
0 173
8
2
8
0 163
8
2
8
1 163
8
0 162
8
2
8
0 37
8
2
8
0 55
8
2
8
1 55
8
0 36
8
2
8
1 36
8
0 79
8
2
8
1 79
8
0 42
8
2
8
1 42
8
0 135
8
2
8
0 101
8
2
8
1 101
8
0 45
8
2
8
1 45
8
0 91
8
2
8
0 71
8
2
8
0 6
8
2
8
1 6
8
0 137
8
2
8
1 137
8
0 169
8
2
8
0...

result:

ok 

Test #19:

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

input:

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

output:

8
0 69
8
2
8
0 98
8
2
8
0 167
8
2
8
0 153
8
2
8
0 179
8
2
8
0 117
8
2
8
1 117
8
0 10
8
2
8
0 168
8
2
8
0 116
8
2
8
1 116
8
0 157
8
2
8
1 157
8
0 55
8
2
8
0 12
8
2
8
1 12
8
0 44
8
2
8
1 44
8
0 131
8
2
8
0 50
8
2
8
0 32
8
2
8
0 151
8
2
8
1 151
8
0 176
8
2
8
1 176
8
0 26
8
2
8
1 26
8
0 15
8
2
8
1 15
8
...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
2
1
1
1
1
2
1
1
2
2
1
2
2
1
1
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 29
8
2
8
0 140
8
2
8
0 195
8
2
8
0 31
8
2
8
0 119
8
2
8
0 138
8
2
8
0 27
8
2
8
1 27
8
0 40
8
2
8
0 134
8
2
8
0 19
8
2
8
0 94
8
2
8
0 5
8
2
8
1 5
8
0 147
8
2
8
0 184
8
2
8
0 99
8
2
8
1 99
8
0 50
8
2
8
1 50
8
0 125
8
2
8
0 136
8
2
8
1 136
8
0 175
8
2
8
1 175
8
0 49
8
2
8
0 39
8
2
8
0 142
8
2
8
1 1...

result:

ok 

Test #21:

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

input:

200
1
1
1
1
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
1
1
1
1
1
1
2
1
2
2
2
1
1
1
2
2
1
2
2
2
1
1
2
2
2
1
1
1
1
1
1
1
2
2
1
1
2
2
2
2
1
2
2
2
1
2
2
1
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 176
8
2
8
0 12
8
2
8
0 169
8
2
8
0 139
8
2
8
0 135
8
2
8
0 38
8
2
8
0 125
8
2
8
0 179
8
2
8
0 141
8
2
8
0 44
8
2
8
0 165
8
2
8
0 158
8
2
8
0 37
8
2
8
1 37
8
0 78
8
2
8
0 89
8
2
8
1 89
8
0 62
8
2
8
0 41
8
2
8
0 99
8
2
8
1 99
8
0 54
8
2
8
0 190
8
2
8
0 189
8
2
8
0 154
8
2
8
0 115
8
2
8
0 18
8
2
8
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 171
8
2
8
0 176
8
2
8
0 129
8
2
8
0 109
8
2
8
0 162
8
2
8
0 5
8
2
8
0 51
8
2
8
0 123
8
2
8
0 196
8
2
8
0 60
8
2
8
0 96
8
2
8
0 195
8
2
8
1 195
8
0 104
8
2
8
0 14
8
2
8
0 134
8
2
8
0 41
8
2
8
0 181
8
2
8
0 43
8
2
8
0 108
8
2
8
0 47
8
2
8
0 98
8
2
8
0 193
8
2
8
0 1
8
2
8
0 186
8
2
8
1 186
8
0 35
8...

result:

ok 

Test #23:

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

input:

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

output:

8
0 185
8
2
8
0 20
8
2
8
0 170
8
2
8
0 138
8
2
8
0 78
8
2
8
0 160
8
2
8
0 176
8
2
8
0 87
8
2
8
0 114
8
2
8
0 101
8
2
8
0 172
8
2
8
0 117
8
2
8
0 81
8
2
8
1 81
8
0 14
8
2
8
0 193
8
2
8
0 86
8
2
8
1 86
8
0 122
8
2
8
0 197
8
2
8
0 125
8
2
8
0 36
8
2
8
0 6
8
2
8
0 15
8
2
8
0 90
8
2
8
0 64
8
2
8
0 124
8
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 11ms
memory: 3720kb

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 308
8
2
8
0 953
8
2
8
1 953
8
0 19
8
2
8
1 19
8
0 337
8
2
8
1 337
8
0 238
8
2
8
1 238
8
0 596
8
2
8
1 596
8
0 968
8
2
8
1 968
8
0 177
8
2
8
1 177
8
0 383
8
2
8
1 383
8
0 919
8
2
8
1 919
8
0 903
8
2
8
1 903
8
0 735
8
2
8
1 735
8
0 681
8
2
8
1 681
8
0 861
8
2
8
1 861
8
0 921
8
2
8
1 921
8
0 957
8
...

result:

ok 

Test #25:

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

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 226
8
2
8
0 803
8
2
8
0 351
8
2
8
0 154
8
2
8
0 380
8
2
8
0 773
8
2
8
0 281
8
2
8
0 884
8
2
8
0 743
8
2
8
0 387
8
2
8
0 471
8
2
8
0 513
8
2
8
0 355
8
2
8
0 762
8
2
8
0 566
8
2
8
0 315
8
2
8
0 702
8
2
8
0 952
8
2
8
0 391
8
2
8
0 518
8
2
8
0 479
8
2
8
0 441
8
2
8
0 665
8
2
8
0 583
8
2
8
0 913
8
2
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 727
8
2
8
0 550
8
2
8
0 874
8
2
8
0 651
8
2
8
0 940
8
2
8
0 53
8
2
8
0 83
8
2
8
1 83
8
0 259
8
2
8
0 576
8
2
8
0 171
8
2
8
0 232
8
2
8
0 347
8
2
8
1 347
8
0 452
8
2
8
0 131
8
2
8
0 98
8
2
8
0 543
8
2
8
1 543
8
0 570
8
2
8
1 570
8
0 145
8
2
8
1 145
8
0 336
8
2
8
0 500
8
2
8
0 560
8
2
8
1 560
8
0 ...

result:

ok 

Test #27:

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

input:

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

output:

8
0 157
8
2
8
0 377
8
2
8
0 308
8
2
8
0 428
8
2
8
0 62
8
2
8
0 472
8
2
8
0 238
8
2
8
0 173
8
2
8
1 173
8
0 214
8
2
8
0 134
8
2
8
1 134
8
0 223
8
2
8
0 375
8
2
8
0 788
8
2
8
0 888
8
2
8
0 958
8
2
8
0 909
8
2
8
0 82
8
2
8
0 655
8
2
8
1 655
8
0 127
8
2
8
0 178
8
2
8
0 609
8
2
8
1 609
8
0 87
8
2
8
1 87
...

result:

ok 

Test #28:

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

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 423
8
2
8
0 238
8
2
8
1 238
8
0 430
8
2
8
1 430
8
0 494
8
2
8
1 494
8
0 261
8
2
8
1 261
8
0 821
8
2
8
1 821
8
0 972
8
2
8
1 972
8
0 217
8
2
8
1 217
8
0 392
8
2
8
1 392
8
0 725
8
2
8
1 725
8
0 436
8
2
8
1 436
8
0 993
8
2
8
1 993
8
0 775
8
2
8
1 775
8
0 168
8
2
8
1 168
8
0 470
8
2
8
1 470
8
0 311
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 256
8
2
8
0 807
8
2
8
1 807
8
0 789
8
2
8
0 2
8
2
8
0 605
8
2
8
1 605
8
0 407
8
2
8
0 654
8
2
8
0 170
8
2
8
0 144
8
2
8
0 335
8
2
8
1 335
8
0 463
8
2
8
0 544
8
2
8
0 193
8
2
8
0 134
8
2
8
1 134
8
0 743
8
2
8
1 743
8
0 792
8
2
8
0 51
8
2
8
0 324
8
2
8
0 541
8
2
8
0 869
8
2
8
1 869
8
0 312
8
2
8
1...

result:

ok 

Test #30:

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

input:

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

output:

8
0 218
8
2
8
0 922
8
2
8
0 190
8
2
8
1 190
8
0 252
8
2
8
1 252
8
0 26
8
2
8
1 26
8
0 361
8
2
8
0 297
8
2
8
0 914
8
2
8
1 914
8
0 403
8
2
8
1 403
8
0 398
8
2
8
1 398
8
0 282
8
2
8
1 282
8
0 897
8
2
8
1 897
8
0 617
8
2
8
1 617
8
0 498
8
2
8
1 498
8
0 316
8
2
8
1 316
8
0 483
8
2
8
1 483
8
0 896
8
2
8
...

result:

ok 

Test #31:

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

input:

998
1
1
2
1
1
1
1
1
1
1
1
1
1
1
2
1
1
2
1
1
2
1
1
1
2
2
1
2
2
1
2
2
2
1
1
1
2
2
2
2
2
1
2
2
2
1
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
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 633
8
2
8
0 17
8
2
8
0 626
8
2
8
1 626
8
0 962
8
2
8
0 981
8
2
8
0 448
8
2
8
0 314
8
2
8
0 409
8
2
8
0 500
8
2
8
0 785
8
2
8
0 703
8
2
8
0 274
8
2
8
0 624
8
2
8
0 564
8
2
8
0 947
8
2
8
1 947
8
0 456
8
2
8
0 704
8
2
8
0 726
8
2
8
1 726
8
0 371
8
2
8
0 951
8
2
8
0 673
8
2
8
1 673
8
0 252
8
2
8
0 5...

result:

ok 

Test #32:

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

input:

1000
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 446
8
2
8
0 113
8
2
8
0 623
8
2
8
0 713
8
2
8
1 713
8
0 887
8
2
8
0 826
8
2
8
1 826
8
0 185
8
2
8
1 185
8
0 937
8
2
8
1 937
8
0 204
8
2
8
1 204
8
0 838
8
2
8
1 838
8
0 357
8
2
8
1 357
8
0 317
8
2
8
0 538
8
2
8
1 538
8
0 159
8
2
8
1 159
8
0 521
8
2
8
1 521
8
0 789
8
2
8
1 789
8
0 891
8
2
8
1 891
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 352
8
2
8
0 69
8
2
8
0 980
8
2
8
0 513
8
2
8
0 892
8
2
8
0 554
8
2
8
1 554
8
0 769
8
2
8
0 22
8
2
8
0 404
8
2
8
1 404
8
0 590
8
2
8
1 590
8
0 61
8
2
8
1 61
8
0 944
8
2
8
0 682
8
2
8
1 682
8
0 63
8
2
8
1 63
8
0 190
8
2
8
1 190
8
0 902
8
2
8
1 902
8
0 131
8
2
8
1 131
8
0 724
8
2
8
1 724
8
0 328
8
...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
1
2
2
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 877
8
2
8
0 630
8
2
8
0 941
8
2
8
0 488
8
2
8
0 932
8
2
8
0 732
8
2
8
1 732
8
0 221
8
2
8
1 221
8
0 839
8
2
8
0 914
8
2
8
0 886
8
2
8
0 532
8
2
8
1 532
8
0 2
8
2
8
1 2
8
0 691
8
2
8
1 691
8
0 734
8
2
8
1 734
8
0 800
8
2
8
1 800
8
0 151
8
2
8
1 151
8
0 88
8
2
8
1 88
8
0 498
8
2
8
1 498
8
0 263
8
...

result:

ok 

Test #35:

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

input:

1000
1
1
1
2
1
2
2
1
2
1
2
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 326
8
2
8
0 17
8
2
8
0 907
8
2
8
0 146
8
2
8
1 146
8
0 90
8
2
8
0 760
8
2
8
1 760
8
0 12
8
2
8
1 12
8
0 949
8
2
8
0 909
8
2
8
1 909
8
0 899
8
2
8
0 129
8
2
8
1 129
8
0 482
8
2
8
1 482
8
0 389
8
2
8
0 614
8
2
8
1 614
8
0 421
8
2
8
1 421
8
0 552
8
2
8
1 552
8
0 315
8
2
8
1 315
8
0 213
8
2
8
0 151
...

result:

ok 

Test #36:

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

input:

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

output:

8
0 400
8
2
8
0 343
8
2
8
0 601
8
2
8
1 601
8
0 467
8
2
8
0 781
8
2
8
0 771
8
2
8
0 121
8
2
8
0 985
8
2
8
1 985
8
0 252
8
2
8
0 546
8
2
8
1 546
8
0 430
8
2
8
0 902
8
2
8
1 902
8
0 852
8
2
8
1 852
8
0 645
8
2
8
1 645
8
0 291
8
2
8
1 291
8
0 745
8
2
8
1 745
8
0 401
8
2
8
0 0
8
2
8
1 0
8
0 47
8
2
8
0 7...

result:

ok 

Test #37:

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

input:

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

output:

8
0 989
8
2
8
0 408
8
2
8
0 161
8
2
8
0 481
8
2
8
0 827
8
2
8
1 827
8
0 21
8
2
8
0 383
8
2
8
1 383
8
0 733
8
2
8
0 561
8
2
8
0 45
8
2
8
0 499
8
2
8
0 787
8
2
8
1 787
8
0 818
8
2
8
1 818
8
0 833
8
2
8
0 261
8
2
8
0 188
8
2
8
0 895
8
2
8
1 895
8
0 928
8
2
8
1 928
8
0 301
8
2
8
1 301
8
0 538
8
2
8
1 53...

result:

ok 

Test #38:

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

input:

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

output:

8
0 143
8
2
8
0 659
8
2
8
0 136
8
2
8
0 789
8
2
8
0 651
8
2
8
0 992
8
2
8
0 884
8
2
8
0 68
8
2
8
0 940
8
2
8
1 940
8
0 888
8
2
8
0 841
8
2
8
0 488
8
2
8
0 267
8
2
8
0 249
8
2
8
1 249
8
0 880
8
2
8
0 592
8
2
8
0 241
8
2
8
0 647
8
2
8
0 478
8
2
8
0 581
8
2
8
0 311
8
2
8
0 309
8
2
8
1 309
8
0 369
8
2
8...

result:

ok 

Test #39:

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

input:

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

output:

8
0 968
8
2
8
0 573
8
2
8
0 747
8
2
8
0 933
8
2
8
0 563
8
2
8
0 3
8
2
8
0 252
8
2
8
0 521
8
2
8
1 521
8
0 637
8
2
8
0 35
8
2
8
0 651
8
2
8
0 432
8
2
8
0 197
8
2
8
0 75
8
2
8
0 889
8
2
8
0 538
8
2
8
0 692
8
2
8
0 481
8
2
8
1 481
8
0 85
8
2
8
0 364
8
2
8
0 395
8
2
8
0 243
8
2
8
0 730
8
2
8
0 994
8
2
8...

result:

ok 

Test #40:

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

input:

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

output:

8
0 423
8
2
8
0 95
8
2
8
0 813
8
2
8
0 364
8
2
8
0 0
8
2
8
0 116
8
2
8
0 540
8
2
8
0 194
8
2
8
0 125
8
2
8
0 544
8
2
8
0 750
8
2
8
0 438
8
2
8
0 719
8
2
8
0 143
8
2
8
0 506
8
2
8
0 784
8
2
8
0 325
8
2
8
0 181
8
2
8
0 490
8
2
8
0 489
8
2
8
0 69
8
2
8
0 391
8
2
8
0 169
8
2
8
0 928
8
2
8
0 106
8
2
8
1 ...

result:

ok 

Test #41:

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

input:

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

output:

8
0 337
8
2
8
0 780
8
2
8
0 981
8
2
8
0 431
8
2
8
0 317
8
2
8
0 485
8
2
8
0 972
8
2
8
0 551
8
2
8
0 537
8
2
8
0 37
8
2
8
0 974
8
2
8
0 41
8
2
8
0 362
8
2
8
0 455
8
2
8
0 512
8
2
8
0 490
8
2
8
0 633
8
2
8
0 868
8
2
8
0 412
8
2
8
0 628
8
2
8
0 167
8
2
8
0 293
8
2
8
0 510
8
2
8
1 510
8
0 499
8
2
8
0 70...

result:

ok 

Test #42:

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

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

output:

8
0 775
8
2
8
0 664
8
2
8
0 804
8
2
8
0 535
8
2
8
0 509
8
2
8
0 161
8
2
8
0 897
8
2
8
0 695
8
2
8
0 131
8
2
8
0 658
8
2
8
0 909
8
2
8
0 582
8
2
8
0 171
8
2
8
0 693
8
2
8
0 778
8
2
8
0 253
8
2
8
0 621
8
2
8
0 46
8
2
8
0 409
8
2
8
0 195
8
2
8
0 931
8
2
8
0 908
8
2
8
0 865
8
2
8
0 808
8
2
8
0 347
8
2
8...

result:

ok 

Subtask #3:

score: 74.19
Acceptable Answer

Test #43:

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

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

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 #46:

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

input:

6
1
2
2
2
1
2
1
1

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

score: 75
Accepted
time: 26ms
memory: 3780kb

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 1926
8
2
8
0 794
8
2
8
1 794
8
0 580
8
2
8
1 580
8
0 1305
8
2
8
1 1305
8
0 785
8
2
8
1 785
8
0 1959
8
2
8
1 1959
8
0 1302
8
2
8
1 1302
8
0 529
8
2
8
1 529
8
0 1613
8
2
8
1 1613
8
0 265
8
2
8
1 265
8
0 1640
8
2
8
1 1640
8
0 1500
8
2
8
1 1500
8
0 950
8
2
8
1 950
8
0 1135
8
2
8
1 1135
8
0 240
8
2
8...

result:

ok 

Test #49:

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

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 1353
8
2
8
0 795
8
2
8
0 1002
8
2
8
0 1816
8
2
8
0 158
8
2
8
0 1399
8
2
8
0 1449
8
2
8
0 1917
8
2
8
0 668
8
2
8
0 507
8
2
8
0 867
8
2
8
0 781
8
2
8
0 1835
8
2
8
0 1424
8
2
8
0 1519
8
2
8
0 1405
8
2
8
0 1162
8
2
8
0 144
8
2
8
0 562
8
2
8
0 136
8
2
8
0 975
8
2
8
0 713
8
2
8
0 111
8
2
8
0 850
8
2
8...

result:

ok 

Test #50:

score: 74.75
Acceptable Answer
time: 99ms
memory: 3892kb

input:

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

output:

8
0 152
8
2
8
0 1455
8
2
8
0 1523
8
2
8
1 1523
8
0 37
8
2
8
0 1292
8
2
8
0 1899
8
2
8
1 1899
8
0 1271
8
2
8
0 615
8
2
8
0 1855
8
2
8
0 564
8
2
8
0 1291
8
2
8
0 700
8
2
8
1 700
8
0 1576
8
2
8
1 1576
8
0 18
8
2
8
0 206
8
2
8
0 1024
8
2
8
0 1369
8
2
8
1 1369
8
0 210
8
2
8
0 27
8
2
8
1 27
8
0 469
8
2
8
...

result:

points 0.99666666670 points  0.99666666670

Test #51:

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

input:

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

output:

8
0 1367
8
2
8
0 456
8
2
8
0 666
8
2
8
0 768
8
2
8
0 184
8
2
8
0 1485
8
2
8
0 758
8
2
8
0 1622
8
2
8
0 146
8
2
8
1 146
8
0 1533
8
2
8
0 1355
8
2
8
0 1322
8
2
8
1 1322
8
0 1342
8
2
8
1 1342
8
0 1991
8
2
8
0 99
8
2
8
0 1675
8
2
8
1 1675
8
0 433
8
2
8
0 523
8
2
8
1 523
8
0 813
8
2
8
0 1084
8
2
8
0 861
...

result:

ok 

Test #52:

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

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 139
8
2
8
0 1224
8
2
8
1 1224
8
0 101
8
2
8
1 101
8
0 556
8
2
8
1 556
8
0 1271
8
2
8
1 1271
8
0 1421
8
2
8
1 1421
8
0 241
8
2
8
1 241
8
0 547
8
2
8
1 547
8
0 1805
8
2
8
1 1805
8
0 861
8
2
8
1 861
8
0 1713
8
2
8
1 1713
8
0 847
8
2
8
1 847
8
0 1180
8
2
8
1 1180
8
0 1017
8
2
8
1 1017
8
0 400
8
2
8
...

result:

ok 

Test #53:

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

input:

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

output:

8
0 654
8
2
8
0 700
8
2
8
0 686
8
2
8
1 686
8
0 1810
8
2
8
0 1152
8
2
8
1 1152
8
0 57
8
2
8
1 57
8
0 1306
8
2
8
0 1178
8
2
8
1 1178
8
0 523
8
2
8
1 523
8
0 670
8
2
8
1 670
8
0 220
8
2
8
1 220
8
0 1884
8
2
8
0 1931
8
2
8
1 1931
8
0 1478
8
2
8
1 1478
8
0 1144
8
2
8
1 1144
8
0 1400
8
2
8
0 274
8
2
8
0 ...

result:

ok 

Test #54:

score: 75
Accepted
time: 35ms
memory: 3728kb

input:

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

output:

8
0 734
8
2
8
0 671
8
2
8
0 1654
8
2
8
1 1654
8
0 922
8
2
8
1 922
8
0 238
8
2
8
0 288
8
2
8
1 288
8
0 1930
8
2
8
0 818
8
2
8
1 818
8
0 1691
8
2
8
1 1691
8
0 1939
8
2
8
1 1939
8
0 483
8
2
8
1 483
8
0 1728
8
2
8
1 1728
8
0 664
8
2
8
1 664
8
0 1159
8
2
8
1 1159
8
0 382
8
2
8
1 382
8
0 875
8
2
8
1 875
8...

result:

ok 

Test #55:

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

input:

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

output:

8
0 1835
8
2
8
0 481
8
2
8
0 905
8
2
8
0 1642
8
2
8
0 1557
8
2
8
0 641
8
2
8
0 1584
8
2
8
0 1898
8
2
8
1 1898
8
0 721
8
2
8
0 1913
8
2
8
0 1206
8
2
8
0 1909
8
2
8
0 1830
8
2
8
0 1722
8
2
8
1 1722
8
0 314
8
2
8
0 989
8
2
8
1 989
8
0 282
8
2
8
0 1403
8
2
8
1 1403
8
0 222
8
2
8
0 530
8
2
8
1 530
8
0 14...

result:

ok 

Test #56:

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

input:

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

output:

8
0 925
8
2
8
0 730
8
2
8
0 1324
8
2
8
0 923
8
2
8
0 1437
8
2
8
1 1437
8
0 816
8
2
8
1 816
8
0 204
8
2
8
0 1818
8
2
8
1 1818
8
0 640
8
2
8
1 640
8
0 1287
8
2
8
1 1287
8
0 711
8
2
8
1 711
8
0 1300
8
2
8
1 1300
8
0 1139
8
2
8
1 1139
8
0 656
8
2
8
1 656
8
0 638
8
2
8
1 638
8
0 811
8
2
8
1 811
8
0 1751
...

result:

ok 

Test #57:

score: 74.96
Acceptable Answer
time: 27ms
memory: 3760kb

input:

1999
1
2
1
2
1
2
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 91
8
2
8
0 1483
8
2
8
1 1483
8
0 779
8
2
8
0 1008
8
2
8
1 1008
8
0 13
8
2
8
0 934
8
2
8
1 934
8
0 707
8
2
8
0 509
8
2
8
0 1150
8
2
8
1 1150
8
0 292
8
2
8
0 555
8
2
8
1 555
8
0 209
8
2
8
1 209
8
0 1444
8
2
8
1 1444
8
0 262
8
2
8
0 1017
8
2
8
1 1017
8
0 1636
8
2
8
1 1636
8
0 396
8
2
8
0 593
8
2
8
...

result:

points 0.99946666670 points  0.99946666670

Test #58:

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

input:

1997
1
1
2
1
1
1
2
2
1
2
2
1
2
2
2
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 715
8
2
8
0 941
8
2
8
0 1246
8
2
8
1 1246
8
0 1088
8
2
8
0 908
8
2
8
0 49
8
2
8
0 1615
8
2
8
1 1615
8
0 1302
8
2
8
1 1302
8
0 19
8
2
8
0 821
8
2
8
1 821
8
0 1604
8
2
8
1 1604
8
0 917
8
2
8
0 1428
8
2
8
1 1428
8
0 695
8
2
8
1 695
8
0 1341
8
2
8
1 1341
8
0 1629
8
2
8
0 811
8
2
8
1 811
8
0 69
8
2
8...

result:

ok 

Test #59:

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

input:

1998
1
1
2
1
1
1
1
1
2
1
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 790
8
2
8
0 810
8
2
8
0 1598
8
2
8
1 1598
8
0 931
8
2
8
0 1563
8
2
8
0 1262
8
2
8
0 1855
8
2
8
0 622
8
2
8
0 1242
8
2
8
1 1242
8
0 600
8
2
8
0 1018
8
2
8
1 1018
8
0 1019
8
2
8
0 486
8
2
8
1 486
8
0 540
8
2
8
0 1211
8
2
8
0 1098
8
2
8
1 1098
8
0 266
8
2
8
1 266
8
0 1616
8
2
8
1 1616
8
0 1311
8
2
...

result:

ok 

Test #60:

score: 74.82
Acceptable Answer
time: 82ms
memory: 3864kb

input:

1996
1
1
1
1
1
1
1
2
2
1
2
1
1
2
1
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1947
8
2
8
0 1471
8
2
8
0 808
8
2
8
0 972
8
2
8
0 1644
8
2
8
0 869
8
2
8
0 751
8
2
8
0 1825
8
2
8
1 1825
8
0 343
8
2
8
1 343
8
0 1008
8
2
8
0 1502
8
2
8
1 1502
8
0 704
8
2
8
0 537
8
2
8
0 470
8
2
8
1 470
8
0 1457
8
2
8
0 399
8
2
8
0 654
8
2
8
1 654
8
0 232
8
2
8
1 232
8
0 1721
8
2
8
1 1721
8
0 1...

result:

points 0.99760 points  0.99760

Test #61:

score: 75
Accepted
time: 53ms
memory: 3792kb

input:

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

output:

8
0 1375
8
2
8
0 10
8
2
8
0 1485
8
2
8
0 1002
8
2
8
1 1002
8
0 1499
8
2
8
0 1881
8
2
8
0 1339
8
2
8
0 905
8
2
8
1 905
8
0 1795
8
2
8
1 1795
8
0 988
8
2
8
0 85
8
2
8
0 1447
8
2
8
1 1447
8
0 1403
8
2
8
0 305
8
2
8
1 305
8
0 1709
8
2
8
1 1709
8
0 1037
8
2
8
1 1037
8
0 856
8
2
8
0 1434
8
2
8
1 1434
8
0 ...

result:

ok 

Test #62:

score: 75
Accepted
time: 75ms
memory: 3880kb

input:

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

output:

8
0 998
8
2
8
0 1986
8
2
8
0 100
8
2
8
0 515
8
2
8
1 515
8
0 1899
8
2
8
0 1600
8
2
8
0 1144
8
2
8
0 458
8
2
8
0 471
8
2
8
1 471
8
0 220
8
2
8
0 1285
8
2
8
0 333
8
2
8
0 685
8
2
8
0 1590
8
2
8
0 1729
8
2
8
0 1447
8
2
8
0 1451
8
2
8
0 1993
8
2
8
0 31
8
2
8
1 31
8
0 68
8
2
8
1 68
8
0 519
8
2
8
0 234
8
...

result:

ok 

Test #63:

score: 74.72
Acceptable Answer
time: 57ms
memory: 3872kb

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

output:

8
0 617
8
2
8
0 472
8
2
8
0 452
8
2
8
0 663
8
2
8
0 325
8
2
8
0 77
8
2
8
0 1883
8
2
8
0 1794
8
2
8
0 1302
8
2
8
0 1289
8
2
8
0 999
8
2
8
0 1103
8
2
8
0 1372
8
2
8
0 224
8
2
8
0 1014
8
2
8
0 1917
8
2
8
0 1528
8
2
8
0 1444
8
2
8
0 1317
8
2
8
0 1050
8
2
8
0 1241
8
2
8
0 1097
8
2
8
0 187
8
2
8
0 136
8
2...

result:

points 0.99626666670 points  0.99626666670

Test #64:

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

input:

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

output:

8
0 615
8
2
8
0 1794
8
2
8
0 328
8
2
8
0 361
8
2
8
0 557
8
2
8
0 1157
8
2
8
0 1186
8
2
8
0 1699
8
2
8
0 1917
8
2
8
0 220
8
2
8
0 1658
8
2
8
0 1581
8
2
8
0 726
8
2
8
0 811
8
2
8
0 1334
8
2
8
0 897
8
2
8
0 692
8
2
8
0 1746
8
2
8
0 380
8
2
8
0 817
8
2
8
1 817
8
0 1544
8
2
8
1 1544
8
0 125
8
2
8
0 1601
...

result:

ok 

Test #65:

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

input:

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

output:

8
0 1030
8
2
8
0 756
8
2
8
0 1971
8
2
8
0 633
8
2
8
0 807
8
2
8
0 1549
8
2
8
0 1322
8
2
8
0 1067
8
2
8
0 720
8
2
8
0 772
8
2
8
0 168
8
2
8
0 1188
8
2
8
0 1757
8
2
8
0 1306
8
2
8
0 1628
8
2
8
0 207
8
2
8
0 37
8
2
8
0 386
8
2
8
0 1962
8
2
8
1 1962
8
0 690
8
2
8
0 959
8
2
8
0 678
8
2
8
0 951
8
2
8
0 18...

result:

ok 

Test #66:

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

input:

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

output:

8
0 518
8
2
8
0 417
8
2
8
0 1699
8
2
8
0 470
8
2
8
0 452
8
2
8
0 1285
8
2
8
0 1657
8
2
8
0 672
8
2
8
0 321
8
2
8
0 572
8
2
8
0 508
8
2
8
0 1267
8
2
8
0 62
8
2
8
0 1986
8
2
8
0 1305
8
2
8
0 909
8
2
8
0 1883
8
2
8
0 576
8
2
8
0 1113
8
2
8
0 1833
8
2
8
0 211
8
2
8
0 671
8
2
8
0 1471
8
2
8
0 1401
8
2
8
...

result:

ok 

Test #67:

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

input:

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

output:

8
0 69
8
2
8
0 450
8
2
8
0 1701
8
2
8
0 756
8
2
8
0 1260
8
2
8
0 845
8
2
8
0 1327
8
2
8
0 127
8
2
8
0 436
8
2
8
0 1550
8
2
8
0 688
8
2
8
0 418
8
2
8
0 1974
8
2
8
0 355
8
2
8
0 987
8
2
8
0 1997
8
2
8
0 1419
8
2
8
0 1694
8
2
8
0 235
8
2
8
1 235
8
0 1256
8
2
8
0 216
8
2
8
0 444
8
2
8
0 837
8
2
8
0 1365...

result:

ok 

Test #68:

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

input:

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

output:

8
0 1101
8
2
8
0 1512
8
2
8
0 932
8
2
8
0 724
8
2
8
0 1579
8
2
8
0 798
8
2
8
0 714
8
2
8
0 1976
8
2
8
0 1286
8
2
8
1 1286
8
0 1884
8
2
8
0 1043
8
2
8
0 617
8
2
8
0 484
8
2
8
0 290
8
2
8
0 1104
8
2
8
0 1375
8
2
8
0 626
8
2
8
0 653
8
2
8
0 1567
8
2
8
0 1165
8
2
8
0 1452
8
2
8
1 1452
8
0 500
8
2
8
0 16...

result:

points 0.99840 points  0.99840

Test #69:

score: 74.88
Acceptable Answer
time: 38ms
memory: 3760kb

input:

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

output:

8
0 31
8
2
8
0 1592
8
2
8
0 1801
8
2
8
0 469
8
2
8
0 580
8
2
8
0 278
8
2
8
0 79
8
2
8
0 1650
8
2
8
0 534
8
2
8
0 196
8
2
8
0 1235
8
2
8
0 956
8
2
8
0 185
8
2
8
0 1107
8
2
8
0 242
8
2
8
0 1333
8
2
8
0 120
8
2
8
0 1268
8
2
8
0 1360
8
2
8
1 1360
8
0 562
8
2
8
1 562
8
0 587
8
2
8
1 587
8
0 29
8
2
8
1 29...

result:

points 0.99840 points  0.99840

Test #70:

score: 74.5
Acceptable Answer
time: 50ms
memory: 3728kb

input:

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

output:

8
0 1522
8
2
8
0 1525
8
2
8
0 374
8
2
8
0 1889
8
2
8
0 661
8
2
8
0 1803
8
2
8
0 1004
8
2
8
0 1219
8
2
8
0 34
8
2
8
1 34
8
0 1397
8
2
8
1 1397
8
0 383
8
2
8
0 246
8
2
8
1 246
8
0 1334
8
2
8
0 127
8
2
8
0 573
8
2
8
0 225
8
2
8
1 225
8
0 1735
8
2
8
0 718
8
2
8
1 718
8
0 317
8
2
8
0 1665
8
2
8
0 376
8
2...

result:

points 0.99333333330 points  0.99333333330

Test #71:

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

input:

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

output:

8
0 483
8
2
8
0 573
8
2
8
0 1693
8
2
8
0 1932
8
2
8
0 1268
8
2
8
0 527
8
2
8
0 1048
8
2
8
0 579
8
2
8
0 1944
8
2
8
1 1944
8
0 1626
8
2
8
0 791
8
2
8
0 1401
8
2
8
0 1485
8
2
8
0 1691
8
2
8
1 1691
8
0 1077
8
2
8
1 1077
8
0 1001
8
2
8
0 793
8
2
8
0 474
8
2
8
1 474
8
0 257
8
2
8
0 1766
8
2
8
0 921
8
2
8...

result:

points 0.99280 points  0.99280

Test #72:

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

input:

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

output:

8
0 1126
8
2
8
0 214
8
2
8
0 1301
8
2
8
0 1369
8
2
8
0 578
8
2
8
0 1912
8
2
8
0 719
8
2
8
0 1698
8
2
8
0 1028
8
2
8
0 533
8
2
8
0 1608
8
2
8
0 1687
8
2
8
0 780
8
2
8
0 437
8
2
8
1 437
8
0 1280
8
2
8
0 867
8
2
8
1 867
8
0 155
8
2
8
1 155
8
0 600
8
2
8
0 805
8
2
8
0 1799
8
2
8
0 346
8
2
8
0 1060
8
2
8...

result:

ok 

Test #73:

score: 75
Accepted
time: 74ms
memory: 3748kb

input:

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

output:

8
0 1675
8
2
8
0 936
8
2
8
0 103
8
2
8
0 328
8
2
8
0 1511
8
2
8
0 848
8
2
8
0 1341
8
2
8
0 1853
8
2
8
0 168
8
2
8
0 43
8
2
8
0 1617
8
2
8
0 733
8
2
8
0 1311
8
2
8
1 1311
8
0 1599
8
2
8
0 405
8
2
8
0 1457
8
2
8
0 1524
8
2
8
0 202
8
2
8
0 1636
8
2
8
1 1636
8
0 1979
8
2
8
0 1053
8
2
8
0 1821
8
2
8
0 11...

result:

ok 

Test #74:

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

input:

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

output:

8
0 1003
8
2
8
0 1546
8
2
8
0 1017
8
2
8
0 865
8
2
8
0 1544
8
2
8
0 987
8
2
8
0 1419
8
2
8
0 571
8
2
8
0 544
8
2
8
0 3
8
2
8
0 325
8
2
8
0 1467
8
2
8
1 1467
8
0 1125
8
2
8
0 1512
8
2
8
0 1552
8
2
8
0 1585
8
2
8
0 657
8
2
8
1 657
8
0 1176
8
2
8
0 315
8
2
8
0 1300
8
2
8
0 343
8
2
8
0 923
8
2
8
1 923
8...

result:

ok 

Test #75:

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

input:

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

output:

8
0 1862
8
2
8
0 1447
8
2
8
0 1134
8
2
8
0 1676
8
2
8
0 1878
8
2
8
0 158
8
2
8
0 1523
8
2
8
0 1526
8
2
8
0 1154
8
2
8
0 671
8
2
8
0 1232
8
2
8
0 298
8
2
8
0 1952
8
2
8
0 1394
8
2
8
0 211
8
2
8
0 1731
8
2
8
0 1842
8
2
8
0 424
8
2
8
0 204
8
2
8
0 1610
8
2
8
1 1610
8
0 354
8
2
8
1 354
8
0 984
8
2
8
0 1...

result:

ok 

Test #76:

score: 74.27
Acceptable Answer
time: 34ms
memory: 3876kb

input:

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

output:

8
0 1474
8
2
8
0 487
8
2
8
0 1285
8
2
8
1 1285
8
0 1729
8
2
8
0 1194
8
2
8
0 1604
8
2
8
0 1644
8
2
8
0 726
8
2
8
0 307
8
2
8
0 1695
8
2
8
1 1695
8
0 733
8
2
8
1 733
8
0 1386
8
2
8
0 657
8
2
8
0 1825
8
2
8
0 1138
8
2
8
0 1494
8
2
8
0 1857
8
2
8
0 826
8
2
8
0 1718
8
2
8
1 1718
8
0 925
8
2
8
0 193
8
2
...

result:

points 0.99026666670 points  0.99026666670

Test #77:

score: 74.19
Acceptable Answer
time: 50ms
memory: 3840kb

input:

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

output:

8
0 140
8
2
8
0 1882
8
2
8
0 1192
8
2
8
0 652
8
2
8
0 1869
8
2
8
0 678
8
2
8
0 292
8
2
8
0 1035
8
2
8
0 552
8
2
8
0 1507
8
2
8
1 1507
8
0 854
8
2
8
0 707
8
2
8
0 1112
8
2
8
0 542
8
2
8
0 938
8
2
8
0 475
8
2
8
0 957
8
2
8
0 1350
8
2
8
0 649
8
2
8
1 649
8
0 469
8
2
8
0 51
8
2
8
0 1058
8
2
8
1 1058
8
0...

result:

points 0.98920 points  0.98920

Test #78:

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

input:

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

output:

8
0 1942
8
2
8
0 709
8
2
8
0 716
8
2
8
0 1564
8
2
8
0 461
8
2
8
0 15
8
2
8
0 1895
8
2
8
0 58
8
2
8
0 1234
8
2
8
1 1234
8
0 1456
8
2
8
0 245
8
2
8
0 424
8
2
8
0 1338
8
2
8
1 1338
8
0 140
8
2
8
0 1978
8
2
8
0 1646
8
2
8
0 277
8
2
8
0 623
8
2
8
0 1927
8
2
8
0 1729
8
2
8
0 1445
8
2
8
0 331
8
2
8
0 1019
...

result:

ok 

Test #79:

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

input:

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

output:

8
0 264
8
2
8
0 342
8
2
8
0 490
8
2
8
0 1509
8
2
8
0 106
8
2
8
1 106
8
0 1849
8
2
8
0 1082
8
2
8
1 1082
8
0 312
8
2
8
0 565
8
2
8
1 565
8
0 35
8
2
8
0 1227
8
2
8
1 1227
8
0 1902
8
2
8
0 317
8
2
8
0 1113
8
2
8
0 160
8
2
8
0 182
8
2
8
0 1295
8
2
8
0 30
8
2
8
0 1931
8
2
8
0 1284
8
2
8
0 424
8
2
8
0 876...

result:

ok 

Test #80:

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

input:

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

output:

8
0 1873
8
2
8
0 1640
8
2
8
0 1431
8
2
8
0 719
8
2
8
0 929
8
2
8
0 1073
8
2
8
0 228
8
2
8
0 1974
8
2
8
0 1575
8
2
8
0 167
8
2
8
0 1148
8
2
8
0 1733
8
2
8
1 1733
8
0 637
8
2
8
0 375
8
2
8
0 748
8
2
8
0 445
8
2
8
0 1683
8
2
8
0 1125
8
2
8
0 1342
8
2
8
0 452
8
2
8
0 598
8
2
8
0 203
8
2
8
0 1574
8
2
8
0...

result:

ok 

Test #81:

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

input:

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

output:

8
0 658
8
2
8
0 481
8
2
8
0 396
8
2
8
0 1471
8
2
8
0 324
8
2
8
0 1856
8
2
8
0 808
8
2
8
0 841
8
2
8
0 60
8
2
8
0 903
8
2
8
0 1389
8
2
8
0 1566
8
2
8
1 1566
8
0 1692
8
2
8
0 1799
8
2
8
0 424
8
2
8
1 424
8
0 874
8
2
8
0 657
8
2
8
0 1176
8
2
8
0 1189
8
2
8
0 926
8
2
8
0 992
8
2
8
0 930
8
2
8
0 1210
8
2...

result:

ok 

Test #82:

score: 74.2
Acceptable Answer
time: 30ms
memory: 3864kb

input:

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

output:

8
0 30
8
2
8
0 396
8
2
8
0 909
8
2
8
0 370
8
2
8
0 1889
8
2
8
0 437
8
2
8
0 304
8
2
8
0 1041
8
2
8
0 585
8
2
8
0 994
8
2
8
0 1373
8
2
8
0 455
8
2
8
0 182
8
2
8
0 1844
8
2
8
0 1039
8
2
8
1 1039
8
0 507
8
2
8
0 808
8
2
8
0 1616
8
2
8
0 1914
8
2
8
0 901
8
2
8
0 268
8
2
8
0 1606
8
2
8
0 1291
8
2
8
0 804...

result:

points 0.98933333330 points  0.98933333330

Test #83:

score: 74.2
Acceptable Answer
time: 89ms
memory: 3860kb

input:

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

output:

8
0 1508
8
2
8
0 1954
8
2
8
0 124
8
2
8
0 1760
8
2
8
0 1647
8
2
8
0 1266
8
2
8
0 1072
8
2
8
0 152
8
2
8
0 1838
8
2
8
1 1838
8
0 1691
8
2
8
0 918
8
2
8
1 918
8
0 1458
8
2
8
1 1458
8
0 507
8
2
8
0 1303
8
2
8
0 459
8
2
8
0 386
8
2
8
0 1858
8
2
8
0 1922
8
2
8
1 1922
8
0 1185
8
2
8
0 1110
8
2
8
1 1110
8
...

result:

points 0.98933333330 points  0.98933333330

Test #84:

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

input:

540
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
1
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 311
8
2
8
0 275
8
2
8
0 30
8
2
8
1 30
8
0 370
8
2
8
1 370
8
0 513
8
2
8
1 513
8
0 49
8
2
8
1 49
8
0 227
8
2
8
1 227
8
0 523
8
2
8
1 523
8
0 50
8
2
8
1 50
8
0 439
8
2
8
1 439
8
0 181
8
2
8
1 181
8
0 29
8
2
8
1 29
8
0 208
8
2
8
1 208
8
0 391
8
2
8
1 391
8
0 27
8
2
8
1 27
8
0 474
8
2
8
1 474
8
0 21...

result:

ok 

Test #85:

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

input:

1834
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1522
8
2
8
0 1176
8
2
8
1 1176
8
0 478
8
2
8
0 1030
8
2
8
1 1030
8
0 297
8
2
8
1 297
8
0 283
8
2
8
1 283
8
0 1668
8
2
8
1 1668
8
0 1251
8
2
8
1 1251
8
0 274
8
2
8
1 274
8
0 650
8
2
8
1 650
8
0 1401
8
2
8
1 1401
8
0 1721
8
2
8
1 1721
8
0 1819
8
2
8
1 1819
8
0 1462
8
2
8
1 1462
8
0 1422
8
2
8
1 14...

result:

ok 

Test #86:

score: 75
Accepted
time: 16ms
memory: 3792kb

input:

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

output:

8
0 1843
8
2
8
0 1364
8
2
8
0 1013
8
2
8
1 1013
8
0 1020
8
2
8
1 1020
8
0 1184
8
2
8
1 1184
8
0 1537
8
2
8
1 1537
8
0 993
8
2
8
1 993
8
0 830
8
2
8
1 830
8
0 981
8
2
8
1 981
8
0 1792
8
2
8
1 1792
8
0 1724
8
2
8
1 1724
8
0 709
8
2
8
1 709
8
0 1848
8
2
8
1 1848
8
0 229
8
2
8
1 229
8
0 1691
8
2
8
1 169...

result:

ok 

Test #87:

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

input:

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

output:

8
0 1166
8
2
8
0 1392
8
2
8
0 1129
8
2
8
0 1869
8
2
8
0 1480
8
2
8
0 294
8
2
8
0 944
8
2
8
1 944
8
0 1375
8
2
8
0 1370
8
2
8
0 243
8
2
8
1 243
8
0 1349
8
2
8
0 1798
8
2
8
0 234
8
2
8
1 234
8
0 388
8
2
8
1 388
8
0 1373
8
2
8
0 1705
8
2
8
0 1399
8
2
8
0 1117
8
2
8
0 460
8
2
8
1 460
8
0 1874
8
2
8
0 13...

result:

ok 

Test #88:

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

input:

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

output:

8
0 185
8
2
8
0 676
8
2
8
0 332
8
2
8
0 1905
8
2
8
0 759
8
2
8
0 1856
8
2
8
1 1856
8
0 1136
8
2
8
1 1136
8
0 826
8
2
8
0 1453
8
2
8
1 1453
8
0 1967
8
2
8
1 1967
8
0 274
8
2
8
0 1175
8
2
8
1 1175
8
0 1049
8
2
8
1 1049
8
0 840
8
2
8
0 1424
8
2
8
1 1424
8
0 1747
8
2
8
1 1747
8
0 193
8
2
8
0 1409
8
2
8
...

result:

ok 

Test #89:

score: 75
Accepted
time: 14ms
memory: 3728kb

input:

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

output:

8
0 27
8
2
8
0 1764
8
2
8
1 1764
8
0 612
8
2
8
0 505
8
2
8
0 204
8
2
8
1 204
8
0 173
8
2
8
1 173
8
0 487
8
2
8
1 487
8
0 1465
8
2
8
0 1507
8
2
8
1 1507
8
0 634
8
2
8
0 49
8
2
8
1 49
8
0 339
8
2
8
1 339
8
0 110
8
2
8
1 110
8
0 1527
8
2
8
1 1527
8
0 1678
8
2
8
1 1678
8
0 1978
8
2
8
1 1978
8
0 806
8
2
...

result:

ok