QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#45959#4565. Rarest InsectsGuanYunchang98.07 83ms3908kbC++175.7kb2022-08-24 18:46:242022-08-24 18:50:16

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
2
1
2
2
1
1

output:

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

result:

ok 

Test #2:

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

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

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

result:

ok 

Test #5:

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

input:

5
1
2
1
2
2
1
1
2
2
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

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 103
8
2
8
0 142
8
2
8
1 142
8
0 197
8
2
8
1 197
8
0 177
8
2
8
1 177
8
0 44
8
2
8
1 44
8
0 28
8
2
8
1 28
8
0 165
8
2
8
1 165
8
0 50
8
2
8
1 50
8
0 190
8
2
8
1 190
8
0 113
8
2
8
1 113
8
0 76
8
2
8
1 76
8
0 94
8
2
8
1 94
8
0 97
8
2
8
1 97
8
0 120
8
2
8
1 120
8
0 64
8
2
8
1 64
8
0 39
8
2
8
1 39
8
0 ...

result:

ok 

Test #8:

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

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 5
8
2
8
0 117
8
2
8
0 70
8
2
8
0 99
8
2
8
0 53
8
2
8
0 100
8
2
8
0 114
8
2
8
0 49
8
2
8
0 155
8
2
8
0 2
8
2
8
0 71
8
2
8
0 141
8
2
8
0 77
8
2
8
0 16
8
2
8
0 33
8
2
8
0 46
8
2
8
0 142
8
2
8
0 63
8
2
8
0 73
8
2
8
0 174
8
2
8
0 8
8
2
8
0 9
8
2
8
0 154
8
2
8
0 67
8
2
8
0 76
8
2
8
0 194
8
2
8
0 95
8
...

result:

ok 

Test #9:

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

input:

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

output:

8
0 88
8
2
8
0 163
8
2
8
0 118
8
2
8
0 99
8
2
8
0 175
8
2
8
1 175
8
0 28
8
2
8
0 80
8
2
8
1 80
8
0 133
8
2
8
0 171
8
2
8
0 30
8
2
8
1 30
8
0 83
8
2
8
1 83
8
0 145
8
2
8
1 145
8
0 178
8
2
8
0 165
8
2
8
0 91
8
2
8
0 0
8
2
8
1 0
8
0 150
8
2
8
1 150
8
0 64
8
2
8
1 64
8
0 10
8
2
8
1 10
8
0 2
8
2
8
1 2
8
...

result:

ok 

Test #10:

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

input:

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

output:

8
0 111
8
2
8
0 142
8
2
8
0 158
8
2
8
0 62
8
2
8
0 91
8
2
8
0 165
8
2
8
1 165
8
0 64
8
2
8
1 64
8
0 13
8
2
8
0 113
8
2
8
1 113
8
0 58
8
2
8
0 84
8
2
8
0 162
8
2
8
1 162
8
0 67
8
2
8
0 167
8
2
8
1 167
8
0 14
8
2
8
1 14
8
0 68
8
2
8
1 68
8
0 89
8
2
8
1 89
8
0 150
8
2
8
0 83
8
2
8
1 83
8
0 1
8
2
8
1 1
...

result:

ok 

Test #11:

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

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
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 77
8
2
8
0 166
8
2
8
1 166
8
0 111
8
2
8
1 111
8
0 146
8
2
8
1 146
8
0 149
8
2
8
1 149
8
0 87
8
2
8
1 87
8
0 160
8
2
8
1 160
8
0 64
8
2
8
1 64
8
0 132
8
2
8
1 132
8
0 184
8
2
8
1 184
8
0 59
8
2
8
1 59
8
0 66
8
2
8
1 66
8
0 124
8
2
8
1 124
8
0 130
8
2
8
1 130
8
0 142
8
2
8
1 142
8
0 135
8
2
8
1 1...

result:

ok 

Test #12:

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

input:

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

output:

8
0 196
8
2
8
0 145
8
2
8
0 25
8
2
8
0 180
8
2
8
1 180
8
0 121
8
2
8
0 171
8
2
8
0 46
8
2
8
0 83
8
2
8
1 83
8
0 165
8
2
8
0 47
8
2
8
0 157
8
2
8
0 51
8
2
8
0 182
8
2
8
1 182
8
0 76
8
2
8
1 76
8
0 151
8
2
8
1 151
8
0 143
8
2
8
1 143
8
0 81
8
2
8
1 81
8
0 33
8
2
8
0 14
8
2
8
1 14
8
0 35
8
2
8
0 18
8
2...

result:

ok 

Test #13:

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

input:

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

output:

8
0 91
8
2
8
0 62
8
2
8
0 119
8
2
8
0 181
8
2
8
1 181
8
0 85
8
2
8
1 85
8
0 47
8
2
8
1 47
8
0 55
8
2
8
1 55
8
0 115
8
2
8
1 115
8
0 176
8
2
8
1 176
8
0 80
8
2
8
1 80
8
0 23
8
2
8
1 23
8
0 71
8
2
8
0 168
8
2
8
1 168
8
0 106
8
2
8
1 106
8
0 157
8
2
8
1 157
8
0 92
8
2
8
1 92
8
0 24
8
2
8
1 24
8
0 4
8
2...

result:

ok 

Test #14:

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

input:

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

output:

8
0 16
8
2
8
0 115
8
2
8
0 183
8
2
8
0 104
8
2
8
0 113
8
2
8
0 79
8
2
8
0 36
8
2
8
0 19
8
2
8
1 19
8
0 66
8
2
8
0 160
8
2
8
1 160
8
0 190
8
2
8
1 190
8
0 32
8
2
8
0 127
8
2
8
1 127
8
0 74
8
2
8
1 74
8
0 0
8
2
8
1 0
8
0 196
8
2
8
1 196
8
0 138
8
2
8
1 138
8
0 1
8
2
8
0 123
8
2
8
1 123
8
0 98
8
2
8
1 ...

result:

ok 

Test #15:

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

input:

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

output:

8
0 34
8
2
8
0 121
8
2
8
1 121
8
0 90
8
2
8
0 70
8
2
8
1 70
8
0 106
8
2
8
0 37
8
2
8
0 29
8
2
8
1 29
8
0 50
8
2
8
1 50
8
0 129
8
2
8
1 129
8
0 112
8
2
8
0 27
8
2
8
1 27
8
0 54
8
2
8
1 54
8
0 20
8
2
8
1 20
8
0 107
8
2
8
1 107
8
0 137
8
2
8
1 137
8
0 156
8
2
8
1 156
8
0 68
8
2
8
1 68
8
0 173
8
2
8
1 1...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 104
8
2
8
0 121
8
2
8
0 143
8
2
8
0 113
8
2
8
0 151
8
2
8
0 58
8
2
8
0 127
8
2
8
1 127
8
0 72
8
2
8
1 72
8
0 162
8
2
8
1 162
8
0 131
8
2
8
1 131
8
0 76
8
2
8
1 76
8
0 73
8
2
8
1 73
8
0 158
8
2
8
1 158
8
0 80
8
2
8
0 9
8
2
8
1 9
8
0 129
8
2
8
1 129
8
0 83
8
2
8
1 83
8
0 10
8
2
8
1 10
8
0 117
8
2
...

result:

ok 

Test #17:

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

input:

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

output:

8
0 104
8
2
8
0 133
8
2
8
0 140
8
2
8
0 161
8
2
8
0 37
8
2
8
0 16
8
2
8
0 0
8
2
8
1 0
8
0 110
8
2
8
0 79
8
2
8
0 159
8
2
8
1 159
8
0 187
8
2
8
0 160
8
2
8
1 160
8
0 69
8
2
8
1 69
8
0 130
8
2
8
1 130
8
0 167
8
2
8
1 167
8
0 184
8
2
8
1 184
8
0 29
8
2
8
1 29
8
0 181
8
2
8
1 181
8
0 165
8
2
8
1 165
8
0...

result:

ok 

Test #18:

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

input:

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

output:

8
0 121
8
2
8
0 137
8
2
8
0 40
8
2
8
1 40
8
0 5
8
2
8
0 34
8
2
8
0 20
8
2
8
0 172
8
2
8
0 14
8
2
8
1 14
8
0 119
8
2
8
1 119
8
0 175
8
2
8
0 147
8
2
8
0 12
8
2
8
1 12
8
0 76
8
2
8
0 142
8
2
8
1 142
8
0 36
8
2
8
1 36
8
0 81
8
2
8
1 81
8
0 162
8
2
8
1 162
8
0 44
8
2
8
1 44
8
0 124
8
2
8
1 124
8
0 61
8
...

result:

ok 

Test #19:

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

input:

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

output:

8
0 65
8
2
8
0 53
8
2
8
0 26
8
2
8
1 26
8
0 187
8
2
8
0 152
8
2
8
0 121
8
2
8
0 161
8
2
8
0 191
8
2
8
1 191
8
0 32
8
2
8
1 32
8
0 78
8
2
8
1 78
8
0 155
8
2
8
0 163
8
2
8
1 163
8
0 148
8
2
8
1 148
8
0 100
8
2
8
0 42
8
2
8
1 42
8
0 90
8
2
8
1 90
8
0 27
8
2
8
0 132
8
2
8
1 132
8
0 22
8
2
8
0 31
8
2
8
1...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
1
2
2
1
2
2
2
1
1
2
1
2
1
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
2
2
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 83
8
2
8
0 174
8
2
8
0 8
8
2
8
0 183
8
2
8
0 170
8
2
8
0 14
8
2
8
0 98
8
2
8
1 98
8
0 141
8
2
8
1 141
8
0 139
8
2
8
0 4
8
2
8
1 4
8
0 71
8
2
8
1 71
8
0 127
8
2
8
1 127
8
0 88
8
2
8
0 65
8
2
8
0 72
8
2
8
1 72
8
0 159
8
2
8
0 178
8
2
8
1 178
8
0 45
8
2
8
0 131
8
2
8
0 26
8
2
8
1 26
8
0 ...

result:

ok 

Test #21:

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

input:

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

output:

8
0 46
8
2
8
0 23
8
2
8
0 84
8
2
8
0 136
8
2
8
0 194
8
2
8
0 71
8
2
8
0 59
8
2
8
0 97
8
2
8
0 100
8
2
8
0 189
8
2
8
0 103
8
2
8
1 103
8
0 28
8
2
8
0 199
8
2
8
1 199
8
0 10
8
2
8
0 15
8
2
8
0 25
8
2
8
1 25
8
0 13
8
2
8
1 13
8
0 125
8
2
8
1 125
8
0 130
8
2
8
0 91
8
2
8
1 91
8
0 135
8
2
8
1 135
8
0 40
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 121
8
2
8
0 54
8
2
8
0 130
8
2
8
0 93
8
2
8
0 20
8
2
8
0 141
8
2
8
0 142
8
2
8
0 151
8
2
8
0 184
8
2
8
0 4
8
2
8
0 76
8
2
8
0 123
8
2
8
0 179
8
2
8
0 5
8
2
8
0 18
8
2
8
0 197
8
2
8
0 29
8
2
8
0 47
8
2
8
0 24
8
2
8
0 143
8
2
8
0 46
8
2
8
1 46
8
0 45
8
2
8
0 162
8
2
8
0 125
8
2
8
0 69
8
2
8
0 31
8...

result:

ok 

Test #23:

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

input:

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

output:

8
0 124
8
2
8
0 191
8
2
8
0 9
8
2
8
0 173
8
2
8
0 28
8
2
8
0 187
8
2
8
0 43
8
2
8
0 44
8
2
8
0 178
8
2
8
0 114
8
2
8
0 81
8
2
8
0 39
8
2
8
0 150
8
2
8
0 139
8
2
8
0 10
8
2
8
0 193
8
2
8
0 1
8
2
8
0 82
8
2
8
0 156
8
2
8
0 92
8
2
8
1 92
8
0 109
8
2
8
0 21
8
2
8
0 16
8
2
8
0 146
8
2
8
0 59
8
2
8
1 59
8...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

score: 15
Accepted
time: 1ms
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 460
8
2
8
0 557
8
2
8
1 557
8
0 415
8
2
8
1 415
8
0 901
8
2
8
1 901
8
0 591
8
2
8
1 591
8
0 252
8
2
8
1 252
8
0 970
8
2
8
1 970
8
0 874
8
2
8
1 874
8
0 752
8
2
8
1 752
8
0 340
8
2
8
1 340
8
0 41
8
2
8
1 41
8
0 491
8
2
8
1 491
8
0 310
8
2
8
1 310
8
0 734
8
2
8
1 734
8
0 954
8
2
8
1 954
8
0 162
8
...

result:

ok 

Test #25:

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

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 289
8
2
8
0 442
8
2
8
0 3
8
2
8
0 360
8
2
8
0 371
8
2
8
0 445
8
2
8
0 96
8
2
8
0 63
8
2
8
0 933
8
2
8
0 53
8
2
8
0 839
8
2
8
0 25
8
2
8
0 888
8
2
8
0 235
8
2
8
0 976
8
2
8
0 467
8
2
8
0 176
8
2
8
0 922
8
2
8
0 494
8
2
8
0 49
8
2
8
0 768
8
2
8
0 202
8
2
8
0 815
8
2
8
0 265
8
2
8
0 752
8
2
8
0 816...

result:

ok 

Test #26:

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

input:

999
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
2
1
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
1
2
1
1
1
1
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
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 110
8
2
8
0 306
8
2
8
0 579
8
2
8
0 711
8
2
8
0 770
8
2
8
0 434
8
2
8
1 434
8
0 156
8
2
8
0 747
8
2
8
1 747
8
0 487
8
2
8
1 487
8
0 132
8
2
8
0 561
8
2
8
0 261
8
2
8
0 521
8
2
8
0 679
8
2
8
0 929
8
2
8
1 929
8
0 596
8
2
8
0 316
8
2
8
1 316
8
0 813
8
2
8
0 282
8
2
8
0 522
8
2
8
0 586
8
2
8
0 797
...

result:

ok 

Test #27:

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

input:

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

output:

8
0 299
8
2
8
0 263
8
2
8
1 263
8
0 408
8
2
8
0 342
8
2
8
0 32
8
2
8
0 249
8
2
8
1 249
8
0 204
8
2
8
0 271
8
2
8
0 329
8
2
8
0 738
8
2
8
0 230
8
2
8
1 230
8
0 352
8
2
8
0 465
8
2
8
0 544
8
2
8
0 834
8
2
8
0 422
8
2
8
0 571
8
2
8
0 120
8
2
8
0 790
8
2
8
1 790
8
0 232
8
2
8
1 232
8
0 175
8
2
8
0 525
8...

result:

ok 

Test #28:

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

input:

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

output:

8
0 236
8
2
8
0 227
8
2
8
1 227
8
0 490
8
2
8
1 490
8
0 492
8
2
8
1 492
8
0 187
8
2
8
1 187
8
0 229
8
2
8
1 229
8
0 524
8
2
8
1 524
8
0 903
8
2
8
1 903
8
0 637
8
2
8
1 637
8
0 275
8
2
8
1 275
8
0 432
8
2
8
1 432
8
0 791
8
2
8
1 791
8
0 252
8
2
8
1 252
8
0 435
8
2
8
1 435
8
0 438
8
2
8
1 438
8
0 954
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 575
8
2
8
0 653
8
2
8
0 904
8
2
8
0 158
8
2
8
0 384
8
2
8
1 384
8
0 460
8
2
8
0 766
8
2
8
1 766
8
0 986
8
2
8
0 915
8
2
8
1 915
8
0 518
8
2
8
0 274
8
2
8
0 517
8
2
8
1 517
8
0 938
8
2
8
0 450
8
2
8
1 450
8
0 31
8
2
8
1 31
8
0 888
8
2
8
1 888
8
0 96
8
2
8
1 96
8
0 353
8
2
8
1 353
8
0 656
8
2
8
1 ...

result:

ok 

Test #30:

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

input:

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

output:

8
0 451
8
2
8
0 910
8
2
8
0 337
8
2
8
1 337
8
0 591
8
2
8
0 457
8
2
8
1 457
8
0 386
8
2
8
1 386
8
0 19
8
2
8
1 19
8
0 841
8
2
8
1 841
8
0 635
8
2
8
1 635
8
0 854
8
2
8
0 986
8
2
8
1 986
8
0 578
8
2
8
1 578
8
0 275
8
2
8
1 275
8
0 156
8
2
8
1 156
8
0 684
8
2
8
1 684
8
0 623
8
2
8
1 623
8
0 303
8
2
8
...

result:

ok 

Test #31:

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

input:

998
1
1
1
1
1
1
2
1
1
1
1
1
2
1
2
1
1
2
2
2
1
2
2
1
2
2
2
2
1
2
2
1
2
2
1
1
1
2
1
2
2
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 75
8
2
8
0 118
8
2
8
0 958
8
2
8
0 422
8
2
8
0 883
8
2
8
0 392
8
2
8
0 454
8
2
8
1 454
8
0 921
8
2
8
0 688
8
2
8
0 705
8
2
8
0 239
8
2
8
0 235
8
2
8
0 742
8
2
8
1 742
8
0 836
8
2
8
0 492
8
2
8
1 492
8
0 622
8
2
8
0 412
8
2
8
0 33
8
2
8
1 33
8
0 585
8
2
8
1 585
8
0 635
8
2
8
1 635
8
0 335
8
2
8
0...

result:

ok 

Test #32:

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

input:

1000
1
1
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 143
8
2
8
0 860
8
2
8
0 220
8
2
8
1 220
8
0 581
8
2
8
0 809
8
2
8
0 822
8
2
8
1 822
8
0 842
8
2
8
1 842
8
0 191
8
2
8
1 191
8
0 663
8
2
8
1 663
8
0 176
8
2
8
0 868
8
2
8
1 868
8
0 108
8
2
8
1 108
8
0 234
8
2
8
1 234
8
0 52
8
2
8
1 52
8
0 861
8
2
8
1 861
8
0 102
8
2
8
1 102
8
0 673
8
2
8
1 673
8
...

result:

ok 

Test #33:

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

input:

996
1
2
1
1
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 117
8
2
8
0 902
8
2
8
1 902
8
0 926
8
2
8
0 777
8
2
8
0 304
8
2
8
0 382
8
2
8
0 146
8
2
8
0 124
8
2
8
1 124
8
0 143
8
2
8
1 143
8
0 134
8
2
8
1 134
8
0 784
8
2
8
0 989
8
2
8
1 989
8
0 21
8
2
8
1 21
8
0 164
8
2
8
1 164
8
0 713
8
2
8
1 713
8
0 426
8
2
8
1 426
8
0 665
8
2
8
1 665
8
0 660
8
2
8
1 66...

result:

ok 

Test #34:

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

input:

1000
1
2
1
1
1
1
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 837
8
2
8
0 507
8
2
8
1 507
8
0 747
8
2
8
0 300
8
2
8
0 251
8
2
8
0 756
8
2
8
0 860
8
2
8
1 860
8
0 159
8
2
8
0 333
8
2
8
0 172
8
2
8
1 172
8
0 603
8
2
8
0 841
8
2
8
1 841
8
0 668
8
2
8
1 668
8
0 676
8
2
8
1 676
8
0 143
8
2
8
1 143
8
0 98
8
2
8
1 98
8
0 354
8
2
8
1 354
8
0 380
8
2
8
1 380
8
0 95...

result:

ok 

Test #35:

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

input:

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

output:

8
0 964
8
2
8
0 546
8
2
8
0 218
8
2
8
0 676
8
2
8
1 676
8
0 279
8
2
8
0 52
8
2
8
0 142
8
2
8
0 723
8
2
8
1 723
8
0 926
8
2
8
1 926
8
0 164
8
2
8
1 164
8
0 948
8
2
8
1 948
8
0 781
8
2
8
1 781
8
0 508
8
2
8
0 999
8
2
8
0 836
8
2
8
1 836
8
0 974
8
2
8
1 974
8
0 401
8
2
8
1 401
8
0 28
8
2
8
0 134
8
2
8
...

result:

ok 

Test #36:

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

input:

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

output:

8
0 524
8
2
8
0 424
8
2
8
0 341
8
2
8
1 341
8
0 11
8
2
8
0 872
8
2
8
1 872
8
0 126
8
2
8
0 592
8
2
8
0 179
8
2
8
0 672
8
2
8
0 689
8
2
8
1 689
8
0 285
8
2
8
0 187
8
2
8
1 187
8
0 168
8
2
8
0 52
8
2
8
1 52
8
0 686
8
2
8
1 686
8
0 761
8
2
8
1 761
8
0 613
8
2
8
1 613
8
0 195
8
2
8
1 195
8
0 154
8
2
8
1...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
1
2
1
1
1
1
2
2
2
1
2
1
1
2
2
1
2
2
1
2
1
2
2
2
2
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 910
8
2
8
0 330
8
2
8
0 90
8
2
8
0 640
8
2
8
0 382
8
2
8
0 915
8
2
8
1 915
8
0 968
8
2
8
0 980
8
2
8
0 73
8
2
8
0 357
8
2
8
0 98
8
2
8
1 98
8
0 87
8
2
8
1 87
8
0 783
8
2
8
1 783
8
0 490
8
2
8
0 529
8
2
8
1 529
8
0 928
8
2
8
0 354
8
2
8
0 463
8
2
8
1 463
8
0 492
8
2
8
1 492
8
0 605
8
2
8
0 639
8
...

result:

ok 

Test #38:

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

input:

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

output:

8
0 699
8
2
8
0 621
8
2
8
0 54
8
2
8
0 595
8
2
8
0 383
8
2
8
0 529
8
2
8
0 277
8
2
8
0 983
8
2
8
0 198
8
2
8
1 198
8
0 724
8
2
8
0 336
8
2
8
0 765
8
2
8
1 765
8
0 230
8
2
8
1 230
8
0 417
8
2
8
0 677
8
2
8
0 357
8
2
8
1 357
8
0 485
8
2
8
0 32
8
2
8
1 32
8
0 916
8
2
8
1 916
8
0 695
8
2
8
0 922
8
2
8
1...

result:

ok 

Test #39:

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

input:

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

output:

8
0 384
8
2
8
0 136
8
2
8
0 874
8
2
8
0 403
8
2
8
0 4
8
2
8
0 871
8
2
8
0 283
8
2
8
0 287
8
2
8
0 672
8
2
8
0 454
8
2
8
0 426
8
2
8
0 370
8
2
8
0 564
8
2
8
0 598
8
2
8
0 381
8
2
8
0 317
8
2
8
0 948
8
2
8
0 489
8
2
8
1 489
8
0 894
8
2
8
0 335
8
2
8
0 738
8
2
8
0 508
8
2
8
0 823
8
2
8
1 823
8
0 337
8
...

result:

ok 

Test #40:

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

input:

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

output:

8
0 390
8
2
8
0 677
8
2
8
0 39
8
2
8
0 670
8
2
8
0 693
8
2
8
0 265
8
2
8
0 940
8
2
8
0 628
8
2
8
0 80
8
2
8
0 199
8
2
8
0 20
8
2
8
0 84
8
2
8
1 84
8
0 411
8
2
8
0 708
8
2
8
0 587
8
2
8
0 355
8
2
8
0 489
8
2
8
0 889
8
2
8
0 660
8
2
8
0 218
8
2
8
0 618
8
2
8
0 750
8
2
8
0 508
8
2
8
0 699
8
2
8
0 203
8...

result:

ok 

Test #41:

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

input:

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

output:

8
0 568
8
2
8
0 294
8
2
8
0 305
8
2
8
0 32
8
2
8
0 498
8
2
8
0 813
8
2
8
0 886
8
2
8
0 56
8
2
8
0 905
8
2
8
0 933
8
2
8
0 658
8
2
8
0 594
8
2
8
0 660
8
2
8
0 356
8
2
8
0 254
8
2
8
0 760
8
2
8
0 502
8
2
8
0 335
8
2
8
0 310
8
2
8
0 563
8
2
8
0 682
8
2
8
0 530
8
2
8
0 391
8
2
8
0 362
8
2
8
0 145
8
2
8
...

result:

ok 

Test #42:

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

input:

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

output:

8
0 6
8
2
8
0 526
8
2
8
0 933
8
2
8
0 350
8
2
8
0 428
8
2
8
0 160
8
2
8
0 726
8
2
8
0 696
8
2
8
0 215
8
2
8
0 727
8
2
8
0 272
8
2
8
0 969
8
2
8
0 361
8
2
8
0 505
8
2
8
0 409
8
2
8
0 396
8
2
8
0 518
8
2
8
0 919
8
2
8
0 155
8
2
8
0 2
8
2
8
0 660
8
2
8
0 629
8
2
8
0 949
8
2
8
0 484
8
2
8
0 651
8
2
8
0 ...

result:

ok 

Subtask #3:

score: 73.07
Acceptable Answer

Test #43:

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

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

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

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

input:

6
1
2
2
2
2
1
1

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 948
8
2
8
0 989
8
2
8
1 989
8
0 1712
8
2
8
1 1712
8
0 1865
8
2
8
1 1865
8
0 1504
8
2
8
1 1504
8
0 1536
8
2
8
1 1536
8
0 67
8
2
8
1 67
8
0 487
8
2
8
1 487
8
0 1705
8
2
8
1 1705
8
0 1441
8
2
8
1 1441
8
0 323
8
2
8
1 323
8
0 1485
8
2
8
1 1485
8
0 1421
8
2
8
1 1421
8
0 458
8
2
8
1 458
8
0 1397
8
2
8...

result:

ok 

Test #49:

score: 75
Accepted
time: 37ms
memory: 3736kb

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 1718
8
2
8
0 1979
8
2
8
0 1522
8
2
8
0 653
8
2
8
0 1053
8
2
8
0 1438
8
2
8
0 897
8
2
8
0 700
8
2
8
0 1577
8
2
8
0 1706
8
2
8
0 1391
8
2
8
0 1525
8
2
8
0 131
8
2
8
0 1230
8
2
8
0 128
8
2
8
0 1588
8
2
8
0 1825
8
2
8
0 41
8
2
8
0 240
8
2
8
0 549
8
2
8
0 1684
8
2
8
0 1238
8
2
8
0 1335
8
2
8
0 1150
8...

result:

ok 

Test #50:

score: 74.75
Acceptable Answer
time: 13ms
memory: 3780kb

input:

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

output:

8
0 494
8
2
8
0 375
8
2
8
0 256
8
2
8
0 257
8
2
8
1 257
8
0 1734
8
2
8
0 1055
8
2
8
0 114
8
2
8
0 1855
8
2
8
0 856
8
2
8
0 117
8
2
8
0 530
8
2
8
0 981
8
2
8
0 290
8
2
8
1 290
8
0 98
8
2
8
0 1661
8
2
8
0 1545
8
2
8
0 451
8
2
8
1 451
8
0 1600
8
2
8
0 1098
8
2
8
0 569
8
2
8
0 1234
8
2
8
1 1234
8
0 804
...

result:

points 0.99666666670 points  0.99666666670

Test #51:

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

input:

2000
1
1
1
2
1
1
1
2
1
1
1
1
1
1
1
1
2
1
1
1
2
1
1
2
1
1
1
1
2
2
2
2
1
1
1
1
2
2
2
2
2
1
1
2
1
1
1
2
1
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
1
2
1
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
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 32
8
2
8
0 1661
8
2
8
0 1320
8
2
8
0 366
8
2
8
1 366
8
0 844
8
2
8
0 524
8
2
8
0 800
8
2
8
0 1118
8
2
8
1 1118
8
0 787
8
2
8
0 1882
8
2
8
0 1101
8
2
8
0 1870
8
2
8
0 1363
8
2
8
0 15
8
2
8
0 1354
8
2
8
0 1500
8
2
8
0 1874
8
2
8
1 1874
8
0 550
8
2
8
0 1083
8
2
8
0 1335
8
2
8
0 1763
8
2
8
1 1763
8
...

result:

ok 

Test #52:

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

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

output:

8
0 72
8
2
8
0 694
8
2
8
1 694
8
0 1154
8
2
8
1 1154
8
0 834
8
2
8
1 834
8
0 1076
8
2
8
1 1076
8
0 778
8
2
8
1 778
8
0 88
8
2
8
1 88
8
0 1330
8
2
8
1 1330
8
0 1462
8
2
8
1 1462
8
0 1696
8
2
8
1 1696
8
0 1556
8
2
8
1 1556
8
0 386
8
2
8
1 386
8
0 186
8
2
8
1 186
8
0 1243
8
2
8
1 1243
8
0 888
8
2
8
1 8...

result:

ok 

Test #53:

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

input:

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

output:

8
0 1063
8
2
8
0 908
8
2
8
0 1647
8
2
8
1 1647
8
0 1376
8
2
8
0 1492
8
2
8
0 867
8
2
8
1 867
8
0 526
8
2
8
0 303
8
2
8
1 303
8
0 442
8
2
8
1 442
8
0 1557
8
2
8
0 14
8
2
8
0 1636
8
2
8
0 776
8
2
8
0 1102
8
2
8
0 1904
8
2
8
0 454
8
2
8
1 454
8
0 663
8
2
8
1 663
8
0 1188
8
2
8
1 1188
8
0 1990
8
2
8
1 1...

result:

ok 

Test #54:

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

input:

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

output:

8
0 1825
8
2
8
0 213
8
2
8
0 1849
8
2
8
1 1849
8
0 324
8
2
8
1 324
8
0 719
8
2
8
0 710
8
2
8
0 658
8
2
8
1 658
8
0 836
8
2
8
1 836
8
0 484
8
2
8
1 484
8
0 136
8
2
8
1 136
8
0 538
8
2
8
1 538
8
0 1060
8
2
8
1 1060
8
0 885
8
2
8
1 885
8
0 879
8
2
8
1 879
8
0 512
8
2
8
1 512
8
0 497
8
2
8
1 497
8
0 690...

result:

ok 

Test #55:

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

input:

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

output:

8
0 11
8
2
8
0 1102
8
2
8
0 46
8
2
8
0 282
8
2
8
0 1273
8
2
8
0 1888
8
2
8
0 1431
8
2
8
0 1581
8
2
8
0 1665
8
2
8
0 1148
8
2
8
0 1869
8
2
8
1 1869
8
0 1690
8
2
8
1 1690
8
0 352
8
2
8
0 1925
8
2
8
0 606
8
2
8
0 1456
8
2
8
0 1956
8
2
8
0 276
8
2
8
0 853
8
2
8
0 1082
8
2
8
0 383
8
2
8
0 1203
8
2
8
0 19...

result:

ok 

Test #56:

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

input:

1998
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1921
8
2
8
0 1317
8
2
8
0 1516
8
2
8
0 241
8
2
8
0 1466
8
2
8
1 1466
8
0 1183
8
2
8
1 1183
8
0 1389
8
2
8
1 1389
8
0 806
8
2
8
1 806
8
0 1992
8
2
8
1 1992
8
0 937
8
2
8
1 937
8
0 827
8
2
8
0 150
8
2
8
1 150
8
0 1533
8
2
8
1 1533
8
0 1220
8
2
8
1 1220
8
0 1184
8
2
8
1 1184
8
0 1328
8
2
8
1 1328
8...

result:

ok 

Test #57:

score: 74.97
Acceptable Answer
time: 42ms
memory: 3872kb

input:

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

output:

8
0 250
8
2
8
0 671
8
2
8
0 404
8
2
8
0 776
8
2
8
0 42
8
2
8
1 42
8
0 1918
8
2
8
1 1918
8
0 266
8
2
8
0 111
8
2
8
1 111
8
0 1412
8
2
8
0 876
8
2
8
1 876
8
0 76
8
2
8
1 76
8
0 340
8
2
8
0 1448
8
2
8
0 1183
8
2
8
1 1183
8
0 1345
8
2
8
1 1345
8
0 1029
8
2
8
1 1029
8
0 1111
8
2
8
1 1111
8
0 1664
8
2
8
1...

result:

points 0.99960 points  0.99960

Test #58:

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

input:

1997
1
1
1
2
2
1
1
1
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 899
8
2
8
0 1036
8
2
8
0 455
8
2
8
0 1256
8
2
8
1 1256
8
0 1392
8
2
8
1 1392
8
0 1212
8
2
8
0 232
8
2
8
0 141
8
2
8
0 1171
8
2
8
1 1171
8
0 1928
8
2
8
1 1928
8
0 758
8
2
8
1 758
8
0 382
8
2
8
1 382
8
0 1210
8
2
8
0 750
8
2
8
1 750
8
0 79
8
2
8
1 79
8
0 1546
8
2
8
1 1546
8
0 1976
8
2
8
0 1097
8
2...

result:

ok 

Test #59:

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

input:

1998
1
1
1
2
1
1
1
2
1
2
2
1
2
1
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 92
8
2
8
0 1696
8
2
8
0 755
8
2
8
0 471
8
2
8
1 471
8
0 1264
8
2
8
0 238
8
2
8
0 1196
8
2
8
0 771
8
2
8
1 771
8
0 1856
8
2
8
0 1035
8
2
8
1 1035
8
0 1212
8
2
8
1 1212
8
0 966
8
2
8
0 346
8
2
8
1 346
8
0 1957
8
2
8
0 877
8
2
8
1 877
8
0 102
8
2
8
0 34
8
2
8
1 34
8
0 1521
8
2
8
0 351
8
2
8
1 351
8...

result:

ok 

Test #60:

score: 74.76
Acceptable Answer
time: 44ms
memory: 3876kb

input:

1996
1
1
2
1
1
2
1
1
2
2
2
2
1
2
1
1
2
1
2
2
1
1
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1965
8
2
8
0 348
8
2
8
0 153
8
2
8
1 153
8
0 399
8
2
8
0 546
8
2
8
0 762
8
2
8
1 762
8
0 1530
8
2
8
0 1040
8
2
8
0 480
8
2
8
1 480
8
0 559
8
2
8
1 559
8
0 305
8
2
8
1 305
8
0 1387
8
2
8
1 1387
8
0 951
8
2
8
0 1380
8
2
8
1 1380
8
0 1495
8
2
8
0 1583
8
2
8
0 289
8
2
8
1 289
8
0 984
8
2
8
0 943
8
2...

result:

points 0.99680 points  0.99680

Test #61:

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

input:

2000
1
1
1
1
1
1
1
1
2
2
1
1
2
1
1
1
2
2
2
2
2
2
2
1
2
2
1
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
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
2
2
2
2
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 1889
8
2
8
0 52
8
2
8
0 1859
8
2
8
0 640
8
2
8
0 1844
8
2
8
0 1280
8
2
8
0 876
8
2
8
0 409
8
2
8
0 832
8
2
8
1 832
8
0 649
8
2
8
1 649
8
0 299
8
2
8
0 672
8
2
8
0 1160
8
2
8
1 1160
8
0 57
8
2
8
0 844
8
2
8
0 588
8
2
8
0 796
8
2
8
1 796
8
0 451
8
2
8
1 451
8
0 1934
8
2
8
1 1934
8
0 972
8
2
8
1 97...

result:

points 1.0 points  1.0

Test #62:

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

input:

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

output:

8
0 1583
8
2
8
0 1751
8
2
8
0 212
8
2
8
0 1232
8
2
8
0 1675
8
2
8
0 697
8
2
8
0 715
8
2
8
0 796
8
2
8
1 796
8
0 1626
8
2
8
0 692
8
2
8
1 692
8
0 977
8
2
8
0 131
8
2
8
0 429
8
2
8
1 429
8
0 1803
8
2
8
0 1046
8
2
8
1 1046
8
0 1987
8
2
8
1 1987
8
0 1340
8
2
8
0 790
8
2
8
1 790
8
0 887
8
2
8
0 526
8
2
8...

result:

ok 

Test #63:

score: 73.07
Acceptable Answer
time: 75ms
memory: 3892kb

input:

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

output:

8
0 384
8
2
8
0 729
8
2
8
0 648
8
2
8
0 1973
8
2
8
0 414
8
2
8
0 405
8
2
8
0 651
8
2
8
0 332
8
2
8
0 1393
8
2
8
0 1341
8
2
8
0 1901
8
2
8
1 1901
8
0 265
8
2
8
0 1632
8
2
8
0 450
8
2
8
1 450
8
0 74
8
2
8
0 500
8
2
8
1 500
8
0 1583
8
2
8
1 1583
8
0 632
8
2
8
1 632
8
0 342
8
2
8
0 1085
8
2
8
0 47
8
2
8...

result:

points 0.97426666670 points  0.97426666670

Test #64:

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

input:

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

output:

8
0 1431
8
2
8
0 1323
8
2
8
0 1166
8
2
8
0 1765
8
2
8
0 584
8
2
8
0 1240
8
2
8
0 1121
8
2
8
1 1121
8
0 159
8
2
8
0 1289
8
2
8
0 889
8
2
8
0 901
8
2
8
0 1158
8
2
8
0 1388
8
2
8
0 916
8
2
8
0 1515
8
2
8
0 1741
8
2
8
0 468
8
2
8
0 1736
8
2
8
0 1220
8
2
8
0 1082
8
2
8
0 1743
8
2
8
0 438
8
2
8
0 669
8
2
...

result:

ok 

Test #65:

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

input:

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

output:

8
0 622
8
2
8
0 755
8
2
8
0 1349
8
2
8
0 943
8
2
8
0 529
8
2
8
0 1884
8
2
8
0 81
8
2
8
0 1917
8
2
8
0 900
8
2
8
0 267
8
2
8
0 1670
8
2
8
0 169
8
2
8
0 699
8
2
8
1 699
8
0 1933
8
2
8
0 726
8
2
8
0 1603
8
2
8
0 1289
8
2
8
0 890
8
2
8
0 1625
8
2
8
0 1635
8
2
8
0 1949
8
2
8
0 524
8
2
8
0 799
8
2
8
0 587...

result:

ok 

Test #66:

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

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

output:

8
0 172
8
2
8
0 44
8
2
8
0 30
8
2
8
0 60
8
2
8
0 1317
8
2
8
0 261
8
2
8
0 1950
8
2
8
0 1652
8
2
8
0 340
8
2
8
0 1511
8
2
8
0 483
8
2
8
0 1234
8
2
8
0 1259
8
2
8
0 144
8
2
8
0 252
8
2
8
0 697
8
2
8
0 220
8
2
8
0 748
8
2
8
0 415
8
2
8
0 1184
8
2
8
0 1933
8
2
8
0 926
8
2
8
0 888
8
2
8
0 1705
8
2
8
0 19...

result:

ok 

Test #67:

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

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

output:

8
0 1263
8
2
8
0 1603
8
2
8
0 1328
8
2
8
0 227
8
2
8
0 190
8
2
8
0 1930
8
2
8
0 1190
8
2
8
0 1194
8
2
8
0 1331
8
2
8
0 733
8
2
8
0 40
8
2
8
0 1574
8
2
8
0 945
8
2
8
0 1650
8
2
8
0 947
8
2
8
0 297
8
2
8
0 231
8
2
8
0 1725
8
2
8
0 1418
8
2
8
0 54
8
2
8
0 197
8
2
8
0 1515
8
2
8
0 994
8
2
8
0 1332
8
2
8...

result:

ok 

Test #68:

score: 74.88
Acceptable Answer
time: 17ms
memory: 3732kb

input:

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

output:

8
0 897
8
2
8
0 1708
8
2
8
0 643
8
2
8
0 621
8
2
8
0 1494
8
2
8
0 1329
8
2
8
1 1329
8
0 932
8
2
8
0 1199
8
2
8
1 1199
8
0 1955
8
2
8
0 240
8
2
8
0 1094
8
2
8
0 1757
8
2
8
0 1089
8
2
8
0 1216
8
2
8
0 217
8
2
8
0 105
8
2
8
1 105
8
0 1524
8
2
8
0 1711
8
2
8
0 631
8
2
8
0 337
8
2
8
0 1358
8
2
8
0 1269
8...

result:

points 0.99840 points  0.99840

Test #69:

score: 74.88
Acceptable Answer
time: 68ms
memory: 3784kb

input:

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

output:

8
0 1294
8
2
8
0 1512
8
2
8
0 1385
8
2
8
0 1006
8
2
8
0 1941
8
2
8
0 1636
8
2
8
0 340
8
2
8
0 732
8
2
8
0 226
8
2
8
0 1787
8
2
8
0 885
8
2
8
0 1291
8
2
8
0 1812
8
2
8
0 337
8
2
8
1 337
8
0 218
8
2
8
0 1377
8
2
8
0 634
8
2
8
0 1502
8
2
8
0 239
8
2
8
1 239
8
0 1359
8
2
8
0 820
8
2
8
1 820
8
0 928
8
2
...

result:

points 0.99840 points  0.99840

Test #70:

score: 74.5
Acceptable Answer
time: 49ms
memory: 3892kb

input:

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

output:

8
0 1823
8
2
8
0 346
8
2
8
0 946
8
2
8
0 1886
8
2
8
0 947
8
2
8
0 389
8
2
8
0 196
8
2
8
0 164
8
2
8
1 164
8
0 1467
8
2
8
0 867
8
2
8
0 678
8
2
8
0 764
8
2
8
0 1238
8
2
8
0 1800
8
2
8
0 1085
8
2
8
1 1085
8
0 1819
8
2
8
0 1145
8
2
8
0 1152
8
2
8
1 1152
8
0 1187
8
2
8
1 1187
8
0 193
8
2
8
1 193
8
0 180...

result:

points 0.99333333330 points  0.99333333330

Test #71:

score: 74.46
Acceptable Answer
time: 27ms
memory: 3868kb

input:

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

output:

8
0 406
8
2
8
0 1553
8
2
8
0 1031
8
2
8
1 1031
8
0 1098
8
2
8
0 50
8
2
8
0 1951
8
2
8
0 1291
8
2
8
0 937
8
2
8
0 1074
8
2
8
0 1864
8
2
8
0 1974
8
2
8
1 1974
8
0 1348
8
2
8
0 53
8
2
8
0 169
8
2
8
1 169
8
0 277
8
2
8
1 277
8
0 1792
8
2
8
0 1374
8
2
8
0 1010
8
2
8
1 1010
8
0 20
8
2
8
0 1768
8
2
8
0 69
...

result:

points 0.99280 points  0.99280

Test #72:

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

input:

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

output:

8
0 1779
8
2
8
0 1335
8
2
8
0 566
8
2
8
0 1167
8
2
8
0 337
8
2
8
0 616
8
2
8
0 312
8
2
8
0 1739
8
2
8
0 300
8
2
8
0 1247
8
2
8
0 1882
8
2
8
0 1761
8
2
8
0 1541
8
2
8
0 1709
8
2
8
0 1466
8
2
8
1 1466
8
0 1636
8
2
8
0 636
8
2
8
1 636
8
0 1880
8
2
8
0 964
8
2
8
0 1793
8
2
8
0 1016
8
2
8
0 1853
8
2
8
0 ...

result:

ok 

Test #73:

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

input:

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

output:

8
0 0
8
2
8
0 1085
8
2
8
0 143
8
2
8
0 1068
8
2
8
0 348
8
2
8
0 436
8
2
8
0 88
8
2
8
0 663
8
2
8
1 663
8
0 1007
8
2
8
0 1949
8
2
8
0 1856
8
2
8
0 166
8
2
8
0 708
8
2
8
0 649
8
2
8
0 197
8
2
8
1 197
8
0 938
8
2
8
1 938
8
0 863
8
2
8
0 1217
8
2
8
1 1217
8
0 202
8
2
8
0 1965
8
2
8
1 1965
8
0 1230
8
2
8...

result:

ok 

Test #74:

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

input:

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

output:

8
0 1721
8
2
8
0 8
8
2
8
0 873
8
2
8
0 642
8
2
8
0 622
8
2
8
0 262
8
2
8
0 672
8
2
8
0 1810
8
2
8
0 394
8
2
8
0 1869
8
2
8
0 728
8
2
8
0 910
8
2
8
0 492
8
2
8
0 961
8
2
8
0 523
8
2
8
0 1579
8
2
8
0 1725
8
2
8
0 1546
8
2
8
0 1204
8
2
8
0 1509
8
2
8
0 1069
8
2
8
0 1937
8
2
8
0 1671
8
2
8
0 1766
8
2
8
...

result:

ok 

Test #75:

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

input:

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

output:

8
0 816
8
2
8
0 1658
8
2
8
0 110
8
2
8
0 679
8
2
8
0 1913
8
2
8
0 115
8
2
8
0 504
8
2
8
0 1311
8
2
8
0 669
8
2
8
0 251
8
2
8
0 1008
8
2
8
0 393
8
2
8
0 943
8
2
8
0 1852
8
2
8
0 1186
8
2
8
0 1631
8
2
8
0 1628
8
2
8
1 1628
8
0 997
8
2
8
0 515
8
2
8
0 1386
8
2
8
1 1386
8
0 1634
8
2
8
0 54
8
2
8
0 15
8
...

result:

ok 

Test #76:

score: 74.32
Acceptable Answer
time: 66ms
memory: 3908kb

input:

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

output:

8
0 967
8
2
8
0 862
8
2
8
0 975
8
2
8
0 1432
8
2
8
1 1432
8
0 1053
8
2
8
0 1390
8
2
8
0 349
8
2
8
1 349
8
0 1517
8
2
8
0 1149
8
2
8
0 148
8
2
8
0 1242
8
2
8
0 618
8
2
8
0 1704
8
2
8
0 1686
8
2
8
0 1339
8
2
8
0 1825
8
2
8
0 1459
8
2
8
1 1459
8
0 1595
8
2
8
0 1304
8
2
8
0 1490
8
2
8
0 838
8
2
8
0 409
...

result:

points 0.99093333330 points  0.99093333330

Test #77:

score: 74.23
Acceptable Answer
time: 54ms
memory: 3792kb

input:

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

output:

8
0 541
8
2
8
0 1627
8
2
8
0 1824
8
2
8
0 1593
8
2
8
0 1030
8
2
8
0 1081
8
2
8
0 1913
8
2
8
1 1913
8
0 3
8
2
8
0 565
8
2
8
0 1800
8
2
8
0 1251
8
2
8
0 1472
8
2
8
0 1686
8
2
8
0 220
8
2
8
1 220
8
0 1683
8
2
8
0 1264
8
2
8
0 1476
8
2
8
0 824
8
2
8
0 476
8
2
8
0 654
8
2
8
0 1380
8
2
8
0 294
8
2
8
1 294...

result:

points 0.98973333330 points  0.98973333330

Test #78:

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

input:

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

output:

8
0 1672
8
2
8
0 1147
8
2
8
0 1520
8
2
8
0 1448
8
2
8
0 1779
8
2
8
0 1345
8
2
8
0 1811
8
2
8
0 436
8
2
8
0 1877
8
2
8
0 753
8
2
8
1 753
8
0 454
8
2
8
1 454
8
0 92
8
2
8
0 906
8
2
8
0 1096
8
2
8
0 231
8
2
8
0 1668
8
2
8
0 634
8
2
8
0 925
8
2
8
0 14
8
2
8
0 367
8
2
8
0 945
8
2
8
0 1485
8
2
8
0 881
8
2...

result:

ok 

Test #79:

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

input:

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

output:

8
0 74
8
2
8
0 796
8
2
8
0 1446
8
2
8
0 1134
8
2
8
0 1921
8
2
8
0 610
8
2
8
0 780
8
2
8
1 780
8
0 839
8
2
8
1 839
8
0 332
8
2
8
0 973
8
2
8
1 973
8
0 1145
8
2
8
0 1420
8
2
8
0 1049
8
2
8
0 528
8
2
8
0 1573
8
2
8
0 442
8
2
8
1 442
8
0 334
8
2
8
1 334
8
0 1057
8
2
8
0 1693
8
2
8
0 1695
8
2
8
0 200
8
2...

result:

ok 

Test #80:

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

input:

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

output:

8
0 1322
8
2
8
0 1623
8
2
8
0 1309
8
2
8
0 1802
8
2
8
0 1566
8
2
8
0 1242
8
2
8
0 58
8
2
8
0 1641
8
2
8
0 1288
8
2
8
0 312
8
2
8
0 254
8
2
8
0 865
8
2
8
0 194
8
2
8
0 1256
8
2
8
0 1138
8
2
8
0 1681
8
2
8
0 1869
8
2
8
0 110
8
2
8
0 1564
8
2
8
1 1564
8
0 201
8
2
8
0 1800
8
2
8
1 1800
8
0 864
8
2
8
1 8...

result:

ok 

Test #81:

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

input:

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

output:

8
0 1735
8
2
8
0 623
8
2
8
0 1327
8
2
8
0 1958
8
2
8
0 244
8
2
8
0 1323
8
2
8
0 1347
8
2
8
0 1871
8
2
8
0 1492
8
2
8
0 895
8
2
8
0 1952
8
2
8
0 1619
8
2
8
0 950
8
2
8
0 342
8
2
8
0 1880
8
2
8
0 1698
8
2
8
1 1698
8
0 1976
8
2
8
0 1505
8
2
8
0 1350
8
2
8
0 564
8
2
8
0 1710
8
2
8
0 1344
8
2
8
0 280
8
2...

result:

ok 

Test #82:

score: 74.2
Acceptable Answer
time: 59ms
memory: 3892kb

input:

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

output:

8
0 1009
8
2
8
0 1074
8
2
8
0 930
8
2
8
0 807
8
2
8
0 829
8
2
8
0 243
8
2
8
0 1152
8
2
8
0 1930
8
2
8
0 76
8
2
8
0 422
8
2
8
0 1232
8
2
8
0 1684
8
2
8
1 1684
8
0 934
8
2
8
0 1405
8
2
8
0 630
8
2
8
0 1688
8
2
8
0 1303
8
2
8
1 1303
8
0 1030
8
2
8
0 205
8
2
8
0 1891
8
2
8
1 1891
8
0 186
8
2
8
0 1437
8
...

result:

points 0.98933333330 points  0.98933333330

Test #83:

score: 74.2
Acceptable Answer
time: 80ms
memory: 3856kb

input:

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

output:

8
0 296
8
2
8
0 370
8
2
8
0 1996
8
2
8
0 421
8
2
8
0 249
8
2
8
0 1278
8
2
8
0 1191
8
2
8
0 1830
8
2
8
0 1039
8
2
8
0 1226
8
2
8
0 1922
8
2
8
1 1922
8
0 929
8
2
8
0 980
8
2
8
0 1384
8
2
8
0 277
8
2
8
0 1354
8
2
8
0 393
8
2
8
1 393
8
0 1470
8
2
8
1 1470
8
0 1900
8
2
8
0 1931
8
2
8
1 1931
8
0 1453
8
2
...

result:

points 0.98933333330 points  0.98933333330

Test #84:

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

input:

540
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
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
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 474
8
2
8
0 246
8
2
8
1 246
8
0 249
8
2
8
1 249
8
0 204
8
2
8
1 204
8
0 341
8
2
8
0 260
8
2
8
1 260
8
0 407
8
2
8
1 407
8
0 225
8
2
8
1 225
8
0 425
8
2
8
1 425
8
0 530
8
2
8
1 530
8
0 130
8
2
8
1 130
8
0 227
8
2
8
1 227
8
0 103
8
2
8
1 103
8
0 311
8
2
8
1 311
8
0 144
8
2
8
1 144
8
0 428
8
2
8
1 ...

result:

ok 

Test #85:

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

input:

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

output:

8
0 1745
8
2
8
0 1475
8
2
8
1 1475
8
0 1698
8
2
8
1 1698
8
0 364
8
2
8
1 364
8
0 51
8
2
8
0 77
8
2
8
1 77
8
0 1010
8
2
8
1 1010
8
0 704
8
2
8
1 704
8
0 976
8
2
8
1 976
8
0 259
8
2
8
1 259
8
0 1765
8
2
8
1 1765
8
0 203
8
2
8
1 203
8
0 115
8
2
8
1 115
8
0 156
8
2
8
1 156
8
0 1156
8
2
8
1 1156
8
0 1061...

result:

ok 

Test #86:

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

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 1889
8
2
8
0 56
8
2
8
0 90
8
2
8
1 90
8
0 305
8
2
8
1 305
8
0 107
8
2
8
1 107
8
0 1333
8
2
8
1 1333
8
0 1561
8
2
8
1 1561
8
0 805
8
2
8
1 805
8
0 681
8
2
8
1 681
8
0 51
8
2
8
1 51
8
0 194
8
2
8
1 194
8
0 1771
8
2
8
1 1771
8
0 1155
8
2
8
1 1155
8
0 783
8
2
8
1 783
8
0 995
8
2
8
1 995
8
0 875
8
2
...

result:

ok 

Test #87:

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

input:

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

output:

8
0 285
8
2
8
0 916
8
2
8
1 916
8
0 1930
8
2
8
0 166
8
2
8
1 166
8
0 1553
8
2
8
0 1752
8
2
8
0 1631
8
2
8
0 1074
8
2
8
0 367
8
2
8
1 367
8
0 1408
8
2
8
0 1063
8
2
8
0 475
8
2
8
1 475
8
0 1288
8
2
8
0 1505
8
2
8
0 292
8
2
8
1 292
8
0 1881
8
2
8
0 1611
8
2
8
0 1312
8
2
8
0 1902
8
2
8
0 243
8
2
8
1 243...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1211
8
2
8
0 1788
8
2
8
1 1788
8
0 1094
8
2
8
1 1094
8
0 705
8
2
8
0 802
8
2
8
0 1207
8
2
8
1 1207
8
0 1860
8
2
8
1 1860
8
0 1085
8
2
8
1 1085
8
0 1669
8
2
8
1 1669
8
0 1901
8
2
8
1 1901
8
0 25
8
2
8
0 584
8
2
8
0 256
8
2
8
0 1898
8
2
8
1 1898
8
0 1111
8
2
8
1 1111
8
0 1315
8
2
8
1 1315
8
0 1568...

result:

ok 

Test #89:

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

input:

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

output:

8
0 101
8
2
8
0 1282
8
2
8
0 676
8
2
8
0 1751
8
2
8
1 1751
8
0 850
8
2
8
0 1321
8
2
8
0 1876
8
2
8
1 1876
8
0 515
8
2
8
0 1389
8
2
8
0 348
8
2
8
1 348
8
0 766
8
2
8
0 1487
8
2
8
0 1360
8
2
8
0 715
8
2
8
0 597
8
2
8
0 142
8
2
8
1 142
8
0 1569
8
2
8
1 1569
8
0 730
8
2
8
0 138
8
2
8
1 138
8
0 826
8
2
8...

result:

ok