QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#45957#4565. Rarest InsectsZhangYiDe99.2 87ms3900kbC++175.7kb2022-08-24 18:45:552022-08-24 18:48:48

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

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

output:

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

result:

ok 

Test #2:

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

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

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

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

input:

5
1
2
1
2
2
1
2
2
1
2

output:

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

result:

ok 

Test #6:

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

input:

8
1
1
2
2
2
2
2
1
1

output:

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

result:

ok 

Test #7:

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

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 9
8
2
8
0 42
8
2
8
1 42
8
0 101
8
2
8
1 101
8
0 129
8
2
8
1 129
8
0 70
8
2
8
1 70
8
0 91
8
2
8
1 91
8
0 74
8
2
8
1 74
8
0 172
8
2
8
1 172
8
0 136
8
2
8
1 136
8
0 140
8
2
8
1 140
8
0 135
8
2
8
1 135
8
0 76
8
2
8
1 76
8
0 106
8
2
8
1 106
8
0 149
8
2
8
1 149
8
0 103
8
2
8
1 103
8
0 143
8
2
8
1 143
...

result:

ok 

Test #8:

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

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 178
8
2
8
0 193
8
2
8
0 97
8
2
8
0 125
8
2
8
0 114
8
2
8
0 35
8
2
8
0 60
8
2
8
0 195
8
2
8
0 23
8
2
8
0 122
8
2
8
0 163
8
2
8
0 49
8
2
8
0 137
8
2
8
0 161
8
2
8
0 183
8
2
8
0 64
8
2
8
0 59
8
2
8
0 77
8
2
8
0 142
8
2
8
0 33
8
2
8
0 39
8
2
8
0 83
8
2
8
0 146
8
2
8
0 174
8
2
8
0 72
8
2
8
0 31
8
2
8...

result:

ok 

Test #9:

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

input:

200
1
1
2
2
1
1
1
2
2
2
1
2
2
1
2
2
2
1
1
2
2
2
1
1
2
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 159
8
2
8
0 60
8
2
8
1 60
8
0 156
8
2
8
1 156
8
0 65
8
2
8
0 13
8
2
8
0 157
8
2
8
0 9
8
2
8
1 9
8
0 167
8
2
8
1 167
8
0 44
8
2
8
1 44
8
0 57
8
2
8
0 116
8
2
8
1 116
8
0 40
8
2
8
1 40
8
0 66
8
2
8
0 34
8
2
8
1 34
8
0 16
8
2
8
1 16
8
0 90
8
2
8
1 90
8
0 180
8
2
8
0 127
8
2
8
0 172
8
2
8...

result:

ok 

Test #10:

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

input:

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

output:

8
0 27
8
2
8
0 64
8
2
8
0 182
8
2
8
0 183
8
2
8
0 32
8
2
8
0 184
8
2
8
1 184
8
0 165
8
2
8
1 165
8
0 146
8
2
8
0 48
8
2
8
0 16
8
2
8
0 85
8
2
8
1 85
8
0 115
8
2
8
0 90
8
2
8
1 90
8
0 195
8
2
8
1 195
8
0 10
8
2
8
1 10
8
0 157
8
2
8
1 157
8
0 145
8
2
8
0 168
8
2
8
1 168
8
0 31
8
2
8
1 31
8
0 45
8
2
8
...

result:

ok 

Test #11:

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

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 198
8
2
8
0 184
8
2
8
1 184
8
0 130
8
2
8
1 130
8
0 89
8
2
8
1 89
8
0 164
8
2
8
1 164
8
0 33
8
2
8
1 33
8
0 135
8
2
8
1 135
8
0 44
8
2
8
1 44
8
0 154
8
2
8
1 154
8
0 148
8
2
8
1 148
8
0 54
8
2
8
1 54
8
0 71
8
2
8
1 71
8
0 27
8
2
8
1 27
8
0 4
8
2
8
1 4
8
0 62
8
2
8
1 62
8
0 127
8
2
8
1 127
8
0 23...

result:

ok 

Test #12:

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

input:

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

output:

8
0 107
8
2
8
0 189
8
2
8
0 161
8
2
8
0 1
8
2
8
0 193
8
2
8
0 12
8
2
8
1 12
8
0 25
8
2
8
0 124
8
2
8
1 124
8
0 29
8
2
8
1 29
8
0 179
8
2
8
1 179
8
0 68
8
2
8
1 68
8
0 167
8
2
8
1 167
8
0 56
8
2
8
0 160
8
2
8
0 166
8
2
8
1 166
8
0 41
8
2
8
1 41
8
0 96
8
2
8
0 194
8
2
8
0 63
8
2
8
0 35
8
2
8
0 156
8
2...

result:

ok 

Test #13:

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

input:

197
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 35
8
2
8
0 164
8
2
8
1 164
8
0 42
8
2
8
0 64
8
2
8
0 52
8
2
8
1 52
8
0 139
8
2
8
1 139
8
0 1
8
2
8
1 1
8
0 47
8
2
8
1 47
8
0 185
8
2
8
0 165
8
2
8
1 165
8
0 169
8
2
8
1 169
8
0 178
8
2
8
1 178
8
0 192
8
2
8
1 192
8
0 39
8
2
8
1 39
8
0 118
8
2
8
1 118
8
0 50
8
2
8
1 50
8
0 92
8
2
8
1 92
8
0 173
8...

result:

ok 

Test #14:

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

input:

198
1
1
1
1
2
1
1
2
1
1
1
2
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 105
8
2
8
0 159
8
2
8
0 106
8
2
8
0 130
8
2
8
0 20
8
2
8
1 20
8
0 24
8
2
8
0 166
8
2
8
0 144
8
2
8
1 144
8
0 46
8
2
8
0 160
8
2
8
0 71
8
2
8
0 3
8
2
8
1 3
8
0 145
8
2
8
0 148
8
2
8
1 148
8
0 89
8
2
8
1 89
8
0 134
8
2
8
0 190
8
2
8
0 179
8
2
8
1 179
8
0 59
8
2
8
1 59
8
0 176
8
2
8
1 176
8
0 126
8...

result:

ok 

Test #15:

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

input:

200
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 82
8
2
8
0 190
8
2
8
0 95
8
2
8
0 54
8
2
8
0 181
8
2
8
1 181
8
0 168
8
2
8
1 168
8
0 175
8
2
8
1 175
8
0 154
8
2
8
1 154
8
0 115
8
2
8
1 115
8
0 172
8
2
8
1 172
8
0 20
8
2
8
0 176
8
2
8
1 176
8
0 121
8
2
8
1 121
8
0 4
8
2
8
1 4
8
0 77
8
2
8
1 77
8
0 103
8
2
8
1 103
8
0 99
8
2
8
1 99
8
0 43
8
2
8...

result:

ok 

Test #16:

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

input:

196
1
1
1
1
1
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 4
8
2
8
0 156
8
2
8
0 114
8
2
8
0 96
8
2
8
0 135
8
2
8
0 87
8
2
8
1 87
8
0 37
8
2
8
1 37
8
0 64
8
2
8
1 64
8
0 28
8
2
8
1 28
8
0 10
8
2
8
0 163
8
2
8
1 163
8
0 137
8
2
8
0 152
8
2
8
1 152
8
0 23
8
2
8
1 23
8
0 160
8
2
8
1 160
8
0 187
8
2
8
0 81
8
2
8
1 81
8
0 73
8
2
8
1 73
8
0 17
8
2
8
1 17
8
0 ...

result:

ok 

Test #17:

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

input:

199
1
1
1
1
1
2
1
2
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 120
8
2
8
0 193
8
2
8
0 110
8
2
8
0 150
8
2
8
0 182
8
2
8
1 182
8
0 91
8
2
8
0 52
8
2
8
1 52
8
0 21
8
2
8
1 21
8
0 171
8
2
8
0 11
8
2
8
1 11
8
0 44
8
2
8
1 44
8
0 129
8
2
8
0 90
8
2
8
1 90
8
0 76
8
2
8
1 76
8
0 26
8
2
8
0 167
8
2
8
1 167
8
0 37
8
2
8
1 37
8
0 187
8
2
8
1 187
8
0 191
...

result:

ok 

Test #18:

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

input:

196
1
1
1
1
2
1
2
1
1
1
2
2
1
2
2
2
2
1
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 126
8
2
8
0 31
8
2
8
0 144
8
2
8
0 58
8
2
8
0 136
8
2
8
1 136
8
0 140
8
2
8
0 195
8
2
8
1 195
8
0 45
8
2
8
0 79
8
2
8
0 166
8
2
8
0 112
8
2
8
1 112
8
0 61
8
2
8
1 61
8
0 146
8
2
8
0 41
8
2
8
1 41
8
0 162
8
2
8
1 162
8
0 139
8
2
8
1 139
8
0 120
8
2
8
1 120
8
0 108
8
2
8
0 51
8
2
8
1 51
8
0 4
8
2
...

result:

ok 

Test #19:

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

input:

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

output:

8
0 55
8
2
8
0 114
8
2
8
0 42
8
2
8
0 147
8
2
8
1 147
8
0 128
8
2
8
1 128
8
0 102
8
2
8
0 116
8
2
8
0 23
8
2
8
1 23
8
0 167
8
2
8
0 170
8
2
8
0 56
8
2
8
0 175
8
2
8
1 175
8
0 25
8
2
8
0 60
8
2
8
1 60
8
0 132
8
2
8
0 112
8
2
8
1 112
8
0 121
8
2
8
1 121
8
0 64
8
2
8
1 64
8
0 194
8
2
8
0 75
8
2
8
1 75
...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
1
1
1
2
2
2
1
2
2
2
1
1
1
1
2
2
2
1
2
2
2
1
2
1
2
2
2
2
2
2
2
2
2
1
2
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 171
8
2
8
0 136
8
2
8
0 26
8
2
8
0 165
8
2
8
0 57
8
2
8
0 174
8
2
8
0 126
8
2
8
0 53
8
2
8
1 53
8
0 76
8
2
8
1 76
8
0 28
8
2
8
1 28
8
0 12
8
2
8
0 67
8
2
8
1 67
8
0 110
8
2
8
1 110
8
0 100
8
2
8
1 100
8
0 84
8
2
8
0 152
8
2
8
0 80
8
2
8
0 6
8
2
8
0 54
8
2
8
1 54
8
0 55
8
2
8
1 55
8
0 46
8
2
8
1 ...

result:

ok 

Test #21:

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

input:

200
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
2
1
2
1
1
1
1
1
2
1
1
2
1
1
1
2
2
2
2
2
1
2
1
1
2
2
1
1
2
2
1
2
1
1
2
2
2
2
2
1
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
2
2
2
1
2
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
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 167
8
2
8
0 53
8
2
8
0 121
8
2
8
0 58
8
2
8
0 52
8
2
8
0 147
8
2
8
0 153
8
2
8
0 103
8
2
8
0 166
8
2
8
1 166
8
0 102
8
2
8
1 102
8
0 30
8
2
8
0 176
8
2
8
0 33
8
2
8
0 32
8
2
8
0 189
8
2
8
0 57
8
2
8
0 24
8
2
8
1 24
8
0 172
8
2
8
0 13
8
2
8
1 13
8
0 98
8
2
8
0 142
8
2
8
0 196
8
2
8
0 42
8
2
8
0 5...

result:

ok 

Test #22:

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

input:

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

output:

8
0 116
8
2
8
0 167
8
2
8
0 15
8
2
8
0 89
8
2
8
0 169
8
2
8
0 84
8
2
8
0 187
8
2
8
0 90
8
2
8
0 142
8
2
8
0 129
8
2
8
0 56
8
2
8
0 161
8
2
8
0 12
8
2
8
0 21
8
2
8
1 21
8
0 34
8
2
8
0 114
8
2
8
0 143
8
2
8
0 153
8
2
8
0 112
8
2
8
0 52
8
2
8
0 122
8
2
8
1 122
8
0 5
8
2
8
0 94
8
2
8
1 94
8
0 13
8
2
8
0...

result:

ok 

Test #23:

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

input:

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

output:

8
0 125
8
2
8
0 191
8
2
8
0 189
8
2
8
0 171
8
2
8
0 2
8
2
8
0 110
8
2
8
0 70
8
2
8
0 9
8
2
8
0 186
8
2
8
0 148
8
2
8
0 96
8
2
8
0 87
8
2
8
0 141
8
2
8
0 60
8
2
8
0 123
8
2
8
0 52
8
2
8
0 25
8
2
8
0 108
8
2
8
0 101
8
2
8
0 64
8
2
8
0 58
8
2
8
0 53
8
2
8
0 81
8
2
8
0 184
8
2
8
0 103
8
2
8
1 103
8
0 17...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 766
8
2
8
0 920
8
2
8
1 920
8
0 557
8
2
8
1 557
8
0 212
8
2
8
1 212
8
0 310
8
2
8
1 310
8
0 723
8
2
8
1 723
8
0 116
8
2
8
1 116
8
0 587
8
2
8
1 587
8
0 760
8
2
8
1 760
8
0 564
8
2
8
1 564
8
0 238
8
2
8
1 238
8
0 497
8
2
8
1 497
8
0 276
8
2
8
1 276
8
0 468
8
2
8
1 468
8
0 781
8
2
8
1 781
8
0 309
...

result:

ok 

Test #25:

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

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 557
8
2
8
0 775
8
2
8
0 384
8
2
8
0 458
8
2
8
0 705
8
2
8
0 844
8
2
8
0 477
8
2
8
0 381
8
2
8
0 764
8
2
8
0 241
8
2
8
0 242
8
2
8
0 178
8
2
8
0 516
8
2
8
0 664
8
2
8
0 766
8
2
8
0 12
8
2
8
0 116
8
2
8
0 247
8
2
8
0 420
8
2
8
0 39
8
2
8
0 510
8
2
8
0 385
8
2
8
0 368
8
2
8
0 593
8
2
8
0 96
8
2
8
0...

result:

ok 

Test #26:

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

input:

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

output:

8
0 175
8
2
8
0 645
8
2
8
0 783
8
2
8
0 18
8
2
8
0 927
8
2
8
0 871
8
2
8
1 871
8
0 513
8
2
8
0 607
8
2
8
0 906
8
2
8
0 197
8
2
8
1 197
8
0 618
8
2
8
0 935
8
2
8
1 935
8
0 988
8
2
8
1 988
8
0 956
8
2
8
0 428
8
2
8
1 428
8
0 572
8
2
8
0 552
8
2
8
0 234
8
2
8
1 234
8
0 624
8
2
8
0 14
8
2
8
1 14
8
0 254...

result:

ok 

Test #27:

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

input:

999
1
1
1
1
1
1
1
1
2
1
1
1
1
1
2
1
1
2
1
2
1
2
2
1
1
2
2
2
1
2
1
2
2
2
1
1
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 106
8
2
8
0 150
8
2
8
0 130
8
2
8
0 357
8
2
8
0 344
8
2
8
0 992
8
2
8
0 667
8
2
8
0 123
8
2
8
0 611
8
2
8
1 611
8
0 350
8
2
8
0 0
8
2
8
0 563
8
2
8
0 610
8
2
8
0 90
8
2
8
0 67
8
2
8
1 67
8
0 340
8
2
8
0 448
8
2
8
0 732
8
2
8
1 732
8
0 219
8
2
8
0 770
8
2
8
1 770
8
0 887
8
2
8
0 401
8
2
8
1 401
8...

result:

ok 

Test #28:

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

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 832
8
2
8
0 151
8
2
8
1 151
8
0 747
8
2
8
1 747
8
0 736
8
2
8
1 736
8
0 418
8
2
8
1 418
8
0 721
8
2
8
1 721
8
0 872
8
2
8
1 872
8
0 269
8
2
8
1 269
8
0 879
8
2
8
1 879
8
0 750
8
2
8
1 750
8
0 339
8
2
8
1 339
8
0 197
8
2
8
1 197
8
0 110
8
2
8
1 110
8
0 27
8
2
8
1 27
8
0 433
8
2
8
1 433
8
0 497
8
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 307
8
2
8
0 425
8
2
8
0 787
8
2
8
1 787
8
0 252
8
2
8
1 252
8
0 944
8
2
8
1 944
8
0 53
8
2
8
1 53
8
0 222
8
2
8
1 222
8
0 299
8
2
8
1 299
8
0 376
8
2
8
1 376
8
0 296
8
2
8
0 765
8
2
8
1 765
8
0 38
8
2
8
1 38
8
0 867
8
2
8
1 867
8
0 381
8
2
8
1 381
8
0 984
8
2
8
1 984
8
0 0
8
2
8
1 0
8
0 620
8
2
...

result:

ok 

Test #30:

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

input:

998
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

output:

8
0 224
8
2
8
0 254
8
2
8
0 670
8
2
8
0 628
8
2
8
0 946
8
2
8
1 946
8
0 318
8
2
8
1 318
8
0 452
8
2
8
1 452
8
0 341
8
2
8
1 341
8
0 66
8
2
8
1 66
8
0 536
8
2
8
1 536
8
0 641
8
2
8
1 641
8
0 400
8
2
8
1 400
8
0 519
8
2
8
1 519
8
0 907
8
2
8
1 907
8
0 49
8
2
8
1 49
8
0 240
8
2
8
1 240
8
0 729
8
2
8
1 ...

result:

ok 

Test #31:

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

input:

998
1
1
1
1
1
1
1
1
2
1
1
1
2
2
1
1
2
2
2
1
2
2
2
2
1
1
1
1
2
2
1
2
2
2
1
2
1
2
2
2
1
2
2
2
1
1
2
2
1
2
2
2
2
1
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
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 460
8
2
8
0 151
8
2
8
0 314
8
2
8
0 869
8
2
8
0 562
8
2
8
0 971
8
2
8
0 741
8
2
8
0 148
8
2
8
1 148
8
0 677
8
2
8
0 448
8
2
8
0 155
8
2
8
0 817
8
2
8
1 817
8
0 519
8
2
8
1 519
8
0 45
8
2
8
0 458
8
2
8
0 140
8
2
8
1 140
8
0 567
8
2
8
1 567
8
0 531
8
2
8
1 531
8
0 746
8
2
8
0 610
8
2
8...

result:

ok 

Test #32:

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

input:

1000
1
1
2
2
2
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 736
8
2
8
0 63
8
2
8
0 270
8
2
8
1 270
8
0 913
8
2
8
1 913
8
0 845
8
2
8
1 845
8
0 981
8
2
8
0 98
8
2
8
0 372
8
2
8
1 372
8
0 243
8
2
8
1 243
8
0 931
8
2
8
1 931
8
0 259
8
2
8
1 259
8
0 570
8
2
8
1 570
8
0 203
8
2
8
1 203
8
0 670
8
2
8
1 670
8
0 915
8
2
8
1 915
8
0 423
8
2
8
1 423
8
0 696
8
2
8
...

result:

ok 

Test #33:

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

input:

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

output:

8
0 150
8
2
8
0 701
8
2
8
0 454
8
2
8
0 125
8
2
8
0 550
8
2
8
1 550
8
0 212
8
2
8
0 670
8
2
8
0 604
8
2
8
1 604
8
0 651
8
2
8
0 695
8
2
8
1 695
8
0 960
8
2
8
1 960
8
0 223
8
2
8
1 223
8
0 240
8
2
8
1 240
8
0 81
8
2
8
1 81
8
0 515
8
2
8
0 383
8
2
8
1 383
8
0 940
8
2
8
1 940
8
0 250
8
2
8
1 250
8
0 5
...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
2
1
1
2
2
1
2
2
2
2
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 329
8
2
8
0 871
8
2
8
0 987
8
2
8
0 388
8
2
8
0 755
8
2
8
1 755
8
0 938
8
2
8
0 476
8
2
8
0 858
8
2
8
1 858
8
0 934
8
2
8
1 934
8
0 766
8
2
8
0 341
8
2
8
1 341
8
0 911
8
2
8
1 911
8
0 318
8
2
8
1 318
8
0 640
8
2
8
1 640
8
0 333
8
2
8
0 505
8
2
8
1 505
8
0 867
8
2
8
1 867
8
0 150
8
2
8
1 150
8
0 ...

result:

ok 

Test #35:

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

input:

1000
1
1
1
1
2
1
2
1
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 51
8
2
8
0 134
8
2
8
0 771
8
2
8
0 565
8
2
8
0 444
8
2
8
1 444
8
0 75
8
2
8
0 290
8
2
8
1 290
8
0 415
8
2
8
0 781
8
2
8
0 35
8
2
8
0 913
8
2
8
0 1
8
2
8
0 492
8
2
8
1 492
8
0 259
8
2
8
1 259
8
0 475
8
2
8
1 475
8
0 208
8
2
8
1 208
8
0 815
8
2
8
1 815
8
0 742
8
2
8
0 943
8
2
8
1 943
8
0 152
8
2
8...

result:

ok 

Test #36:

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

input:

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

output:

8
0 451
8
2
8
0 966
8
2
8
1 966
8
0 969
8
2
8
0 415
8
2
8
0 373
8
2
8
0 144
8
2
8
0 21
8
2
8
1 21
8
0 850
8
2
8
0 821
8
2
8
1 821
8
0 508
8
2
8
1 508
8
0 958
8
2
8
0 493
8
2
8
0 685
8
2
8
0 857
8
2
8
1 857
8
0 181
8
2
8
0 938
8
2
8
0 325
8
2
8
1 325
8
0 88
8
2
8
1 88
8
0 250
8
2
8
1 250
8
0 756
8
2
...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
1
2
1
2
2
1
2
2
1
1
2
1
1
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
1
1
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 504
8
2
8
0 464
8
2
8
0 938
8
2
8
0 351
8
2
8
0 489
8
2
8
0 954
8
2
8
1 954
8
0 669
8
2
8
0 343
8
2
8
1 343
8
0 934
8
2
8
1 934
8
0 791
8
2
8
0 195
8
2
8
1 195
8
0 96
8
2
8
1 96
8
0 428
8
2
8
0 307
8
2
8
0 238
8
2
8
1 238
8
0 665
8
2
8
0 89
8
2
8
0 768
8
2
8
1 768
8
0 690
8
2
8
0 900
8
2
8
1 900...

result:

ok 

Test #38:

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

input:

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

output:

8
0 871
8
2
8
0 925
8
2
8
0 220
8
2
8
0 687
8
2
8
0 593
8
2
8
0 314
8
2
8
0 706
8
2
8
0 811
8
2
8
0 604
8
2
8
0 196
8
2
8
1 196
8
0 111
8
2
8
0 99
8
2
8
1 99
8
0 409
8
2
8
0 721
8
2
8
1 721
8
0 248
8
2
8
0 146
8
2
8
0 308
8
2
8
0 349
8
2
8
1 349
8
0 526
8
2
8
0 33
8
2
8
1 33
8
0 556
8
2
8
1 556
8
0 ...

result:

ok 

Test #39:

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

input:

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

output:

8
0 105
8
2
8
0 944
8
2
8
0 401
8
2
8
0 143
8
2
8
0 103
8
2
8
0 208
8
2
8
0 174
8
2
8
0 828
8
2
8
0 59
8
2
8
0 776
8
2
8
0 582
8
2
8
0 80
8
2
8
0 324
8
2
8
1 324
8
0 718
8
2
8
0 380
8
2
8
0 935
8
2
8
0 296
8
2
8
0 827
8
2
8
1 827
8
0 661
8
2
8
0 715
8
2
8
0 639
8
2
8
0 115
8
2
8
0 705
8
2
8
0 92
8
2...

result:

ok 

Test #40:

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

input:

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

output:

8
0 489
8
2
8
0 956
8
2
8
0 812
8
2
8
0 645
8
2
8
0 616
8
2
8
0 948
8
2
8
0 582
8
2
8
0 370
8
2
8
0 689
8
2
8
0 831
8
2
8
0 312
8
2
8
0 809
8
2
8
0 724
8
2
8
0 305
8
2
8
0 881
8
2
8
0 691
8
2
8
0 470
8
2
8
0 73
8
2
8
0 808
8
2
8
0 799
8
2
8
1 799
8
0 503
8
2
8
0 790
8
2
8
0 104
8
2
8
0 189
8
2
8
0 5...

result:

ok 

Test #41:

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

input:

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

output:

8
0 754
8
2
8
0 678
8
2
8
0 130
8
2
8
0 374
8
2
8
0 758
8
2
8
0 388
8
2
8
0 381
8
2
8
0 11
8
2
8
0 688
8
2
8
0 94
8
2
8
0 346
8
2
8
0 983
8
2
8
0 562
8
2
8
0 727
8
2
8
1 727
8
0 55
8
2
8
0 515
8
2
8
0 626
8
2
8
0 461
8
2
8
0 724
8
2
8
0 89
8
2
8
0 109
8
2
8
0 687
8
2
8
0 769
8
2
8
0 585
8
2
8
0 948
...

result:

ok 

Test #42:

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

output:

8
0 828
8
2
8
0 304
8
2
8
0 670
8
2
8
0 91
8
2
8
0 104
8
2
8
0 546
8
2
8
0 695
8
2
8
0 134
8
2
8
0 563
8
2
8
0 937
8
2
8
0 611
8
2
8
0 761
8
2
8
0 27
8
2
8
0 495
8
2
8
0 223
8
2
8
0 463
8
2
8
0 779
8
2
8
0 234
8
2
8
0 898
8
2
8
0 679
8
2
8
0 676
8
2
8
0 911
8
2
8
0 441
8
2
8
0 575
8
2
8
0 917
8
2
8
...

result:

ok 

Subtask #3:

score: 74.2
Acceptable Answer

Test #43:

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

input:

2
1
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
2
1
2
2
2
1
2
2
1

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

score: 75
Accepted
time: 10ms
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 1075
8
2
8
0 425
8
2
8
1 425
8
0 1825
8
2
8
1 1825
8
0 1067
8
2
8
1 1067
8
0 240
8
2
8
1 240
8
0 1128
8
2
8
1 1128
8
0 1263
8
2
8
1 1263
8
0 947
8
2
8
1 947
8
0 1919
8
2
8
1 1919
8
0 100
8
2
8
1 100
8
0 1097
8
2
8
1 1097
8
0 961
8
2
8
1 961
8
0 992
8
2
8
1 992
8
0 1918
8
2
8
1 1918
8
0 102
8
2
8...

result:

ok 

Test #49:

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

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 949
8
2
8
0 1977
8
2
8
0 347
8
2
8
0 1970
8
2
8
0 1465
8
2
8
0 1182
8
2
8
0 1512
8
2
8
0 661
8
2
8
0 354
8
2
8
0 722
8
2
8
0 206
8
2
8
0 864
8
2
8
0 1930
8
2
8
0 649
8
2
8
0 1766
8
2
8
0 1390
8
2
8
0 393
8
2
8
0 1840
8
2
8
0 1407
8
2
8
0 1585
8
2
8
0 1939
8
2
8
0 1505
8
2
8
0 695
8
2
8
0 174
8
2...

result:

ok 

Test #50:

score: 74.75
Acceptable Answer
time: 31ms
memory: 3836kb

input:

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

output:

8
0 874
8
2
8
0 1340
8
2
8
0 195
8
2
8
0 894
8
2
8
0 1529
8
2
8
0 532
8
2
8
0 838
8
2
8
0 757
8
2
8
0 1723
8
2
8
0 592
8
2
8
0 1637
8
2
8
0 114
8
2
8
1 114
8
0 1890
8
2
8
0 1804
8
2
8
0 227
8
2
8
1 227
8
0 820
8
2
8
0 521
8
2
8
0 1202
8
2
8
1 1202
8
0 321
8
2
8
0 971
8
2
8
1 971
8
0 828
8
2
8
1 828
...

result:

points 0.99666666670 points  0.99666666670

Test #51:

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

input:

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

output:

8
0 1079
8
2
8
0 1610
8
2
8
0 92
8
2
8
0 1601
8
2
8
0 492
8
2
8
1 492
8
0 487
8
2
8
0 1898
8
2
8
0 1212
8
2
8
0 1889
8
2
8
1 1889
8
0 413
8
2
8
0 1198
8
2
8
1 1198
8
0 777
8
2
8
0 275
8
2
8
0 415
8
2
8
0 1002
8
2
8
1 1002
8
0 1854
8
2
8
1 1854
8
0 29
8
2
8
0 283
8
2
8
0 1413
8
2
8
1 1413
8
0 1866
8
...

result:

ok 

Test #52:

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

input:

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

output:

8
0 1711
8
2
8
0 815
8
2
8
1 815
8
0 968
8
2
8
1 968
8
0 1118
8
2
8
1 1118
8
0 125
8
2
8
1 125
8
0 758
8
2
8
1 758
8
0 280
8
2
8
1 280
8
0 1456
8
2
8
1 1456
8
0 1007
8
2
8
1 1007
8
0 1787
8
2
8
1 1787
8
0 1039
8
2
8
1 1039
8
0 70
8
2
8
1 70
8
0 1336
8
2
8
1 1336
8
0 1681
8
2
8
1 1681
8
0 648
8
2
8
1...

result:

ok 

Test #53:

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

input:

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

output:

8
0 971
8
2
8
0 872
8
2
8
0 1285
8
2
8
0 571
8
2
8
1 571
8
0 1280
8
2
8
0 1379
8
2
8
0 1652
8
2
8
0 964
8
2
8
1 964
8
0 84
8
2
8
1 84
8
0 945
8
2
8
0 636
8
2
8
1 636
8
0 712
8
2
8
0 463
8
2
8
0 1449
8
2
8
1 1449
8
0 1929
8
2
8
0 656
8
2
8
0 274
8
2
8
0 853
8
2
8
1 853
8
0 503
8
2
8
0 431
8
2
8
1 431...

result:

ok 

Test #54:

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

input:

2000
1
2
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1654
8
2
8
0 1163
8
2
8
1 1163
8
0 885
8
2
8
0 1563
8
2
8
1 1563
8
0 292
8
2
8
0 910
8
2
8
0 882
8
2
8
1 882
8
0 860
8
2
8
1 860
8
0 1780
8
2
8
1 1780
8
0 1696
8
2
8
1 1696
8
0 657
8
2
8
1 657
8
0 424
8
2
8
1 424
8
0 1499
8
2
8
1 1499
8
0 258
8
2
8
1 258
8
0 1958
8
2
8
1 1958
8
0 1994
8
2
8
1 19...

result:

ok 

Test #55:

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

input:

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

output:

8
0 91
8
2
8
0 427
8
2
8
0 1836
8
2
8
0 723
8
2
8
0 1930
8
2
8
1 1930
8
0 1973
8
2
8
1 1973
8
0 944
8
2
8
0 1763
8
2
8
0 781
8
2
8
0 1885
8
2
8
1 1885
8
0 369
8
2
8
1 369
8
0 1924
8
2
8
0 1669
8
2
8
0 1259
8
2
8
0 1780
8
2
8
0 1152
8
2
8
0 78
8
2
8
0 1699
8
2
8
1 1699
8
0 1730
8
2
8
0 1525
8
2
8
0 4...

result:

ok 

Test #56:

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

input:

1998
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 40
8
2
8
0 1885
8
2
8
0 346
8
2
8
0 1328
8
2
8
1 1328
8
0 780
8
2
8
1 780
8
0 1643
8
2
8
1 1643
8
0 843
8
2
8
1 843
8
0 1658
8
2
8
0 1061
8
2
8
0 252
8
2
8
1 252
8
0 762
8
2
8
1 762
8
0 1453
8
2
8
1 1453
8
0 674
8
2
8
1 674
8
0 1460
8
2
8
1 1460
8
0 131
8
2
8
1 131
8
0 1470
8
2
8
1 1470
8
0 698
...

result:

ok 

Test #57:

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

input:

1999
1
1
1
2
1
2
2
1
1
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 551
8
2
8
0 776
8
2
8
0 127
8
2
8
0 912
8
2
8
1 912
8
0 580
8
2
8
0 1882
8
2
8
1 1882
8
0 1102
8
2
8
1 1102
8
0 829
8
2
8
0 412
8
2
8
0 1942
8
2
8
0 1050
8
2
8
1 1050
8
0 696
8
2
8
1 696
8
0 945
8
2
8
1 945
8
0 204
8
2
8
1 204
8
0 1382
8
2
8
1 1382
8
0 1576
8
2
8
1 1576
8
0 942
8
2
8
1 942
8
0 1...

result:

points 0.99946666670 points  0.99946666670

Test #58:

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

input:

1997
1
1
1
1
1
2
1
2
1
2
2
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1039
8
2
8
0 935
8
2
8
0 518
8
2
8
0 206
8
2
8
0 787
8
2
8
0 980
8
2
8
1 980
8
0 417
8
2
8
0 1937
8
2
8
1 1937
8
0 1310
8
2
8
0 1621
8
2
8
1 1621
8
0 50
8
2
8
1 50
8
0 1348
8
2
8
1 1348
8
0 1852
8
2
8
1 1852
8
0 591
8
2
8
1 591
8
0 1651
8
2
8
1 1651
8
0 1840
8
2
8
1 1840
8
0 1005
8
2
8
0 1555
8
...

result:

points 1.0 points  1.0

Test #59:

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

input:

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

output:

8
0 1580
8
2
8
0 1103
8
2
8
0 912
8
2
8
0 1650
8
2
8
1 1650
8
0 1161
8
2
8
1 1161
8
0 855
8
2
8
0 815
8
2
8
0 1525
8
2
8
1 1525
8
0 1526
8
2
8
0 1295
8
2
8
1 1295
8
0 1968
8
2
8
0 189
8
2
8
0 1072
8
2
8
1 1072
8
0 374
8
2
8
1 374
8
0 1045
8
2
8
1 1045
8
0 1940
8
2
8
1 1940
8
0 1816
8
2
8
1 1816
8
0 ...

result:

ok 

Test #60:

score: 74.68
Acceptable Answer
time: 36ms
memory: 3760kb

input:

1996
1
1
1
1
1
2
1
1
2
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
1
1
2
2
1
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1899
8
2
8
0 332
8
2
8
0 419
8
2
8
0 147
8
2
8
0 1743
8
2
8
0 98
8
2
8
1 98
8
0 1158
8
2
8
0 1287
8
2
8
0 1530
8
2
8
1 1530
8
0 1354
8
2
8
0 498
8
2
8
0 1637
8
2
8
1 1637
8
0 1526
8
2
8
1 1526
8
0 1893
8
2
8
1 1893
8
0 1661
8
2
8
0 1914
8
2
8
1 1914
8
0 1890
8
2
8
1 1890
8
0 157
8
2
8
1 157
8
0 ...

result:

points 0.99573333330 points  0.99573333330

Test #61:

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

input:

2000
1
1
1
1
1
1
2
1
1
2
1
1
2
1
2
2
2
1
2
2
1
1
2
2
2
2
1
2
2
2
1
1
2
1
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 324
8
2
8
0 1634
8
2
8
0 208
8
2
8
0 908
8
2
8
0 297
8
2
8
0 250
8
2
8
0 804
8
2
8
1 804
8
0 1077
8
2
8
0 77
8
2
8
0 506
8
2
8
1 506
8
0 1192
8
2
8
0 181
8
2
8
0 1536
8
2
8
1 1536
8
0 170
8
2
8
0 1350
8
2
8
1 1350
8
0 1607
8
2
8
1 1607
8
0 1512
8
2
8
1 1512
8
0 382
8
2
8
0 1244
8
2
8
1 1244
8
0 ...

result:

ok 

Test #62:

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

input:

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

output:

8
0 1910
8
2
8
0 888
8
2
8
0 44
8
2
8
0 802
8
2
8
1 802
8
0 1088
8
2
8
0 1119
8
2
8
0 899
8
2
8
0 1184
8
2
8
0 1909
8
2
8
0 1738
8
2
8
0 896
8
2
8
0 1805
8
2
8
0 864
8
2
8
0 583
8
2
8
0 1915
8
2
8
1 1915
8
0 1597
8
2
8
0 477
8
2
8
0 347
8
2
8
0 370
8
2
8
0 1353
8
2
8
0 1320
8
2
8
0 1006
8
2
8
0 304
...

result:

ok 

Test #63:

score: 74.33
Acceptable Answer
time: 43ms
memory: 3888kb

input:

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

output:

8
0 180
8
2
8
0 722
8
2
8
0 1887
8
2
8
0 249
8
2
8
0 1862
8
2
8
0 1428
8
2
8
0 281
8
2
8
0 433
8
2
8
0 64
8
2
8
0 773
8
2
8
0 628
8
2
8
0 230
8
2
8
0 978
8
2
8
0 1920
8
2
8
0 879
8
2
8
0 953
8
2
8
0 1003
8
2
8
1 1003
8
0 1456
8
2
8
0 1591
8
2
8
0 422
8
2
8
0 1211
8
2
8
0 1376
8
2
8
0 1442
8
2
8
1 14...

result:

points 0.99106666670 points  0.99106666670

Test #64:

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

input:

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

output:

8
0 1255
8
2
8
0 1917
8
2
8
0 1964
8
2
8
0 871
8
2
8
0 251
8
2
8
0 1533
8
2
8
0 892
8
2
8
0 1188
8
2
8
0 1838
8
2
8
0 1576
8
2
8
0 663
8
2
8
0 1152
8
2
8
0 639
8
2
8
0 579
8
2
8
0 754
8
2
8
0 1597
8
2
8
0 102
8
2
8
0 412
8
2
8
0 933
8
2
8
0 1763
8
2
8
0 420
8
2
8
0 574
8
2
8
0 1893
8
2
8
0 1069
8
2
...

result:

ok 

Test #65:

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

input:

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

output:

8
0 169
8
2
8
0 1577
8
2
8
0 40
8
2
8
0 850
8
2
8
0 807
8
2
8
0 459
8
2
8
0 1228
8
2
8
0 740
8
2
8
0 794
8
2
8
0 699
8
2
8
0 691
8
2
8
0 1359
8
2
8
0 23
8
2
8
0 1605
8
2
8
0 1119
8
2
8
0 631
8
2
8
0 650
8
2
8
0 24
8
2
8
0 140
8
2
8
0 1890
8
2
8
0 1690
8
2
8
0 1529
8
2
8
0 1511
8
2
8
1 1511
8
0 1908
...

result:

ok 

Test #66:

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

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

output:

8
0 1794
8
2
8
0 447
8
2
8
0 1394
8
2
8
0 1560
8
2
8
0 1228
8
2
8
0 73
8
2
8
0 1138
8
2
8
0 1790
8
2
8
0 757
8
2
8
0 1152
8
2
8
0 1497
8
2
8
0 473
8
2
8
0 904
8
2
8
0 1048
8
2
8
0 1378
8
2
8
0 703
8
2
8
0 444
8
2
8
0 1342
8
2
8
0 1007
8
2
8
0 1156
8
2
8
0 301
8
2
8
0 295
8
2
8
0 913
8
2
8
0 1467
8
2...

result:

ok 

Test #67:

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

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

output:

8
0 1505
8
2
8
0 1115
8
2
8
0 752
8
2
8
0 1834
8
2
8
0 926
8
2
8
0 680
8
2
8
0 1643
8
2
8
0 876
8
2
8
0 1287
8
2
8
0 1366
8
2
8
0 1391
8
2
8
0 1767
8
2
8
0 344
8
2
8
0 1564
8
2
8
0 225
8
2
8
0 117
8
2
8
0 1392
8
2
8
0 1619
8
2
8
0 541
8
2
8
0 396
8
2
8
0 1745
8
2
8
0 1067
8
2
8
0 167
8
2
8
0 281
8
2...

result:

ok 

Test #68:

score: 74.88
Acceptable Answer
time: 35ms
memory: 3736kb

input:

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

output:

8
0 1529
8
2
8
0 516
8
2
8
0 958
8
2
8
0 453
8
2
8
0 1656
8
2
8
0 1170
8
2
8
0 663
8
2
8
1 663
8
0 1488
8
2
8
0 1641
8
2
8
0 151
8
2
8
0 1752
8
2
8
0 1138
8
2
8
0 1676
8
2
8
0 841
8
2
8
0 1897
8
2
8
0 192
8
2
8
1 192
8
0 31
8
2
8
0 1014
8
2
8
0 514
8
2
8
0 1763
8
2
8
0 1967
8
2
8
0 133
8
2
8
1 133
8...

result:

points 0.99840 points  0.99840

Test #69:

score: 74.88
Acceptable Answer
time: 57ms
memory: 3888kb

input:

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

output:

8
0 1230
8
2
8
0 754
8
2
8
0 1322
8
2
8
0 1479
8
2
8
0 874
8
2
8
0 1626
8
2
8
0 1011
8
2
8
0 1891
8
2
8
0 477
8
2
8
0 46
8
2
8
1 46
8
0 1837
8
2
8
1 1837
8
0 983
8
2
8
0 828
8
2
8
0 29
8
2
8
0 1657
8
2
8
1 1657
8
0 95
8
2
8
0 1616
8
2
8
0 229
8
2
8
0 1217
8
2
8
0 661
8
2
8
0 1145
8
2
8
1 1145
8
0 19...

result:

points 0.99840 points  0.99840

Test #70:

score: 74.46
Acceptable Answer
time: 51ms
memory: 3780kb

input:

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

output:

8
0 1436
8
2
8
0 1747
8
2
8
0 1602
8
2
8
1 1602
8
0 1949
8
2
8
0 1225
8
2
8
1 1225
8
0 1807
8
2
8
0 1515
8
2
8
1 1515
8
0 558
8
2
8
1 558
8
0 511
8
2
8
0 276
8
2
8
1 276
8
0 1389
8
2
8
0 1499
8
2
8
0 1461
8
2
8
0 1051
8
2
8
1 1051
8
0 1405
8
2
8
0 1075
8
2
8
0 1415
8
2
8
0 348
8
2
8
0 171
8
2
8
1 17...

result:

points 0.99280 points  0.99280

Test #71:

score: 74.46
Acceptable Answer
time: 35ms
memory: 3872kb

input:

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

output:

8
0 1646
8
2
8
0 1749
8
2
8
0 1571
8
2
8
0 158
8
2
8
0 752
8
2
8
0 1950
8
2
8
0 1705
8
2
8
0 446
8
2
8
0 667
8
2
8
0 530
8
2
8
0 610
8
2
8
0 281
8
2
8
0 700
8
2
8
0 1848
8
2
8
0 1476
8
2
8
0 1523
8
2
8
0 832
8
2
8
1 832
8
0 243
8
2
8
1 243
8
0 1008
8
2
8
1 1008
8
0 81
8
2
8
1 81
8
0 471
8
2
8
0 138
...

result:

points 0.99280 points  0.99280

Test #72:

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

input:

1981
1
1
1
1
2
2
1
1
1
1
1
1
2
1
1
1
1
2
1
1
1
1
1
1
2
2
2
1
1
1
1
2
2
2
1
1
1
2
2
1
1
2
1
1
1
2
2
2
2
1
1
2
2
2
1
2
2
1
2
1
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
1
1
2
2
2
2
1
1
1
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2...

output:

8
0 1971
8
2
8
0 1289
8
2
8
0 1881
8
2
8
0 360
8
2
8
0 935
8
2
8
1 935
8
0 286
8
2
8
1 286
8
0 1621
8
2
8
0 1900
8
2
8
0 826
8
2
8
0 967
8
2
8
0 951
8
2
8
0 1066
8
2
8
0 1086
8
2
8
1 1086
8
0 398
8
2
8
0 900
8
2
8
0 586
8
2
8
0 18
8
2
8
0 554
8
2
8
1 554
8
0 76
8
2
8
0 1531
8
2
8
0 1141
8
2
8
0 938
...

result:

ok 

Test #73:

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

input:

1981
1
1
1
1
1
1
2
1
1
1
1
2
2
1
1
1
2
2
1
1
1
1
1
1
1
2
1
1
2
1
1
2
2
1
2
2
1
1
1
2
1
2
1
1
2
1
2
2
1
1
2
1
1
2
2
1
2
1
1
1
2
2
1
1
2
2
2
1
2
1
2
2
1
2
2
2
2
2
1
2
2
1
2
1
2
2
1
2
2
1
2
1
2
1
2
2
2
2
1
2
2
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2...

output:

8
0 297
8
2
8
0 512
8
2
8
0 1823
8
2
8
0 1200
8
2
8
0 270
8
2
8
0 912
8
2
8
0 66
8
2
8
1 66
8
0 833
8
2
8
0 516
8
2
8
0 1139
8
2
8
0 1754
8
2
8
0 1576
8
2
8
1 1576
8
0 762
8
2
8
1 762
8
0 25
8
2
8
0 1296
8
2
8
0 1679
8
2
8
0 1209
8
2
8
1 1209
8
0 666
8
2
8
1 666
8
0 1794
8
2
8
0 1849
8
2
8
0 1036
8
...

result:

ok 

Test #74:

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

input:

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

output:

8
0 868
8
2
8
0 1442
8
2
8
0 551
8
2
8
0 1764
8
2
8
0 22
8
2
8
0 956
8
2
8
0 417
8
2
8
0 1074
8
2
8
0 1964
8
2
8
0 456
8
2
8
1 456
8
0 1464
8
2
8
0 1220
8
2
8
0 1842
8
2
8
0 1777
8
2
8
0 843
8
2
8
0 321
8
2
8
0 1103
8
2
8
0 1306
8
2
8
1 1306
8
0 1872
8
2
8
0 1621
8
2
8
0 862
8
2
8
1 862
8
0 241
8
2
...

result:

ok 

Test #75:

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

input:

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

output:

8
0 400
8
2
8
0 1728
8
2
8
0 1689
8
2
8
0 112
8
2
8
0 1754
8
2
8
0 170
8
2
8
0 352
8
2
8
0 1381
8
2
8
0 379
8
2
8
0 724
8
2
8
0 420
8
2
8
0 1329
8
2
8
0 129
8
2
8
0 1559
8
2
8
0 1512
8
2
8
1 1512
8
0 1751
8
2
8
0 1767
8
2
8
0 111
8
2
8
0 1854
8
2
8
0 272
8
2
8
0 1915
8
2
8
0 1487
8
2
8
0 366
8
2
8
0...

result:

ok 

Test #76:

score: 74.25
Acceptable Answer
time: 56ms
memory: 3852kb

input:

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

output:

8
0 883
8
2
8
0 850
8
2
8
0 604
8
2
8
0 652
8
2
8
0 1084
8
2
8
0 1435
8
2
8
0 308
8
2
8
0 1526
8
2
8
0 371
8
2
8
0 421
8
2
8
0 1385
8
2
8
0 1060
8
2
8
1 1060
8
0 704
8
2
8
0 1714
8
2
8
0 929
8
2
8
1 929
8
0 1511
8
2
8
1 1511
8
0 778
8
2
8
0 386
8
2
8
1 386
8
0 967
8
2
8
0 1747
8
2
8
1 1747
8
0 1847
...

result:

points 0.990 points  0.990

Test #77:

score: 74.42
Acceptable Answer
time: 28ms
memory: 3856kb

input:

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

output:

8
0 594
8
2
8
0 1841
8
2
8
0 199
8
2
8
0 1454
8
2
8
0 889
8
2
8
0 1113
8
2
8
0 1684
8
2
8
0 1041
8
2
8
0 1923
8
2
8
0 1580
8
2
8
0 1142
8
2
8
0 1723
8
2
8
0 364
8
2
8
0 713
8
2
8
0 682
8
2
8
1 682
8
0 1150
8
2
8
0 726
8
2
8
1 726
8
0 123
8
2
8
0 1321
8
2
8
0 849
8
2
8
0 392
8
2
8
1 392
8
0 1204
8
2
...

result:

points 0.99226666670 points  0.99226666670

Test #78:

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

input:

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

output:

8
0 1369
8
2
8
0 1303
8
2
8
0 638
8
2
8
0 1196
8
2
8
0 168
8
2
8
0 148
8
2
8
0 808
8
2
8
0 1913
8
2
8
0 1178
8
2
8
0 473
8
2
8
0 153
8
2
8
0 133
8
2
8
0 1160
8
2
8
0 647
8
2
8
1 647
8
0 686
8
2
8
0 1863
8
2
8
0 290
8
2
8
0 492
8
2
8
0 905
8
2
8
1 905
8
0 1635
8
2
8
0 1951
8
2
8
0 857
8
2
8
0 881
8
2...

result:

ok 

Test #79:

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

input:

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

output:

8
0 1540
8
2
8
0 630
8
2
8
0 837
8
2
8
0 1124
8
2
8
0 1391
8
2
8
0 1018
8
2
8
0 1902
8
2
8
0 1893
8
2
8
0 1227
8
2
8
0 636
8
2
8
0 978
8
2
8
1 978
8
0 495
8
2
8
0 276
8
2
8
1 276
8
0 1068
8
2
8
1 1068
8
0 1000
8
2
8
0 632
8
2
8
0 538
8
2
8
0 770
8
2
8
1 770
8
0 1515
8
2
8
1 1515
8
0 1027
8
2
8
0 957...

result:

ok 

Test #80:

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

input:

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

output:

8
0 356
8
2
8
0 769
8
2
8
0 413
8
2
8
0 993
8
2
8
0 442
8
2
8
0 1033
8
2
8
0 510
8
2
8
0 1849
8
2
8
0 1931
8
2
8
0 794
8
2
8
0 1285
8
2
8
0 137
8
2
8
0 896
8
2
8
0 1689
8
2
8
0 711
8
2
8
0 1072
8
2
8
0 879
8
2
8
0 1837
8
2
8
0 495
8
2
8
0 1593
8
2
8
0 502
8
2
8
0 1850
8
2
8
0 1996
8
2
8
0 1388
8
2
8...

result:

ok 

Test #81:

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

input:

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

output:

8
0 629
8
2
8
0 220
8
2
8
0 520
8
2
8
0 1646
8
2
8
0 780
8
2
8
0 1921
8
2
8
0 1829
8
2
8
0 538
8
2
8
0 82
8
2
8
0 343
8
2
8
0 1096
8
2
8
0 822
8
2
8
0 764
8
2
8
0 125
8
2
8
1 125
8
0 1194
8
2
8
0 836
8
2
8
0 53
8
2
8
0 713
8
2
8
0 137
8
2
8
0 210
8
2
8
0 1905
8
2
8
0 826
8
2
8
0 758
8
2
8
0 1796
8
2...

result:

ok 

Test #82:

score: 74.2
Acceptable Answer
time: 37ms
memory: 3868kb

input:

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

output:

8
0 283
8
2
8
0 205
8
2
8
0 645
8
2
8
0 1271
8
2
8
0 320
8
2
8
0 527
8
2
8
1 527
8
0 616
8
2
8
0 1904
8
2
8
0 1242
8
2
8
0 1317
8
2
8
0 1516
8
2
8
0 532
8
2
8
0 1146
8
2
8
0 1922
8
2
8
0 293
8
2
8
0 89
8
2
8
0 95
8
2
8
0 545
8
2
8
1 545
8
0 607
8
2
8
0 1873
8
2
8
1 1873
8
0 1305
8
2
8
0 1586
8
2
8
0...

result:

points 0.98933333330 points  0.98933333330

Test #83:

score: 74.2
Acceptable Answer
time: 26ms
memory: 3876kb

input:

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

output:

8
0 1487
8
2
8
0 782
8
2
8
0 1430
8
2
8
0 647
8
2
8
0 952
8
2
8
0 1528
8
2
8
0 1811
8
2
8
0 239
8
2
8
0 1700
8
2
8
0 1990
8
2
8
0 421
8
2
8
0 1391
8
2
8
0 1806
8
2
8
0 1835
8
2
8
1 1835
8
0 776
8
2
8
0 897
8
2
8
0 1577
8
2
8
0 1988
8
2
8
1 1988
8
0 1415
8
2
8
0 1392
8
2
8
0 1381
8
2
8
0 771
8
2
8
0 ...

result:

points 0.98933333330 points  0.98933333330

Test #84:

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

input:

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

output:

8
0 271
8
2
8
0 423
8
2
8
0 524
8
2
8
1 524
8
0 177
8
2
8
1 177
8
0 41
8
2
8
1 41
8
0 263
8
2
8
1 263
8
0 102
8
2
8
1 102
8
0 483
8
2
8
1 483
8
0 58
8
2
8
1 58
8
0 59
8
2
8
1 59
8
0 77
8
2
8
1 77
8
0 486
8
2
8
1 486
8
0 361
8
2
8
1 361
8
0 114
8
2
8
1 114
8
0 182
8
2
8
1 182
8
0 214
8
2
8
1 214
8
0 ...

result:

ok 

Test #85:

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

input:

1834
1
2
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1038
8
2
8
0 53
8
2
8
1 53
8
0 985
8
2
8
1 985
8
0 232
8
2
8
1 232
8
0 871
8
2
8
1 871
8
0 1001
8
2
8
1 1001
8
0 44
8
2
8
0 451
8
2
8
0 595
8
2
8
1 595
8
0 417
8
2
8
1 417
8
0 229
8
2
8
1 229
8
0 493
8
2
8
1 493
8
0 749
8
2
8
1 749
8
0 1088
8
2
8
1 1088
8
0 1211
8
2
8
1 1211
8
0 106
8
2
8
1 106
...

result:

ok 

Test #86:

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

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 170
8
2
8
0 316
8
2
8
0 478
8
2
8
1 478
8
0 1978
8
2
8
1 1978
8
0 1859
8
2
8
1 1859
8
0 85
8
2
8
1 85
8
0 162
8
2
8
1 162
8
0 1901
8
2
8
1 1901
8
0 1568
8
2
8
1 1568
8
0 271
8
2
8
1 271
8
0 1752
8
2
8
1 1752
8
0 1488
8
2
8
1 1488
8
0 1898
8
2
8
1 1898
8
0 136
8
2
8
1 136
8
0 1163
8
2
8
1 1163
8
...

result:

ok 

Test #87:

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

input:

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

output:

8
0 499
8
2
8
0 417
8
2
8
1 417
8
0 915
8
2
8
1 915
8
0 707
8
2
8
1 707
8
0 156
8
2
8
1 156
8
0 373
8
2
8
1 373
8
0 1378
8
2
8
0 1305
8
2
8
0 1463
8
2
8
0 1073
8
2
8
0 1478
8
2
8
0 889
8
2
8
1 889
8
0 275
8
2
8
1 275
8
0 81
8
2
8
1 81
8
0 1775
8
2
8
0 670
8
2
8
1 670
8
0 1870
8
2
8
0 881
8
2
8
1 881...

result:

ok 

Test #88:

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

input:

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

output:

8
0 1381
8
2
8
0 625
8
2
8
0 1319
8
2
8
1 1319
8
0 1123
8
2
8
1 1123
8
0 276
8
2
8
0 1590
8
2
8
1 1590
8
0 1378
8
2
8
1 1378
8
0 601
8
2
8
0 851
8
2
8
0 1670
8
2
8
1 1670
8
0 158
8
2
8
0 1092
8
2
8
1 1092
8
0 1987
8
2
8
1 1987
8
0 1146
8
2
8
1 1146
8
0 1777
8
2
8
1 1777
8
0 1131
8
2
8
1 1131
8
0 115...

result:

ok 

Test #89:

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

input:

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

output:

8
0 123
8
2
8
0 1949
8
2
8
1 1949
8
0 127
8
2
8
1 127
8
0 1744
8
2
8
1 1744
8
0 487
8
2
8
1 487
8
0 1403
8
2
8
0 691
8
2
8
0 953
8
2
8
0 1808
8
2
8
1 1808
8
0 99
8
2
8
1 99
8
0 918
8
2
8
0 1633
8
2
8
1 1633
8
0 513
8
2
8
0 556
8
2
8
0 737
8
2
8
0 1725
8
2
8
1 1725
8
0 1452
8
2
8
0 249
8
2
8
1 249
8
...

result:

ok