QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#45951#4565. Rarest InsectsMaMengQi95.82 68ms3896kbC++175.7kb2022-08-24 18:41:082022-08-24 18:41:11

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 3ms
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 2
8
2
8
0 4
8
2
8
1 4
8
0 5
8
2
8
1 5
8
0 1
8
2
8
1 0
8
1 2
8
1 1
8
0 1
8
2
8
3 1

result:

ok 

Test #2:

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

input:

2
1
2

output:

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

result:

ok 

Test #3:

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

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: 2ms
memory: 3824kb

input:

3
1
2
1

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
2
1
2
1
2
1
2
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

input:

199
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 133
8
2
8
0 127
8
2
8
1 127
8
0 17
8
2
8
1 17
8
0 146
8
2
8
1 146
8
0 124
8
2
8
1 124
8
0 156
8
2
8
1 156
8
0 6
8
2
8
1 6
8
0 142
8
2
8
1 142
8
0 56
8
2
8
1 56
8
0 182
8
2
8
1 182
8
0 89
8
2
8
1 89
8
0 167
8
2
8
1 167
8
0 78
8
2
8
1 78
8
0 16
8
2
8
1 16
8
0 136
8
2
8
1 136
8
0 83
8
2
8
1 83
8
0 ...

result:

ok 

Test #8:

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

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 2
8
2
8
0 62
8
2
8
0 193
8
2
8
0 166
8
2
8
0 99
8
2
8
0 108
8
2
8
0 98
8
2
8
0 138
8
2
8
0 199
8
2
8
0 103
8
2
8
0 125
8
2
8
0 86
8
2
8
0 101
8
2
8
0 97
8
2
8
0 27
8
2
8
0 28
8
2
8
0 68
8
2
8
0 78
8
2
8
0 118
8
2
8
0 156
8
2
8
0 105
8
2
8
0 172
8
2
8
0 75
8
2
8
0 5
8
2
8
0 80
8
2
8
0 42
8
2
8
0 ...

result:

ok 

Test #9:

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

input:

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

output:

8
0 189
8
2
8
0 116
8
2
8
0 38
8
2
8
0 33
8
2
8
0 102
8
2
8
1 102
8
0 196
8
2
8
1 196
8
0 35
8
2
8
1 35
8
0 91
8
2
8
0 133
8
2
8
0 146
8
2
8
0 15
8
2
8
0 121
8
2
8
1 121
8
0 74
8
2
8
1 74
8
0 101
8
2
8
0 162
8
2
8
1 162
8
0 104
8
2
8
0 80
8
2
8
1 80
8
0 41
8
2
8
0 24
8
2
8
1 24
8
0 26
8
2
8
1 26
8
0...

result:

ok 

Test #10:

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

input:

198
1
1
1
1
1
1
2
1
2
1
2
1
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 157
8
2
8
0 69
8
2
8
0 96
8
2
8
0 81
8
2
8
0 59
8
2
8
0 107
8
2
8
0 168
8
2
8
1 168
8
0 57
8
2
8
0 74
8
2
8
1 74
8
0 56
8
2
8
0 3
8
2
8
1 3
8
0 167
8
2
8
0 122
8
2
8
1 122
8
0 72
8
2
8
1 72
8
0 180
8
2
8
1 180
8
0 53
8
2
8
1 53
8
0 159
8
2
8
1 159
8
0 79
8
2
8
1 79
8
0 8
8
2
8
1 8
8
0 148
8
2
8
...

result:

ok 

Test #11:

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

input:

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

output:

8
0 23
8
2
8
0 122
8
2
8
1 122
8
0 77
8
2
8
1 77
8
0 186
8
2
8
1 186
8
0 10
8
2
8
1 10
8
0 129
8
2
8
1 129
8
0 18
8
2
8
1 18
8
0 172
8
2
8
1 172
8
0 13
8
2
8
1 13
8
0 164
8
2
8
1 164
8
0 87
8
2
8
1 87
8
0 197
8
2
8
1 197
8
0 72
8
2
8
1 72
8
0 31
8
2
8
1 31
8
0 0
8
2
8
0 38
8
2
8
1 38
8
0 36
8
2
8
1 ...

result:

ok 

Test #12:

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

input:

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

output:

8
0 60
8
2
8
0 136
8
2
8
1 136
8
0 156
8
2
8
0 130
8
2
8
1 130
8
0 124
8
2
8
1 124
8
0 47
8
2
8
0 63
8
2
8
0 22
8
2
8
0 196
8
2
8
0 167
8
2
8
1 167
8
0 164
8
2
8
0 181
8
2
8
1 181
8
0 108
8
2
8
0 80
8
2
8
0 109
8
2
8
0 19
8
2
8
0 87
8
2
8
1 87
8
0 2
8
2
8
1 2
8
0 26
8
2
8
1 26
8
0 85
8
2
8
0 139
8
2...

result:

ok 

Test #13:

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

input:

197
1
2
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1
8
2
8
0 149
8
2
8
1 149
8
0 83
8
2
8
0 75
8
2
8
0 60
8
2
8
0 171
8
2
8
1 171
8
0 42
8
2
8
1 42
8
0 24
8
2
8
1 24
8
0 46
8
2
8
1 46
8
0 112
8
2
8
1 112
8
0 156
8
2
8
1 156
8
0 119
8
2
8
1 119
8
0 160
8
2
8
1 160
8
0 163
8
2
8
1 163
8
0 138
8
2
8
1 138
8
0 94
8
2
8
1 94
8
0 45
8
2
8
1 45
8
0 61
...

result:

ok 

Test #14:

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

input:

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

output:

8
0 142
8
2
8
0 102
8
2
8
1 102
8
0 56
8
2
8
0 114
8
2
8
1 114
8
0 25
8
2
8
0 139
8
2
8
0 174
8
2
8
0 13
8
2
8
0 189
8
2
8
1 189
8
0 135
8
2
8
0 60
8
2
8
0 118
8
2
8
1 118
8
0 186
8
2
8
1 186
8
0 172
8
2
8
1 172
8
0 113
8
2
8
1 113
8
0 50
8
2
8
0 42
8
2
8
1 42
8
0 136
8
2
8
1 136
8
0 162
8
2
8
0 71
...

result:

ok 

Test #15:

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

input:

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

output:

8
0 180
8
2
8
0 153
8
2
8
0 71
8
2
8
0 59
8
2
8
0 21
8
2
8
1 21
8
0 2
8
2
8
1 2
8
0 63
8
2
8
1 63
8
0 37
8
2
8
0 173
8
2
8
1 173
8
0 159
8
2
8
1 159
8
0 164
8
2
8
1 164
8
0 9
8
2
8
1 9
8
0 141
8
2
8
1 141
8
0 91
8
2
8
1 91
8
0 76
8
2
8
1 76
8
0 119
8
2
8
1 119
8
0 118
8
2
8
1 118
8
0 64
8
2
8
1 64
8...

result:

ok 

Test #16:

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

input:

196
1
2
1
1
1
1
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 191
8
2
8
0 109
8
2
8
1 109
8
0 37
8
2
8
0 132
8
2
8
0 172
8
2
8
0 5
8
2
8
0 46
8
2
8
1 46
8
0 107
8
2
8
1 107
8
0 179
8
2
8
0 156
8
2
8
1 156
8
0 0
8
2
8
1 0
8
0 104
8
2
8
1 104
8
0 186
8
2
8
0 165
8
2
8
1 165
8
0 73
8
2
8
1 73
8
0 57
8
2
8
1 57
8
0 127
8
2
8
1 127
8
0 161
8
2
8
1 161
8
0 158
8...

result:

ok 

Test #17:

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

input:

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

output:

8
0 116
8
2
8
0 69
8
2
8
1 69
8
0 46
8
2
8
0 141
8
2
8
1 141
8
0 17
8
2
8
0 171
8
2
8
0 41
8
2
8
0 92
8
2
8
0 56
8
2
8
1 56
8
0 101
8
2
8
0 6
8
2
8
0 51
8
2
8
1 51
8
0 190
8
2
8
1 190
8
0 173
8
2
8
1 173
8
0 65
8
2
8
0 15
8
2
8
1 15
8
0 106
8
2
8
1 106
8
0 105
8
2
8
1 105
8
0 150
8
2
8
0 120
8
2
8
1...

result:

ok 

Test #18:

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

input:

196
1
1
2
1
2
1
2
1
2
2
2
2
1
1
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 131
8
2
8
0 88
8
2
8
0 176
8
2
8
1 176
8
0 135
8
2
8
0 128
8
2
8
1 128
8
0 145
8
2
8
0 39
8
2
8
1 39
8
0 69
8
2
8
0 78
8
2
8
1 78
8
0 166
8
2
8
1 166
8
0 11
8
2
8
1 11
8
0 20
8
2
8
1 20
8
0 105
8
2
8
0 136
8
2
8
0 147
8
2
8
1 147
8
0 127
8
2
8
0 68
8
2
8
0 46
8
2
8
1 46
8
0 107
8
2
8
1 107
8
0 9...

result:

ok 

Test #19:

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

input:

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

output:

8
0 80
8
2
8
0 91
8
2
8
0 143
8
2
8
0 18
8
2
8
0 13
8
2
8
0 111
8
2
8
0 117
8
2
8
1 117
8
0 84
8
2
8
1 84
8
0 9
8
2
8
0 45
8
2
8
1 45
8
0 152
8
2
8
0 137
8
2
8
0 105
8
2
8
1 105
8
0 144
8
2
8
1 144
8
0 74
8
2
8
1 74
8
0 70
8
2
8
1 70
8
0 12
8
2
8
1 12
8
0 32
8
2
8
1 32
8
0 119
8
2
8
1 119
8
0 22
8
2...

result:

ok 

Test #20:

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

input:

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

output:

8
0 112
8
2
8
0 163
8
2
8
0 65
8
2
8
0 116
8
2
8
0 114
8
2
8
0 54
8
2
8
0 85
8
2
8
0 13
8
2
8
0 45
8
2
8
0 169
8
2
8
0 191
8
2
8
0 87
8
2
8
0 63
8
2
8
0 62
8
2
8
1 62
8
0 175
8
2
8
1 175
8
0 194
8
2
8
1 194
8
0 153
8
2
8
1 153
8
0 36
8
2
8
0 10
8
2
8
1 10
8
0 106
8
2
8
1 106
8
0 6
8
2
8
1 6
8
0 73
8...

result:

ok 

Test #21:

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

input:

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

output:

8
0 72
8
2
8
0 87
8
2
8
0 101
8
2
8
0 89
8
2
8
0 79
8
2
8
0 146
8
2
8
0 116
8
2
8
0 100
8
2
8
1 100
8
0 65
8
2
8
0 196
8
2
8
0 33
8
2
8
0 86
8
2
8
0 42
8
2
8
0 49
8
2
8
0 150
8
2
8
1 150
8
0 12
8
2
8
1 12
8
0 179
8
2
8
0 66
8
2
8
0 184
8
2
8
0 174
8
2
8
1 174
8
0 50
8
2
8
1 50
8
0 60
8
2
8
0 173
8
2...

result:

ok 

Test #22:

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

input:

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

output:

8
0 26
8
2
8
0 98
8
2
8
0 157
8
2
8
0 155
8
2
8
0 87
8
2
8
0 88
8
2
8
0 11
8
2
8
1 11
8
0 24
8
2
8
0 35
8
2
8
0 4
8
2
8
0 90
8
2
8
0 6
8
2
8
0 68
8
2
8
0 146
8
2
8
0 48
8
2
8
1 48
8
0 66
8
2
8
0 186
8
2
8
0 151
8
2
8
0 80
8
2
8
0 19
8
2
8
0 110
8
2
8
0 44
8
2
8
0 106
8
2
8
0 67
8
2
8
0 137
8
2
8
1 1...

result:

ok 

Test #23:

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

input:

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

output:

8
0 142
8
2
8
0 29
8
2
8
0 64
8
2
8
0 180
8
2
8
0 145
8
2
8
0 196
8
2
8
0 159
8
2
8
1 159
8
0 42
8
2
8
1 42
8
0 74
8
2
8
0 43
8
2
8
0 171
8
2
8
0 9
8
2
8
0 87
8
2
8
0 18
8
2
8
0 84
8
2
8
0 24
8
2
8
0 47
8
2
8
0 20
8
2
8
0 169
8
2
8
0 21
8
2
8
0 66
8
2
8
0 68
8
2
8
0 76
8
2
8
0 178
8
2
8
0 123
8
2
8
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 155
8
2
8
0 98
8
2
8
1 98
8
0 437
8
2
8
1 437
8
0 880
8
2
8
1 880
8
0 203
8
2
8
1 203
8
0 347
8
2
8
1 347
8
0 294
8
2
8
1 294
8
0 409
8
2
8
1 409
8
0 417
8
2
8
1 417
8
0 825
8
2
8
1 825
8
0 580
8
2
8
1 580
8
0 187
8
2
8
1 187
8
0 335
8
2
8
1 335
8
0 223
8
2
8
1 223
8
0 243
8
2
8
1 243
8
0 974
8
...

result:

ok 

Test #25:

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

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 87
8
2
8
0 789
8
2
8
0 819
8
2
8
0 943
8
2
8
0 334
8
2
8
0 93
8
2
8
0 769
8
2
8
0 274
8
2
8
0 408
8
2
8
0 343
8
2
8
0 519
8
2
8
0 855
8
2
8
0 380
8
2
8
0 978
8
2
8
0 958
8
2
8
0 245
8
2
8
0 323
8
2
8
0 731
8
2
8
0 331
8
2
8
0 790
8
2
8
0 160
8
2
8
0 135
8
2
8
0 520
8
2
8
0 840
8
2
8
0 966
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 760
8
2
8
0 379
8
2
8
0 7
8
2
8
0 981
8
2
8
0 582
8
2
8
0 78
8
2
8
1 78
8
0 374
8
2
8
0 927
8
2
8
0 449
8
2
8
0 241
8
2
8
1 241
8
0 614
8
2
8
1 614
8
0 685
8
2
8
0 545
8
2
8
0 678
8
2
8
0 918
8
2
8
0 472
8
2
8
0 223
8
2
8
1 223
8
0 247
8
2
8
0 624
8
2
8
1 624
8
0 254
8
2
8
0 891
8
2
8
1 891
8
0 ...

result:

ok 

Test #27:

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

input:

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

output:

8
0 207
8
2
8
0 727
8
2
8
0 929
8
2
8
0 658
8
2
8
0 803
8
2
8
0 956
8
2
8
0 764
8
2
8
1 764
8
0 409
8
2
8
0 262
8
2
8
0 105
8
2
8
1 105
8
0 416
8
2
8
1 416
8
0 95
8
2
8
1 95
8
0 111
8
2
8
1 111
8
0 693
8
2
8
1 693
8
0 320
8
2
8
0 42
8
2
8
1 42
8
0 890
8
2
8
1 890
8
0 143
8
2
8
0 649
8
2
8
0 726
8
2
...

result:

ok 

Test #28:

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

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 152
8
2
8
0 227
8
2
8
1 227
8
0 276
8
2
8
1 276
8
0 86
8
2
8
1 86
8
0 768
8
2
8
1 768
8
0 553
8
2
8
1 553
8
0 468
8
2
8
1 468
8
0 257
8
2
8
1 257
8
0 835
8
2
8
1 835
8
0 50
8
2
8
1 50
8
0 555
8
2
8
1 555
8
0 899
8
2
8
1 899
8
0 941
8
2
8
1 941
8
0 283
8
2
8
1 283
8
0 857
8
2
8
1 857
8
0 161
8
2
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 755
8
2
8
0 494
8
2
8
0 711
8
2
8
1 711
8
0 761
8
2
8
1 761
8
0 561
8
2
8
0 801
8
2
8
1 801
8
0 375
8
2
8
1 375
8
0 352
8
2
8
0 8
8
2
8
1 8
8
0 940
8
2
8
0 262
8
2
8
1 262
8
0 735
8
2
8
0 533
8
2
8
1 533
8
0 905
8
2
8
0 496
8
2
8
1 496
8
0 855
8
2
8
0 523
8
2
8
1 523
8
0 739
8
2
8
1 739
8
0 876
...

result:

ok 

Test #30:

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

input:

998
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 935
8
2
8
0 346
8
2
8
1 346
8
0 750
8
2
8
0 221
8
2
8
0 572
8
2
8
1 572
8
0 530
8
2
8
1 530
8
0 512
8
2
8
1 512
8
0 689
8
2
8
1 689
8
0 75
8
2
8
1 75
8
0 381
8
2
8
1 381
8
0 939
8
2
8
0 777
8
2
8
1 777
8
0 579
8
2
8
1 579
8
0 519
8
2
8
1 519
8
0 137
8
2
8
1 137
8
0 32
8
2
8
1 32
8
0 763
8
2
8
1 ...

result:

ok 

Test #31:

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

input:

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

output:

8
0 102
8
2
8
0 84
8
2
8
0 58
8
2
8
0 581
8
2
8
0 602
8
2
8
0 313
8
2
8
0 242
8
2
8
0 776
8
2
8
1 776
8
0 934
8
2
8
0 887
8
2
8
0 888
8
2
8
0 96
8
2
8
0 818
8
2
8
1 818
8
0 621
8
2
8
1 621
8
0 495
8
2
8
1 495
8
0 285
8
2
8
0 530
8
2
8
0 438
8
2
8
1 438
8
0 573
8
2
8
0 606
8
2
8
0 715
8
2
8
1 715
8
0...

result:

ok 

Test #32:

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

input:

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

output:

8
0 72
8
2
8
0 706
8
2
8
0 74
8
2
8
0 630
8
2
8
0 851
8
2
8
1 851
8
0 585
8
2
8
0 455
8
2
8
1 455
8
0 226
8
2
8
1 226
8
0 632
8
2
8
1 632
8
0 596
8
2
8
1 596
8
0 990
8
2
8
1 990
8
0 756
8
2
8
1 756
8
0 757
8
2
8
1 757
8
0 960
8
2
8
1 960
8
0 789
8
2
8
1 789
8
0 457
8
2
8
1 457
8
0 409
8
2
8
1 409
8
...

result:

ok 

Test #33:

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

input:

996
1
1
1
1
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 184
8
2
8
0 459
8
2
8
0 645
8
2
8
0 57
8
2
8
0 684
8
2
8
1 684
8
0 259
8
2
8
1 259
8
0 878
8
2
8
1 878
8
0 19
8
2
8
1 19
8
0 930
8
2
8
0 270
8
2
8
1 270
8
0 158
8
2
8
1 158
8
0 357
8
2
8
0 282
8
2
8
1 282
8
0 961
8
2
8
0 412
8
2
8
1 412
8
0 358
8
2
8
1 358
8
0 203
8
2
8
1 203
8
0 44
...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
1
1
2
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 743
8
2
8
0 465
8
2
8
0 660
8
2
8
0 139
8
2
8
0 772
8
2
8
0 544
8
2
8
0 668
8
2
8
1 668
8
0 770
8
2
8
0 344
8
2
8
1 344
8
0 253
8
2
8
1 253
8
0 779
8
2
8
0 497
8
2
8
1 497
8
0 479
8
2
8
1 479
8
0 429
8
2
8
1 429
8
0 329
8
2
8
1 329
8
0 623
8
2
8
0 807
8
2
8
1 807
8
0 942
8
2
8
1 942
8
0 784
8
2
...

result:

ok 

Test #35:

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

input:

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

output:

8
0 678
8
2
8
0 528
8
2
8
0 658
8
2
8
0 772
8
2
8
1 772
8
0 819
8
2
8
1 819
8
0 414
8
2
8
0 91
8
2
8
0 960
8
2
8
0 642
8
2
8
0 82
8
2
8
1 82
8
0 660
8
2
8
0 663
8
2
8
0 428
8
2
8
0 497
8
2
8
1 497
8
0 116
8
2
8
1 116
8
0 737
8
2
8
1 737
8
0 607
8
2
8
1 607
8
0 636
8
2
8
1 636
8
0 115
8
2
8
1 115
8
0...

result:

ok 

Test #36:

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

input:

997
1
1
1
1
1
1
2
1
1
1
2
1
2
2
2
2
1
2
1
2
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 158
8
2
8
0 130
8
2
8
0 238
8
2
8
0 338
8
2
8
0 116
8
2
8
0 308
8
2
8
0 726
8
2
8
1 726
8
0 381
8
2
8
0 261
8
2
8
0 543
8
2
8
0 486
8
2
8
1 486
8
0 257
8
2
8
0 262
8
2
8
1 262
8
0 194
8
2
8
1 194
8
0 186
8
2
8
1 186
8
0 535
8
2
8
1 535
8
0 442
8
2
8
0 9
8
2
8
1 9
8
0 971
8
2
8
0 456
8
2
8
1 456
...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
2
1
1
1
2
1
1
1
2
2
1
2
2
2
2
2
1
2
2
2
1
2
1
2
2
1
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 780
8
2
8
0 154
8
2
8
0 79
8
2
8
0 679
8
2
8
0 180
8
2
8
1 180
8
0 457
8
2
8
0 653
8
2
8
0 570
8
2
8
0 602
8
2
8
1 602
8
0 426
8
2
8
0 431
8
2
8
0 929
8
2
8
0 146
8
2
8
1 146
8
0 876
8
2
8
1 876
8
0 686
8
2
8
0 838
8
2
8
1 838
8
0 249
8
2
8
1 249
8
0 32
8
2
8
1 32
8
0 523
8
2
8
1 523
8
0 583
8
2...

result:

ok 

Test #38:

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

input:

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

output:

8
0 991
8
2
8
0 575
8
2
8
0 391
8
2
8
0 494
8
2
8
0 865
8
2
8
0 150
8
2
8
0 765
8
2
8
1 765
8
0 141
8
2
8
0 92
8
2
8
1 92
8
0 718
8
2
8
0 398
8
2
8
0 683
8
2
8
0 88
8
2
8
0 298
8
2
8
0 562
8
2
8
0 299
8
2
8
0 453
8
2
8
1 453
8
0 866
8
2
8
0 769
8
2
8
0 128
8
2
8
0 209
8
2
8
0 960
8
2
8
0 439
8
2
8
0...

result:

ok 

Test #39:

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

input:

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

output:

8
0 832
8
2
8
0 289
8
2
8
0 589
8
2
8
0 412
8
2
8
0 70
8
2
8
0 251
8
2
8
0 877
8
2
8
0 5
8
2
8
1 5
8
0 184
8
2
8
0 338
8
2
8
0 493
8
2
8
0 482
8
2
8
0 121
8
2
8
0 693
8
2
8
0 341
8
2
8
0 398
8
2
8
0 908
8
2
8
0 198
8
2
8
0 759
8
2
8
0 653
8
2
8
0 290
8
2
8
0 949
8
2
8
0 271
8
2
8
0 798
8
2
8
0 382
8...

result:

ok 

Test #40:

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

input:

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

output:

8
0 191
8
2
8
0 175
8
2
8
0 782
8
2
8
0 733
8
2
8
0 450
8
2
8
0 475
8
2
8
0 756
8
2
8
0 843
8
2
8
0 592
8
2
8
0 383
8
2
8
0 89
8
2
8
1 89
8
0 405
8
2
8
0 19
8
2
8
0 771
8
2
8
0 591
8
2
8
0 670
8
2
8
0 494
8
2
8
0 99
8
2
8
1 99
8
0 924
8
2
8
0 533
8
2
8
0 126
8
2
8
0 726
8
2
8
0 701
8
2
8
0 792
8
2
8...

result:

ok 

Test #41:

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

input:

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

output:

8
0 718
8
2
8
0 813
8
2
8
0 66
8
2
8
0 913
8
2
8
0 713
8
2
8
0 247
8
2
8
0 408
8
2
8
0 438
8
2
8
0 933
8
2
8
0 701
8
2
8
0 391
8
2
8
0 985
8
2
8
0 378
8
2
8
0 846
8
2
8
0 674
8
2
8
0 634
8
2
8
0 52
8
2
8
0 283
8
2
8
1 283
8
0 626
8
2
8
0 132
8
2
8
0 657
8
2
8
0 964
8
2
8
0 34
8
2
8
0 921
8
2
8
0 144...

result:

ok 

Test #42:

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

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

output:

8
0 49
8
2
8
0 634
8
2
8
0 165
8
2
8
0 63
8
2
8
0 150
8
2
8
0 533
8
2
8
0 964
8
2
8
0 774
8
2
8
0 314
8
2
8
0 452
8
2
8
0 968
8
2
8
0 670
8
2
8
0 762
8
2
8
0 212
8
2
8
0 805
8
2
8
0 9
8
2
8
0 364
8
2
8
0 514
8
2
8
0 245
8
2
8
0 855
8
2
8
0 430
8
2
8
0 285
8
2
8
0 534
8
2
8
0 460
8
2
8
0 142
8
2
8
0 ...

result:

ok 

Subtask #3:

score: 70.82
Acceptable Answer

Test #43:

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

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

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

input:

3
1
2
1

output:

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

result:

ok 

Test #46:

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

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

result:

ok 

Test #47:

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

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

result:

ok 

Test #48:

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

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 1131
8
2
8
0 1140
8
2
8
1 1140
8
0 560
8
2
8
1 560
8
0 1630
8
2
8
1 1630
8
0 1385
8
2
8
1 1385
8
0 1837
8
2
8
1 1837
8
0 1514
8
2
8
1 1514
8
0 675
8
2
8
1 675
8
0 863
8
2
8
1 863
8
0 1270
8
2
8
1 1270
8
0 1879
8
2
8
1 1879
8
0 1250
8
2
8
1 1250
8
0 1910
8
2
8
1 1910
8
0 1438
8
2
8
1 1438
8
0 391...

result:

ok 

Test #49:

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

input:

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

output:

8
0 8
8
2
8
0 1226
8
2
8
0 778
8
2
8
0 1714
8
2
8
0 1976
8
2
8
0 577
8
2
8
0 961
8
2
8
0 528
8
2
8
0 1866
8
2
8
0 352
8
2
8
0 1351
8
2
8
0 655
8
2
8
0 665
8
2
8
0 1964
8
2
8
0 1061
8
2
8
0 1690
8
2
8
0 1148
8
2
8
0 1540
8
2
8
0 1833
8
2
8
0 1185
8
2
8
0 1961
8
2
8
0 1425
8
2
8
0 232
8
2
8
0 1485
8
2...

result:

ok 

Test #50:

score: 74.75
Acceptable Answer
time: 36ms
memory: 3724kb

input:

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

output:

8
0 212
8
2
8
0 1856
8
2
8
0 555
8
2
8
0 1781
8
2
8
0 1743
8
2
8
0 879
8
2
8
0 1252
8
2
8
0 1568
8
2
8
0 1779
8
2
8
1 1779
8
0 1033
8
2
8
0 510
8
2
8
0 711
8
2
8
0 1399
8
2
8
0 22
8
2
8
0 427
8
2
8
1 427
8
0 698
8
2
8
0 1327
8
2
8
0 35
8
2
8
0 1044
8
2
8
0 1588
8
2
8
1 1588
8
0 1863
8
2
8
0 1680
8
2...

result:

points 0.99666666670 points  0.99666666670

Test #51:

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

input:

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

output:

8
0 54
8
2
8
0 951
8
2
8
0 846
8
2
8
0 713
8
2
8
0 602
8
2
8
0 1909
8
2
8
0 615
8
2
8
0 518
8
2
8
0 993
8
2
8
1 993
8
0 1226
8
2
8
0 368
8
2
8
0 1889
8
2
8
1 1889
8
0 284
8
2
8
0 359
8
2
8
0 1229
8
2
8
0 145
8
2
8
0 1757
8
2
8
0 1124
8
2
8
1 1124
8
0 417
8
2
8
0 851
8
2
8
0 1176
8
2
8
1 1176
8
0 102...

result:

ok 

Test #52:

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

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 1986
8
2
8
0 1414
8
2
8
1 1414
8
0 1081
8
2
8
1 1081
8
0 1735
8
2
8
1 1735
8
0 1255
8
2
8
1 1255
8
0 713
8
2
8
1 713
8
0 1898
8
2
8
1 1898
8
0 762
8
2
8
1 762
8
0 527
8
2
8
1 527
8
0 1502
8
2
8
1 1502
8
0 1174
8
2
8
1 1174
8
0 301
8
2
8
1 301
8
0 618
8
2
8
1 618
8
0 1670
8
2
8
1 1670
8
0 965
8
2...

result:

ok 

Test #53:

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

input:

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

output:

8
0 820
8
2
8
0 1020
8
2
8
1 1020
8
0 1753
8
2
8
1 1753
8
0 465
8
2
8
0 1754
8
2
8
0 1518
8
2
8
1 1518
8
0 131
8
2
8
1 131
8
0 1229
8
2
8
0 1
8
2
8
0 1270
8
2
8
1 1270
8
0 576
8
2
8
0 130
8
2
8
1 130
8
0 364
8
2
8
0 300
8
2
8
0 1423
8
2
8
1 1423
8
0 325
8
2
8
0 1577
8
2
8
1 1577
8
0 1052
8
2
8
0 117...

result:

ok 

Test #54:

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

input:

2000
1
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1249
8
2
8
0 49
8
2
8
0 1573
8
2
8
1 1573
8
0 1556
8
2
8
0 1859
8
2
8
1 1859
8
0 1729
8
2
8
1 1729
8
0 1763
8
2
8
1 1763
8
0 1023
8
2
8
1 1023
8
0 1702
8
2
8
1 1702
8
0 828
8
2
8
1 828
8
0 960
8
2
8
1 960
8
0 671
8
2
8
0 1709
8
2
8
1 1709
8
0 1471
8
2
8
1 1471
8
0 1355
8
2
8
1 1355
8
0 814
8
2
8...

result:

ok 

Test #55:

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

input:

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

output:

8
0 1558
8
2
8
0 1083
8
2
8
0 1582
8
2
8
0 787
8
2
8
0 1626
8
2
8
0 1353
8
2
8
0 1045
8
2
8
1 1045
8
0 962
8
2
8
0 934
8
2
8
0 503
8
2
8
0 263
8
2
8
0 1286
8
2
8
0 183
8
2
8
0 36
8
2
8
0 218
8
2
8
0 1738
8
2
8
0 518
8
2
8
1 518
8
0 1630
8
2
8
1 1630
8
0 189
8
2
8
1 189
8
0 1576
8
2
8
1 1576
8
0 871
...

result:

ok 

Test #56:

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

input:

1998
1
2
2
1
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1990
8
2
8
0 1189
8
2
8
1 1189
8
0 143
8
2
8
1 143
8
0 1293
8
2
8
0 808
8
2
8
0 1289
8
2
8
1 1289
8
0 1044
8
2
8
1 1044
8
0 1640
8
2
8
1 1640
8
0 1266
8
2
8
1 1266
8
0 148
8
2
8
1 148
8
0 1445
8
2
8
0 618
8
2
8
1 618
8
0 1866
8
2
8
1 1866
8
0 1073
8
2
8
0 1355
8
2
8
1 1355
8
0 1673
8
2
8
1 1673
...

result:

ok 

Test #57:

score: 74.97
Acceptable Answer
time: 47ms
memory: 3880kb

input:

1999
1
1
2
1
1
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 923
8
2
8
0 1500
8
2
8
0 89
8
2
8
1 89
8
0 811
8
2
8
0 1507
8
2
8
0 100
8
2
8
0 1331
8
2
8
0 1261
8
2
8
1 1261
8
0 1745
8
2
8
1 1745
8
0 545
8
2
8
1 545
8
0 360
8
2
8
1 360
8
0 1637
8
2
8
1 1637
8
0 1651
8
2
8
1 1651
8
0 499
8
2
8
1 499
8
0 496
8
2
8
0 1670
8
2
8
1 1670
8
0 1163
8
2
8
1 1163
8
0...

result:

points 0.99960 points  0.99960

Test #58:

score: 74.97
Acceptable Answer
time: 37ms
memory: 3888kb

input:

1997
1
1
1
1
2
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 539
8
2
8
0 1034
8
2
8
0 1282
8
2
8
0 1290
8
2
8
0 264
8
2
8
1 264
8
0 1032
8
2
8
0 56
8
2
8
1 56
8
0 935
8
2
8
1 935
8
0 691
8
2
8
0 25
8
2
8
1 25
8
0 186
8
2
8
1 186
8
0 1002
8
2
8
1 1002
8
0 1209
8
2
8
1 1209
8
0 84
8
2
8
0 797
8
2
8
1 797
8
0 182
8
2
8
1 182
8
0 32
8
2
8
0 1749
8
2
8
1 1749
...

result:

points 0.99960 points  0.99960

Test #59:

score: 74.99
Acceptable Answer
time: 35ms
memory: 3836kb

input:

1998
1
1
2
1
2
1
1
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 431
8
2
8
0 136
8
2
8
0 1003
8
2
8
1 1003
8
0 1165
8
2
8
0 397
8
2
8
1 397
8
0 1192
8
2
8
0 452
8
2
8
0 1370
8
2
8
1 1370
8
0 760
8
2
8
1 760
8
0 1695
8
2
8
1 1695
8
0 1672
8
2
8
1 1672
8
0 1240
8
2
8
0 1077
8
2
8
1 1077
8
0 823
8
2
8
1 823
8
0 1123
8
2
8
0 1719
8
2
8
1 1719
8
0 1011
8
2
8
1 101...

result:

points 0.99986666670 points  0.99986666670

Test #60:

score: 74.9
Acceptable Answer
time: 25ms
memory: 3840kb

input:

1996
1
2
1
1
1
1
1
2
2
1
2
1
2
2
2
2
2
2
2
1
2
2
1
2
2
2
1
2
2
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1175
8
2
8
0 1815
8
2
8
1 1815
8
0 1234
8
2
8
0 1070
8
2
8
0 1459
8
2
8
0 254
8
2
8
0 837
8
2
8
0 669
8
2
8
1 669
8
0 1478
8
2
8
1 1478
8
0 212
8
2
8
0 761
8
2
8
1 761
8
0 588
8
2
8
0 1423
8
2
8
1 1423
8
0 156
8
2
8
1 156
8
0 1730
8
2
8
1 1730
8
0 165
8
2
8
1 165
8
0 1360
8
2
8
1 1360
8
0 1653
8...

result:

points 0.99866666670 points  0.99866666670

Test #61:

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

input:

2000
1
1
2
2
1
1
2
1
2
1
1
1
2
1
2
2
1
2
1
2
1
1
1
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
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1875
8
2
8
0 61
8
2
8
0 674
8
2
8
1 674
8
0 499
8
2
8
1 499
8
0 1810
8
2
8
0 1879
8
2
8
0 1163
8
2
8
1 1163
8
0 1762
8
2
8
0 1473
8
2
8
1 1473
8
0 21
8
2
8
0 1717
8
2
8
0 1823
8
2
8
0 1464
8
2
8
1 1464
8
0 670
8
2
8
0 1093
8
2
8
1 1093
8
0 979
8
2
8
1 979
8
0 388
8
2
8
0 1339
8
2
8
1 1339
8
0 10...

result:

ok 

Test #62:

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

input:

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

output:

8
0 1868
8
2
8
0 1898
8
2
8
0 588
8
2
8
0 653
8
2
8
0 1610
8
2
8
1 1610
8
0 1685
8
2
8
0 690
8
2
8
0 232
8
2
8
0 418
8
2
8
0 437
8
2
8
0 452
8
2
8
0 900
8
2
8
0 867
8
2
8
0 1323
8
2
8
0 1441
8
2
8
0 984
8
2
8
0 577
8
2
8
1 577
8
0 1747
8
2
8
0 767
8
2
8
0 1055
8
2
8
0 506
8
2
8
1 506
8
0 1949
8
2
8
...

result:

ok 

Test #63:

score: 70.82
Acceptable Answer
time: 68ms
memory: 3860kb

input:

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

output:

8
0 1486
8
2
8
0 1169
8
2
8
0 380
8
2
8
0 1517
8
2
8
0 1679
8
2
8
0 1912
8
2
8
0 416
8
2
8
0 166
8
2
8
0 1208
8
2
8
0 294
8
2
8
1 294
8
0 1177
8
2
8
0 1436
8
2
8
1 1436
8
0 1540
8
2
8
0 1732
8
2
8
0 432
8
2
8
0 735
8
2
8
0 671
8
2
8
1 671
8
0 576
8
2
8
0 764
8
2
8
0 1381
8
2
8
1 1381
8
0 253
8
2
8
1...

result:

points 0.94426666670 points  0.94426666670

Test #64:

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

input:

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

output:

8
0 861
8
2
8
0 1020
8
2
8
0 1219
8
2
8
0 850
8
2
8
0 354
8
2
8
0 8
8
2
8
0 961
8
2
8
0 1898
8
2
8
0 926
8
2
8
0 148
8
2
8
0 891
8
2
8
0 1207
8
2
8
0 810
8
2
8
0 1947
8
2
8
0 844
8
2
8
0 554
8
2
8
0 1518
8
2
8
0 704
8
2
8
0 162
8
2
8
0 1959
8
2
8
1 1959
8
0 1752
8
2
8
0 652
8
2
8
0 1848
8
2
8
0 1480...

result:

ok 

Test #65:

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

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

output:

8
0 320
8
2
8
0 431
8
2
8
0 1738
8
2
8
0 801
8
2
8
0 1909
8
2
8
0 92
8
2
8
0 169
8
2
8
0 490
8
2
8
0 1515
8
2
8
0 1102
8
2
8
0 1057
8
2
8
0 81
8
2
8
0 96
8
2
8
0 621
8
2
8
0 599
8
2
8
0 1897
8
2
8
0 1722
8
2
8
0 839
8
2
8
0 1098
8
2
8
0 1812
8
2
8
0 1373
8
2
8
0 603
8
2
8
0 1249
8
2
8
0 934
8
2
8
0 ...

result:

ok 

Test #66:

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

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

output:

8
0 494
8
2
8
0 1057
8
2
8
0 815
8
2
8
0 1321
8
2
8
0 1095
8
2
8
0 1190
8
2
8
0 1209
8
2
8
0 1503
8
2
8
0 60
8
2
8
0 53
8
2
8
0 1197
8
2
8
0 420
8
2
8
0 1728
8
2
8
0 571
8
2
8
0 777
8
2
8
0 606
8
2
8
0 1203
8
2
8
0 593
8
2
8
0 20
8
2
8
0 129
8
2
8
0 805
8
2
8
0 1098
8
2
8
0 1028
8
2
8
0 162
8
2
8
0 ...

result:

ok 

Test #67:

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

input:

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

output:

8
0 1659
8
2
8
0 1406
8
2
8
0 1995
8
2
8
0 1353
8
2
8
0 507
8
2
8
0 1642
8
2
8
0 1309
8
2
8
0 911
8
2
8
0 237
8
2
8
0 1994
8
2
8
0 1402
8
2
8
0 1633
8
2
8
0 1056
8
2
8
0 316
8
2
8
0 1809
8
2
8
0 925
8
2
8
0 1122
8
2
8
0 1107
8
2
8
0 908
8
2
8
0 1520
8
2
8
0 1920
8
2
8
0 955
8
2
8
0 1608
8
2
8
0 214
...

result:

ok 

Test #68:

score: 74.88
Acceptable Answer
time: 45ms
memory: 3744kb

input:

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

output:

8
0 268
8
2
8
0 1967
8
2
8
0 1529
8
2
8
0 414
8
2
8
0 623
8
2
8
0 1711
8
2
8
0 836
8
2
8
0 252
8
2
8
0 324
8
2
8
0 1262
8
2
8
0 354
8
2
8
1 354
8
0 935
8
2
8
0 275
8
2
8
0 194
8
2
8
0 1752
8
2
8
0 1389
8
2
8
1 1389
8
0 280
8
2
8
0 374
8
2
8
0 296
8
2
8
1 296
8
0 1898
8
2
8
1 1898
8
0 1193
8
2
8
0 11...

result:

points 0.99840 points  0.99840

Test #69:

score: 74.88
Acceptable Answer
time: 44ms
memory: 3872kb

input:

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

output:

8
0 652
8
2
8
0 143
8
2
8
0 887
8
2
8
0 1879
8
2
8
0 1468
8
2
8
0 1909
8
2
8
0 1233
8
2
8
0 27
8
2
8
0 631
8
2
8
0 886
8
2
8
0 1444
8
2
8
0 1354
8
2
8
0 1547
8
2
8
0 512
8
2
8
0 542
8
2
8
0 500
8
2
8
1 500
8
0 38
8
2
8
0 1850
8
2
8
1 1850
8
0 266
8
2
8
0 896
8
2
8
1 896
8
0 161
8
2
8
0 1322
8
2
8
0 ...

result:

points 0.99840 points  0.99840

Test #70:

score: 74.51
Acceptable Answer
time: 64ms
memory: 3792kb

input:

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

output:

8
0 34
8
2
8
0 1852
8
2
8
0 689
8
2
8
0 568
8
2
8
0 1201
8
2
8
0 1139
8
2
8
0 44
8
2
8
0 232
8
2
8
0 1027
8
2
8
1 1027
8
0 222
8
2
8
0 1681
8
2
8
0 351
8
2
8
0 263
8
2
8
0 178
8
2
8
0 868
8
2
8
0 1564
8
2
8
1 1564
8
0 504
8
2
8
0 1702
8
2
8
0 733
8
2
8
1 733
8
0 621
8
2
8
1 621
8
0 253
8
2
8
0 1654
...

result:

points 0.99346666670 points  0.99346666670

Test #71:

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

input:

1979
1
1
1
2
1
1
1
1
1
1
2
2
2
2
1
2
1
1
2
1
1
1
2
2
1
2
2
1
2
1
2
2
1
1
2
1
2
1
2
2
1
2
2
2
2
2
2
1
1
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
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 560
8
2
8
0 1215
8
2
8
0 260
8
2
8
0 96
8
2
8
1 96
8
0 636
8
2
8
0 1603
8
2
8
0 1644
8
2
8
0 1434
8
2
8
0 1456
8
2
8
0 797
8
2
8
0 397
8
2
8
1 397
8
0 1304
8
2
8
1 1304
8
0 1768
8
2
8
1 1768
8
0 27
8
2
8
1 27
8
0 1820
8
2
8
0 1912
8
2
8
1 1912
8
0 1415
8
2
8
0 1606
8
2
8
0 513
8
2
8
1 513
8
0 15...

result:

points 0.99386666670 points  0.99386666670

Test #72:

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

input:

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

output:

8
0 805
8
2
8
0 327
8
2
8
0 1014
8
2
8
0 581
8
2
8
0 450
8
2
8
0 475
8
2
8
0 88
8
2
8
0 530
8
2
8
0 508
8
2
8
0 1228
8
2
8
0 1140
8
2
8
0 1538
8
2
8
0 552
8
2
8
0 1576
8
2
8
0 812
8
2
8
0 1514
8
2
8
0 1684
8
2
8
1 1684
8
0 1532
8
2
8
0 1460
8
2
8
0 325
8
2
8
0 926
8
2
8
0 1456
8
2
8
0 1229
8
2
8
0 1...

result:

ok 

Test #73:

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

input:

1981
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
2
1
1
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
1
1
2
1
2
1
1
2
2
2
2
2
2
1
1
2
1
1
2
2
2
1
1
1
1
1
1
2
2
1
2
1
2
2
1
2
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
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 1726
8
2
8
0 305
8
2
8
0 1644
8
2
8
0 1929
8
2
8
0 131
8
2
8
0 1028
8
2
8
0 122
8
2
8
0 1070
8
2
8
0 1570
8
2
8
0 491
8
2
8
0 52
8
2
8
0 1230
8
2
8
0 410
8
2
8
0 1330
8
2
8
0 1652
8
2
8
0 993
8
2
8
0 1021
8
2
8
0 737
8
2
8
1 737
8
0 1184
8
2
8
1 1184
8
0 1861
8
2
8
0 1342
8
2
8
0 1354
8
2
8
1 13...

result:

ok 

Test #74:

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

input:

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

output:

8
0 712
8
2
8
0 1756
8
2
8
1 1756
8
0 1673
8
2
8
0 808
8
2
8
0 457
8
2
8
0 1599
8
2
8
0 306
8
2
8
0 407
8
2
8
0 10
8
2
8
0 1831
8
2
8
1 1831
8
0 970
8
2
8
0 1679
8
2
8
0 631
8
2
8
0 51
8
2
8
1 51
8
0 580
8
2
8
0 333
8
2
8
0 519
8
2
8
1 519
8
0 281
8
2
8
1 281
8
0 1359
8
2
8
0 1541
8
2
8
0 426
8
2
8
...

result:

ok 

Test #75:

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

input:

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

output:

8
0 688
8
2
8
0 1259
8
2
8
0 1278
8
2
8
0 369
8
2
8
0 1813
8
2
8
0 1786
8
2
8
0 628
8
2
8
0 1029
8
2
8
0 697
8
2
8
0 495
8
2
8
0 1119
8
2
8
0 869
8
2
8
0 387
8
2
8
0 870
8
2
8
0 1956
8
2
8
0 346
8
2
8
0 294
8
2
8
0 1442
8
2
8
0 1128
8
2
8
0 464
8
2
8
0 911
8
2
8
1 911
8
0 765
8
2
8
0 157
8
2
8
0 343...

result:

ok 

Test #76:

score: 74.41
Acceptable Answer
time: 33ms
memory: 3872kb

input:

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

output:

8
0 1833
8
2
8
0 1597
8
2
8
0 725
8
2
8
0 569
8
2
8
0 163
8
2
8
0 64
8
2
8
0 118
8
2
8
0 1013
8
2
8
0 1574
8
2
8
0 385
8
2
8
0 544
8
2
8
0 1165
8
2
8
0 1420
8
2
8
0 173
8
2
8
0 802
8
2
8
1 802
8
0 1465
8
2
8
0 1432
8
2
8
1 1432
8
0 408
8
2
8
1 408
8
0 856
8
2
8
1 856
8
0 469
8
2
8
0 439
8
2
8
1 439
...

result:

points 0.99213333330 points  0.99213333330

Test #77:

score: 74.18
Acceptable Answer
time: 40ms
memory: 3860kb

input:

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

output:

8
0 1201
8
2
8
0 1026
8
2
8
0 1448
8
2
8
0 1885
8
2
8
0 538
8
2
8
0 176
8
2
8
0 1777
8
2
8
0 677
8
2
8
0 128
8
2
8
0 1809
8
2
8
1 1809
8
0 261
8
2
8
1 261
8
0 475
8
2
8
0 213
8
2
8
0 705
8
2
8
0 730
8
2
8
0 316
8
2
8
1 316
8
0 1535
8
2
8
0 1533
8
2
8
0 557
8
2
8
0 644
8
2
8
1 644
8
0 1094
8
2
8
0 11...

result:

points 0.98906666670 points  0.98906666670

Test #78:

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

input:

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

output:

8
0 1239
8
2
8
0 1310
8
2
8
0 1694
8
2
8
0 999
8
2
8
0 1236
8
2
8
0 157
8
2
8
0 120
8
2
8
0 446
8
2
8
0 911
8
2
8
0 476
8
2
8
0 1192
8
2
8
1 1192
8
0 627
8
2
8
0 1574
8
2
8
0 1537
8
2
8
0 965
8
2
8
0 1526
8
2
8
0 1114
8
2
8
0 52
8
2
8
1 52
8
0 1966
8
2
8
0 434
8
2
8
1 434
8
0 198
8
2
8
1 198
8
0 224...

result:

ok 

Test #79:

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

input:

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

output:

8
0 1644
8
2
8
0 1935
8
2
8
0 826
8
2
8
0 710
8
2
8
0 1719
8
2
8
0 1824
8
2
8
0 1111
8
2
8
0 206
8
2
8
0 1031
8
2
8
0 341
8
2
8
0 384
8
2
8
0 1420
8
2
8
0 1649
8
2
8
0 890
8
2
8
0 976
8
2
8
0 701
8
2
8
0 409
8
2
8
0 1629
8
2
8
0 882
8
2
8
1 882
8
0 200
8
2
8
0 1726
8
2
8
0 1485
8
2
8
0 278
8
2
8
0 1...

result:

ok 

Test #80:

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

input:

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

output:

8
0 1340
8
2
8
0 1585
8
2
8
0 1930
8
2
8
0 1305
8
2
8
0 608
8
2
8
0 1009
8
2
8
0 1633
8
2
8
0 761
8
2
8
0 1409
8
2
8
0 416
8
2
8
0 290
8
2
8
0 1578
8
2
8
0 518
8
2
8
0 1542
8
2
8
0 535
8
2
8
0 754
8
2
8
0 1813
8
2
8
1 1813
8
0 1992
8
2
8
0 454
8
2
8
0 1851
8
2
8
0 1420
8
2
8
0 759
8
2
8
1 759
8
0 65...

result:

ok 

Test #81:

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

input:

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

output:

8
0 131
8
2
8
0 172
8
2
8
0 1868
8
2
8
0 1118
8
2
8
0 1909
8
2
8
0 1221
8
2
8
0 1040
8
2
8
0 1389
8
2
8
0 1999
8
2
8
0 1888
8
2
8
0 497
8
2
8
0 944
8
2
8
0 875
8
2
8
0 1231
8
2
8
0 911
8
2
8
0 1666
8
2
8
0 264
8
2
8
0 160
8
2
8
0 633
8
2
8
0 1962
8
2
8
0 1054
8
2
8
0 947
8
2
8
0 48
8
2
8
1 48
8
0 15...

result:

ok 

Test #82:

score: 74.2
Acceptable Answer
time: 22ms
memory: 3728kb

input:

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

output:

8
0 1559
8
2
8
0 774
8
2
8
0 991
8
2
8
0 1511
8
2
8
0 54
8
2
8
0 1848
8
2
8
0 962
8
2
8
0 181
8
2
8
0 980
8
2
8
0 1742
8
2
8
0 1077
8
2
8
0 483
8
2
8
0 1831
8
2
8
0 1933
8
2
8
1 1933
8
0 1784
8
2
8
0 543
8
2
8
1 543
8
0 421
8
2
8
1 421
8
0 1628
8
2
8
0 864
8
2
8
0 1125
8
2
8
0 1850
8
2
8
1 1850
8
0 ...

result:

points 0.98933333330 points  0.98933333330

Test #83:

score: 74.2
Acceptable Answer
time: 62ms
memory: 3784kb

input:

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

output:

8
0 88
8
2
8
0 185
8
2
8
0 828
8
2
8
0 420
8
2
8
0 18
8
2
8
0 1697
8
2
8
0 447
8
2
8
0 791
8
2
8
0 579
8
2
8
0 60
8
2
8
0 1096
8
2
8
0 1574
8
2
8
0 1610
8
2
8
0 301
8
2
8
1 301
8
0 805
8
2
8
0 1108
8
2
8
0 1736
8
2
8
0 436
8
2
8
1 436
8
0 1120
8
2
8
1 1120
8
0 1706
8
2
8
0 758
8
2
8
0 1038
8
2
8
1 1...

result:

points 0.98933333330 points  0.98933333330

Test #84:

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

input:

540
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 400
8
2
8
1 400
8
0 205
8
2
8
1 205
8
0 402
8
2
8
1 402
8
0 204
8
2
8
1 204
8
0 103
8
2
8
1 103
8
0 64
8
2
8
1 64
8
0 522
8
2
8
1 522
8
0 187
8
2
8
1 187
8
0 5
8
2
8
1 5
8
0 87
8
2
8
0 307
8
2
8
1 307
8
0 152
8
2
8
1 152
8
0 272
8
2
8
1 272
8
0 122
8
2
8
1 122
8
0 79
8
2
8
1 79
8
0 2...

result:

ok 

Test #85:

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

input:

1834
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1510
8
2
8
0 58
8
2
8
0 265
8
2
8
1 265
8
0 1468
8
2
8
1 1468
8
0 1792
8
2
8
1 1792
8
0 609
8
2
8
1 609
8
0 1459
8
2
8
1 1459
8
0 1310
8
2
8
1 1310
8
0 833
8
2
8
1 833
8
0 135
8
2
8
1 135
8
0 822
8
2
8
1 822
8
0 206
8
2
8
1 206
8
0 1059
8
2
8
1 1059
8
0 1004
8
2
8
1 1004
8
0 538
8
2
8
1 538
8
0 ...

result:

ok 

Test #86:

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

input:

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

output:

8
0 1251
8
2
8
0 1713
8
2
8
1 1713
8
0 373
8
2
8
1 373
8
0 375
8
2
8
0 1902
8
2
8
1 1902
8
0 332
8
2
8
1 332
8
0 1365
8
2
8
1 1365
8
0 973
8
2
8
1 973
8
0 920
8
2
8
1 920
8
0 1975
8
2
8
1 1975
8
0 1112
8
2
8
1 1112
8
0 616
8
2
8
1 616
8
0 1880
8
2
8
1 1880
8
0 1908
8
2
8
1 1908
8
0 26
8
2
8
1 26
8
0...

result:

ok 

Test #87:

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

input:

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

output:

8
0 100
8
2
8
0 1127
8
2
8
0 1057
8
2
8
0 487
8
2
8
1 487
8
0 1956
8
2
8
0 1700
8
2
8
0 455
8
2
8
1 455
8
0 213
8
2
8
1 213
8
0 192
8
2
8
1 192
8
0 1082
8
2
8
0 1163
8
2
8
0 223
8
2
8
1 223
8
0 1621
8
2
8
0 596
8
2
8
1 596
8
0 1735
8
2
8
0 1290
8
2
8
0 1008
8
2
8
0 1186
8
2
8
0 743
8
2
8
1 743
8
0 1...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1719
8
2
8
0 150
8
2
8
0 1990
8
2
8
1 1990
8
0 575
8
2
8
0 1301
8
2
8
1 1301
8
0 1755
8
2
8
1 1755
8
0 365
8
2
8
0 1469
8
2
8
1 1469
8
0 1561
8
2
8
1 1561
8
0 1382
8
2
8
1 1382
8
0 708
8
2
8
0 1452
8
2
8
1 1452
8
0 138
8
2
8
0 832
8
2
8
0 1443
8
2
8
1 1443
8
0 930
8
2
8
0 1772
8
2
8
1 1772
8
0 1...

result:

ok 

Test #89:

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

input:

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

output:

8
0 1752
8
2
8
0 101
8
2
8
1 101
8
0 995
8
2
8
0 9
8
2
8
1 9
8
0 122
8
2
8
1 122
8
0 513
8
2
8
0 1021
8
2
8
0 1478
8
2
8
0 760
8
2
8
0 598
8
2
8
0 581
8
2
8
0 729
8
2
8
0 1385
8
2
8
0 1136
8
2
8
0 1586
8
2
8
1 1586
8
0 290
8
2
8
1 290
8
0 349
8
2
8
1 349
8
0 1022
8
2
8
0 1872
8
2
8
1 1872
8
0 354
8
...

result:

ok