QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#140413#4565. Rarest Insectssomethingnew#88.47 26ms4088kbC++204.8kb2023-08-15 21:17:082024-07-04 01:44:52

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 01:44:52]
  • 评测
  • 测评结果:88.47
  • 用时:26ms
  • 内存:4088kb
  • [2023-08-15 21:17:08]
  • 提交

answer

//  ↘ ⬇ ⬇ ⬇ ⬇ ⬇ ↙
//  ➡ @roadfromroi ⬅
//  ↗ ⬆ ⬆ ⬆ ⬆ ⬆ ↖
#include <iostream>
#include "vector"
#include "algorithm"
#include "numeric"
#include "climits"
#include "iomanip"
#include "bitset"
#include "cmath"
#include "map"
#include "deque"
#include "array"
#include "set"
#include "random"
#define all(x) x.begin(), x.end()
using namespace std;
#include "insects.h"
mt19937 rnd;
int min_cardinality(int N) {
    vector<int> iba(N);
    for (int i = 0; i < N; ++i) {
        iba[i] = i;
    }
    vector<int> ex(N);
    int timka = 1;
    for (int i = 0; i < N; ++i) {
        swap(iba[i], iba[rnd() % N]);
    }
    for (int i = 0; i < N; ++i) {
        swap(iba[i], iba[rnd() % N]);
    }
    for (int i = 0; i < N; ++i) {
        swap(iba[i], iba[rnd() % N]);
    }
    int cnt = 0;
    int gcnt = 0;
    int prvl = 3;
    int lstch = 0;
    for (int i = 0; i < N; ++i) {
        move_inside(iba[i]);
        if (press_button() == 2) {
            move_outside(iba[i]);
        } else {
            cnt++;
            lstch = i;
            //cerr << "ADD " << i << ' ' << press_button() << endl;
            ex[i] = timka;
        }
    }
    timka++;
    gcnt = cnt * 2;
    cnt = gcnt;
    for (int i = (lstch + 1) % N; i != lstch; i = (i + 1) % N) {
        //cerr << i << endl;
        if (ex[i] == 0) {
            //cerr << i << endl;
            move_inside(iba[i]);
            if (prvl < press_button()) {
                move_outside(iba[i]);
            } else {
                ex[i] = timka;
                cnt--;
                lstch = i;
                if (cnt == 0) {
                    timka++;
                    cnt = gcnt;
                    prvl += 2;
                }
            }
        }
    }
    cnt = gcnt / 2;
    prvl--;
    for (int i = 0; i < N; ++i) {
        if (ex[i] == timka) {
            //cout << i << endl;
            ex[i] = 0;
            move_outside(iba[i]);

        }
    }
    for (int i = 0; i < N; ++i) {
        if (ex[i] == 0) {
            //cerr << i << endl;
            move_inside(iba[i]);
            if (prvl != press_button()) {
                move_outside(iba[i]);
            } else {
                ex[i] = timka;
                cnt--;
                if (cnt == 0) {
                    prvl++;
                    break;
                }
            }
        }
    }
    return prvl - 1;
}
#ifdef __APPLE__

static inline constexpr int kMaxQueries = 40000;

static int N;
// Insect types are compressed to colors in the range [0, N).
static std::vector<int> color;
static std::vector<bool> in_box;

static std::vector<int> color_occurrences;
static std::multiset<int> max_occurrences;

static std::vector<int> op_counter(3, 0);

static inline void protocol_violation(std::string message) {
    printf("Protocol Violation: %s\n", message.c_str());
    exit(0);
}

void move_inside(int i) {
    if (i < 0 || i >= N) {
        protocol_violation("invalid parameter");
    }
    ++op_counter[0];
    if (op_counter[0] > kMaxQueries) {
        protocol_violation("too many calls");
    }
    if (!in_box[i]) {
        in_box[i] = true;
        max_occurrences.erase(max_occurrences.find(color_occurrences[color[i]]));
        ++color_occurrences[color[i]];
        max_occurrences.insert(color_occurrences[color[i]]);
    }
}

void move_outside(int i) {
    if (i < 0 || i >= N) {
        protocol_violation("invalid parameter");
    }
    ++op_counter[1];
    if (op_counter[1] > kMaxQueries) {
        protocol_violation("too many calls");
    }
    if (in_box[i]) {
        in_box[i] = false;
        max_occurrences.erase(max_occurrences.find(color_occurrences[color[i]]));
        --color_occurrences[color[i]];
        max_occurrences.insert(color_occurrences[color[i]]);
    }
}

int press_button() {
    ++op_counter[2];
    if (op_counter[2] > kMaxQueries) {
        protocol_violation("too many calls");
    }
    return *(max_occurrences.rbegin());
}

int main() {
    N=2000;assert(1 == scanf("%d", &N));
    color.resize(N);
    in_box.assign(N, false);

    std::map<int, int> type_to_color;
    for (int i = 0; i < N; ++i) {
        int Ti;
        Ti = i % 6 + 1;
        assert(1 == scanf("%d", &Ti));
        if (type_to_color.find(Ti) == type_to_color.end()) {
            int new_color = type_to_color.size();
            type_to_color[Ti] = new_color;
            max_occurrences.insert(0);
        }
        color[i] = type_to_color[Ti];
    }

    color_occurrences.assign(type_to_color.size(), 0);

    int answer = min_cardinality(N);
    int Q = *std::max_element(op_counter.begin(), op_counter.end());
    printf("%d\n", answer);
    printf("%d\n", Q);
    return 0;
}
#endif

详细

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

6
1
1
2
1
2
2
2
3
3
2
2
3

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2
2
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
2
1
2
2
2
2
3
2
3
2

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

input:

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

output:

8
0 192
8
2
8
0 159
8
2
8
1 159
8
0 28
8
2
8
1 28
8
0 32
8
2
8
1 32
8
0 82
8
2
8
1 82
8
0 134
8
2
8
1 134
8
0 131
8
2
8
1 131
8
0 0
8
2
8
1 0
8
0 83
8
2
8
1 83
8
0 130
8
2
8
1 130
8
0 182
8
2
8
1 182
8
0 61
8
2
8
1 61
8
0 185
8
2
8
1 185
8
0 163
8
2
8
1 163
8
0 5
8
2
8
1 5
8
0 12
8
2
8
1 12
8
0 111
...

result:

ok 

Test #8:

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

input:

200
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

8
0 126
8
2
8
0 161
8
2
8
0 185
8
2
8
0 38
8
2
8
0 109
8
2
8
0 107
8
2
8
0 68
8
2
8
0 47
8
2
8
0 106
8
2
8
0 138
8
2
8
0 32
8
2
8
0 163
8
2
8
0 22
8
2
8
0 178
8
2
8
0 90
8
2
8
0 41
8
2
8
0 198
8
2
8
0 166
8
2
8
0 21
8
2
8
0 193
8
2
8
0 75
8
2
8
0 97
8
2
8
0 76
8
2
8
0 108
8
2
8
0 27
8
2
8
0 9
8
2
8
...

result:

ok 

Test #9:

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

input:

200
1
2
1
1
1
1
1
2
1
1
2
1
2
1
1
2
2
2
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
2
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 161
8
2
8
1 161
8
0 185
8
2
8
0 38
8
2
8
0 109
8
2
8
0 107
8
2
8
0 68
8
2
8
0 47
8
2
8
1 47
8
0 106
8
2
8
0 138
8
2
8
0 32
8
2
8
1 32
8
0 163
8
2
8
0 22
8
2
8
1 22
8
0 178
8
2
8
0 90
8
2
8
0 41
8
2
8
1 41
8
0 198
8
2
8
1 198
8
0 166
8
2
8
1 166
8
0 21
8
2
8
1 21
8
0 193
8
2
8
1 193
8...

result:

ok 

Test #10:

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

input:

198
1
1
1
2
1
2
1
2
1
2
2
2
2
2
1
2
1
2
2
1
2
2
2
2
1
2
2
2
1
2
2
2
1
2
2
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 41
8
2
8
0 183
8
2
8
0 84
8
2
8
0 81
8
2
8
1 81
8
0 195
8
2
8
0 162
8
2
8
1 162
8
0 133
8
2
8
0 141
8
2
8
1 141
8
0 116
8
2
8
0 163
8
2
8
1 163
8
0 15
8
2
8
1 15
8
0 123
8
2
8
1 123
8
0 20
8
2
8
1 20
8
0 79
8
2
8
1 79
8
0 53
8
2
8
0 12
8
2
8
1 12
8
0 46
8
2
8
0 55
8
2
8
1 55
8
0 170
8
2
8
1 170
...

result:

ok 

Test #11:

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

input:

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

output:

8
0 192
8
2
8
0 159
8
2
8
1 159
8
0 28
8
2
8
1 28
8
0 32
8
2
8
1 32
8
0 82
8
2
8
1 82
8
0 134
8
2
8
1 134
8
0 131
8
2
8
1 131
8
0 0
8
2
8
0 83
8
2
8
1 83
8
0 130
8
2
8
1 130
8
0 182
8
2
8
1 182
8
0 61
8
2
8
1 61
8
0 185
8
2
8
1 185
8
0 163
8
2
8
1 163
8
0 5
8
2
8
1 5
8
0 12
8
2
8
1 12
8
0 111
8
2
8
...

result:

ok 

Test #12:

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

input:

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

output:

8
0 179
8
2
8
0 195
8
2
8
0 59
8
2
8
1 59
8
0 92
8
2
8
1 92
8
0 151
8
2
8
1 151
8
0 184
8
2
8
1 184
8
0 97
8
2
8
1 97
8
0 63
8
2
8
0 86
8
2
8
0 112
8
2
8
1 112
8
0 69
8
2
8
1 69
8
0 75
8
2
8
0 193
8
2
8
0 70
8
2
8
0 87
8
2
8
1 87
8
0 13
8
2
8
0 93
8
2
8
0 181
8
2
8
1 181
8
0 147
8
2
8
1 147
8
0 57
8...

result:

ok 

Test #13:

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

input:

197
1
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 179
8
2
8
0 195
8
2
8
0 59
8
2
8
0 92
8
2
8
1 92
8
0 151
8
2
8
1 151
8
0 184
8
2
8
1 184
8
0 97
8
2
8
1 97
8
0 63
8
2
8
1 63
8
0 86
8
2
8
1 86
8
0 112
8
2
8
1 112
8
0 69
8
2
8
1 69
8
0 75
8
2
8
1 75
8
0 193
8
2
8
1 193
8
0 70
8
2
8
1 70
8
0 87
8
2
8
1 87
8
0 13
8
2
8
1 13
8
0 93
8
2
8
1 93
8
0 1...

result:

ok 

Test #14:

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

input:

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

output:

8
0 41
8
2
8
0 183
8
2
8
0 84
8
2
8
0 81
8
2
8
0 195
8
2
8
0 162
8
2
8
1 162
8
0 133
8
2
8
0 141
8
2
8
0 116
8
2
8
1 116
8
0 163
8
2
8
0 15
8
2
8
0 123
8
2
8
0 20
8
2
8
1 20
8
0 79
8
2
8
1 79
8
0 53
8
2
8
1 53
8
0 12
8
2
8
1 12
8
0 46
8
2
8
1 46
8
0 55
8
2
8
0 170
8
2
8
1 170
8
0 121
8
2
8
1 121
8
0...

result:

ok 

Test #15:

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

input:

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

output:

8
0 126
8
2
8
0 161
8
2
8
0 185
8
2
8
1 185
8
0 38
8
2
8
0 109
8
2
8
1 109
8
0 107
8
2
8
1 107
8
0 68
8
2
8
0 47
8
2
8
1 47
8
0 106
8
2
8
0 138
8
2
8
1 138
8
0 32
8
2
8
1 32
8
0 163
8
2
8
1 163
8
0 22
8
2
8
1 22
8
0 178
8
2
8
1 178
8
0 90
8
2
8
1 90
8
0 41
8
2
8
1 41
8
0 198
8
2
8
1 198
8
0 166
8
2
...

result:

ok 

Test #16:

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

input:

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

output:

8
0 160
8
2
8
0 191
8
2
8
1 191
8
0 99
8
2
8
0 111
8
2
8
1 111
8
0 2
8
2
8
0 195
8
2
8
1 195
8
0 194
8
2
8
0 127
8
2
8
1 127
8
0 154
8
2
8
0 150
8
2
8
0 122
8
2
8
1 122
8
0 143
8
2
8
1 143
8
0 76
8
2
8
1 76
8
0 50
8
2
8
0 149
8
2
8
1 149
8
0 182
8
2
8
1 182
8
0 67
8
2
8
1 67
8
0 77
8
2
8
1 77
8
0 16...

result:

ok 

Test #17:

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

input:

199
1
1
1
2
1
1
1
2
2
2
2
2
1
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 192
8
2
8
0 159
8
2
8
0 28
8
2
8
0 32
8
2
8
1 32
8
0 82
8
2
8
0 134
8
2
8
0 131
8
2
8
0 0
8
2
8
1 0
8
0 83
8
2
8
1 83
8
0 130
8
2
8
1 130
8
0 182
8
2
8
1 182
8
0 61
8
2
8
1 61
8
0 185
8
2
8
0 163
8
2
8
1 163
8
0 5
8
2
8
0 12
8
2
8
0 111
8
2
8
1 111
8
0 79
8
2
8
0 49
8
2
8
1 49
8
0 156
8
2
8
1 15...

result:

ok 

Test #18:

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

input:

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

output:

8
0 160
8
2
8
0 191
8
2
8
0 99
8
2
8
0 111
8
2
8
0 2
8
2
8
0 195
8
2
8
1 195
8
0 194
8
2
8
1 194
8
0 127
8
2
8
0 154
8
2
8
1 154
8
0 150
8
2
8
1 150
8
0 122
8
2
8
0 143
8
2
8
1 143
8
0 76
8
2
8
1 76
8
0 50
8
2
8
1 50
8
0 149
8
2
8
0 182
8
2
8
1 182
8
0 67
8
2
8
1 67
8
0 77
8
2
8
1 77
8
0 161
8
2
8
1...

result:

ok 

Test #19:

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

input:

196
1
1
2
1
1
1
1
2
1
2
1
1
2
1
2
1
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 160
8
2
8
0 191
8
2
8
0 99
8
2
8
1 99
8
0 111
8
2
8
0 2
8
2
8
0 195
8
2
8
0 194
8
2
8
0 127
8
2
8
1 127
8
0 154
8
2
8
0 150
8
2
8
1 150
8
0 122
8
2
8
0 143
8
2
8
0 76
8
2
8
1 76
8
0 50
8
2
8
0 149
8
2
8
1 149
8
0 182
8
2
8
0 67
8
2
8
1 67
8
0 77
8
2
8
1 77
8
0 161
8
2
8
1 161
8
0 134
8
2
8
1 134...

result:

ok 

Test #20:

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

input:

196
1
1
1
1
2
1
1
2
1
1
2
2
1
2
1
1
2
1
1
2
1
2
2
2
2
1
2
2
2
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 160
8
2
8
0 191
8
2
8
0 99
8
2
8
0 111
8
2
8
0 2
8
2
8
1 2
8
0 195
8
2
8
0 194
8
2
8
0 127
8
2
8
1 127
8
0 154
8
2
8
0 150
8
2
8
0 122
8
2
8
1 122
8
0 143
8
2
8
1 143
8
0 76
8
2
8
0 50
8
2
8
1 50
8
0 149
8
2
8
0 182
8
2
8
0 67
8
2
8
1 67
8
0 77
8
2
8
0 161
8
2
8
0 134
8
2
8
1 134
8
0 37
8
2
8
0 ...

result:

ok 

Test #21:

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

input:

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

output:

8
0 126
8
2
8
0 161
8
2
8
0 185
8
2
8
0 38
8
2
8
0 109
8
2
8
0 107
8
2
8
0 68
8
2
8
0 47
8
2
8
0 106
8
2
8
0 138
8
2
8
0 32
8
2
8
0 163
8
2
8
0 22
8
2
8
0 178
8
2
8
1 178
8
0 90
8
2
8
1 90
8
0 41
8
2
8
0 198
8
2
8
0 166
8
2
8
0 21
8
2
8
0 193
8
2
8
1 193
8
0 75
8
2
8
0 97
8
2
8
0 76
8
2
8
0 108
8
2
...

result:

ok 

Test #22:

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

input:

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

output:

8
0 192
8
2
8
0 159
8
2
8
0 28
8
2
8
0 32
8
2
8
0 82
8
2
8
0 134
8
2
8
0 131
8
2
8
0 0
8
2
8
0 83
8
2
8
0 130
8
2
8
0 182
8
2
8
0 61
8
2
8
1 61
8
0 185
8
2
8
0 163
8
2
8
1 163
8
0 5
8
2
8
0 12
8
2
8
0 111
8
2
8
0 79
8
2
8
0 49
8
2
8
1 49
8
0 156
8
2
8
0 57
8
2
8
0 136
8
2
8
0 132
8
2
8
1 132
8
0 144...

result:

ok 

Test #23:

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

input:

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

output:

8
0 41
8
2
8
0 183
8
2
8
0 84
8
2
8
0 81
8
2
8
0 195
8
2
8
0 162
8
2
8
0 133
8
2
8
0 141
8
2
8
0 116
8
2
8
0 163
8
2
8
0 15
8
2
8
0 123
8
2
8
0 20
8
2
8
0 79
8
2
8
0 53
8
2
8
0 12
8
2
8
0 46
8
2
8
0 55
8
2
8
0 170
8
2
8
0 121
8
2
8
0 155
8
2
8
0 168
8
2
8
0 115
8
2
8
1 115
8
0 120
8
2
8
0 182
8
2
8
...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 258
8
2
8
0 963
8
2
8
1 963
8
0 485
8
2
8
1 485
8
0 255
8
2
8
1 255
8
0 566
8
2
8
1 566
8
0 822
8
2
8
1 822
8
0 327
8
2
8
1 327
8
0 335
8
2
8
1 335
8
0 454
8
2
8
1 454
8
0 110
8
2
8
1 110
8
0 407
8
2
8
1 407
8
0 401
8
2
8
1 401
8
0 237
8
2
8
1 237
8
0 299
8
2
8
1 299
8
0 882
8
2
8
1 882
8
0 581
...

result:

ok 

Test #25:

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

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 258
8
2
8
0 963
8
2
8
0 485
8
2
8
0 255
8
2
8
0 566
8
2
8
0 822
8
2
8
0 327
8
2
8
0 335
8
2
8
0 454
8
2
8
0 110
8
2
8
0 407
8
2
8
0 401
8
2
8
0 237
8
2
8
0 299
8
2
8
0 882
8
2
8
0 581
8
2
8
0 316
8
2
8
0 420
8
2
8
0 14
8
2
8
0 700
8
2
8
0 70
8
2
8
0 415
8
2
8
0 757
8
2
8
0 363
8
2
8
0 784
8
2
8
...

result:

ok 

Test #26:

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

input:

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

output:

8
0 611
8
2
8
0 851
8
2
8
0 755
8
2
8
0 0
8
2
8
1 0
8
0 828
8
2
8
0 251
8
2
8
0 711
8
2
8
0 802
8
2
8
1 802
8
0 160
8
2
8
0 205
8
2
8
0 554
8
2
8
0 439
8
2
8
0 651
8
2
8
1 651
8
0 474
8
2
8
0 179
8
2
8
0 400
8
2
8
0 307
8
2
8
0 424
8
2
8
0 856
8
2
8
1 856
8
0 198
8
2
8
1 198
8
0 5
8
2
8
1 5
8
0 183
...

result:

ok 

Test #27:

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

input:

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

output:

8
0 611
8
2
8
0 851
8
2
8
0 755
8
2
8
0 0
8
2
8
0 828
8
2
8
0 251
8
2
8
0 711
8
2
8
0 802
8
2
8
0 160
8
2
8
0 205
8
2
8
1 205
8
0 554
8
2
8
1 554
8
0 439
8
2
8
0 651
8
2
8
1 651
8
0 474
8
2
8
1 474
8
0 179
8
2
8
1 179
8
0 400
8
2
8
1 400
8
0 307
8
2
8
0 424
8
2
8
0 856
8
2
8
1 856
8
0 198
8
2
8
0 5
...

result:

ok 

Test #28:

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

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 159
8
2
8
0 634
8
2
8
1 634
8
0 975
8
2
8
1 975
8
0 36
8
2
8
1 36
8
0 22
8
2
8
1 22
8
0 540
8
2
8
1 540
8
0 126
8
2
8
1 126
8
0 707
8
2
8
1 707
8
0 577
8
2
8
1 577
8
0 154
8
2
8
1 154
8
0 304
8
2
8
1 304
8
0 605
8
2
8
1 605
8
0 533
8
2
8
1 533
8
0 692
8
2
8
1 692
8
0 193
8
2
8
1 193
8
0 532
8
2
...

result:

ok 

Test #29:

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

input:

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

output:

8
0 144
8
2
8
0 425
8
2
8
0 169
8
2
8
1 169
8
0 6
8
2
8
1 6
8
0 24
8
2
8
1 24
8
0 163
8
2
8
1 163
8
0 667
8
2
8
1 667
8
0 754
8
2
8
0 923
8
2
8
0 745
8
2
8
1 745
8
0 149
8
2
8
1 149
8
0 259
8
2
8
1 259
8
0 753
8
2
8
0 100
8
2
8
0 179
8
2
8
0 293
8
2
8
1 293
8
0 419
8
2
8
1 419
8
0 752
8
2
8
0 605
8
...

result:

ok 

Test #30:

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

input:

998
1
1
2
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 695
8
2
8
0 597
8
2
8
0 660
8
2
8
1 660
8
0 432
8
2
8
0 794
8
2
8
1 794
8
0 315
8
2
8
1 315
8
0 535
8
2
8
0 249
8
2
8
1 249
8
0 421
8
2
8
1 421
8
0 531
8
2
8
1 531
8
0 133
8
2
8
1 133
8
0 418
8
2
8
1 418
8
0 622
8
2
8
1 622
8
0 37
8
2
8
1 37
8
0 781
8
2
8
1 781
8
0 368
8
2
8
1 368
8
0 252
8
2
8
...

result:

ok 

Test #31:

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

input:

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

output:

8
0 695
8
2
8
0 597
8
2
8
0 660
8
2
8
0 432
8
2
8
0 794
8
2
8
0 315
8
2
8
1 315
8
0 535
8
2
8
0 249
8
2
8
0 421
8
2
8
0 531
8
2
8
0 133
8
2
8
0 418
8
2
8
1 418
8
0 622
8
2
8
0 37
8
2
8
0 781
8
2
8
1 781
8
0 368
8
2
8
0 252
8
2
8
0 893
8
2
8
1 893
8
0 887
8
2
8
0 26
8
2
8
0 851
8
2
8
1 851
8
0 620
8
...

result:

ok 

Test #32:

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

input:

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

output:

8
0 258
8
2
8
0 963
8
2
8
0 485
8
2
8
0 255
8
2
8
1 255
8
0 566
8
2
8
1 566
8
0 822
8
2
8
1 822
8
0 327
8
2
8
1 327
8
0 335
8
2
8
1 335
8
0 454
8
2
8
0 110
8
2
8
1 110
8
0 407
8
2
8
1 407
8
0 401
8
2
8
1 401
8
0 237
8
2
8
1 237
8
0 299
8
2
8
0 882
8
2
8
1 882
8
0 581
8
2
8
1 581
8
0 316
8
2
8
1 316
...

result:

ok 

Test #33:

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

input:

996
1
1
1
1
2
1
2
1
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 159
8
2
8
0 634
8
2
8
0 975
8
2
8
0 36
8
2
8
0 22
8
2
8
1 22
8
0 540
8
2
8
0 126
8
2
8
1 126
8
0 707
8
2
8
0 577
8
2
8
0 154
8
2
8
1 154
8
0 304
8
2
8
0 605
8
2
8
1 605
8
0 533
8
2
8
1 533
8
0 692
8
2
8
1 692
8
0 193
8
2
8
1 193
8
0 532
8
2
8
1 532
8
0 844
8
2
8
1 844
8
0 377
8
2
8
1 377
8
0 681...

result:

ok 

Test #34:

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

input:

1000
1
1
1
1
1
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 258
8
2
8
0 963
8
2
8
0 485
8
2
8
0 255
8
2
8
0 566
8
2
8
0 822
8
2
8
1 822
8
0 327
8
2
8
0 335
8
2
8
1 335
8
0 454
8
2
8
1 454
8
0 110
8
2
8
0 407
8
2
8
1 407
8
0 401
8
2
8
0 237
8
2
8
1 237
8
0 299
8
2
8
0 882
8
2
8
1 882
8
0 581
8
2
8
1 581
8
0 316
8
2
8
1 316
8
0 420
8
2
8
1 420
8
0 14
8
2
8...

result:

ok 

Test #35:

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

input:

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

output:

8
0 258
8
2
8
0 963
8
2
8
0 485
8
2
8
0 255
8
2
8
0 566
8
2
8
0 822
8
2
8
0 327
8
2
8
1 327
8
0 335
8
2
8
0 454
8
2
8
0 110
8
2
8
1 110
8
0 407
8
2
8
1 407
8
0 401
8
2
8
1 401
8
0 237
8
2
8
1 237
8
0 299
8
2
8
1 299
8
0 882
8
2
8
0 581
8
2
8
1 581
8
0 316
8
2
8
1 316
8
0 420
8
2
8
0 14
8
2
8
1 14
8
...

result:

ok 

Test #36:

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

input:

997
1
1
1
2
1
1
1
2
1
1
1
1
1
2
2
2
1
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 169
8
2
8
0 887
8
2
8
0 452
8
2
8
1 452
8
0 188
8
2
8
0 471
8
2
8
0 473
8
2
8
0 965
8
2
8
1 965
8
0 929
8
2
8
0 462
8
2
8
0 334
8
2
8
0 617
8
2
8
0 164
8
2
8
0 820
8
2
8
1 820
8
0 263
8
2
8
1 263
8
0 609
8
2
8
1 609
8
0 122
8
2
8
0 56
8
2
8
1 56
8
0 480
8
2
8
0 343
8
2
8
1 343
8
0 46...

result:

ok 

Test #37:

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

input:

995
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
2
1
1
2
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
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 144
8
2
8
0 425
8
2
8
0 169
8
2
8
0 6
8
2
8
0 24
8
2
8
0 163
8
2
8
0 667
8
2
8
1 667
8
0 754
8
2
8
0 923
8
2
8
0 745
8
2
8
0 149
8
2
8
0 259
8
2
8
0 753
8
2
8
0 100
8
2
8
0 179
8
2
8
1 179
8
0 293
8
2
8
1 293
8
0 419
8
2
8
1 419
8
0 752
8
2
8
0 605
8
2
8
0 483
8
2
8
1 483
8
0 276
8
2
8
1 276
8
0...

result:

ok 

Test #38:

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

input:

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

output:

8
0 189
8
2
8
0 169
8
2
8
0 887
8
2
8
0 452
8
2
8
0 188
8
2
8
0 471
8
2
8
0 473
8
2
8
0 965
8
2
8
0 929
8
2
8
0 462
8
2
8
1 462
8
0 334
8
2
8
0 617
8
2
8
0 164
8
2
8
0 820
8
2
8
0 263
8
2
8
0 609
8
2
8
0 122
8
2
8
0 56
8
2
8
0 480
8
2
8
0 343
8
2
8
1 343
8
0 465
8
2
8
1 465
8
0 893
8
2
8
0 347
8
2
8...

result:

ok 

Test #39:

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

input:

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

output:

8
0 189
8
2
8
0 169
8
2
8
0 887
8
2
8
0 452
8
2
8
0 188
8
2
8
0 471
8
2
8
0 473
8
2
8
0 965
8
2
8
0 929
8
2
8
1 929
8
0 462
8
2
8
1 462
8
0 334
8
2
8
0 617
8
2
8
0 164
8
2
8
0 820
8
2
8
0 263
8
2
8
0 609
8
2
8
0 122
8
2
8
0 56
8
2
8
0 480
8
2
8
0 343
8
2
8
0 465
8
2
8
0 893
8
2
8
1 893
8
0 347
8
2
8...

result:

ok 

Test #40:

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

input:

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

output:

8
0 159
8
2
8
0 634
8
2
8
0 975
8
2
8
0 36
8
2
8
0 22
8
2
8
0 540
8
2
8
0 126
8
2
8
0 707
8
2
8
0 577
8
2
8
0 154
8
2
8
1 154
8
0 304
8
2
8
0 605
8
2
8
0 533
8
2
8
0 692
8
2
8
0 193
8
2
8
0 532
8
2
8
0 844
8
2
8
0 377
8
2
8
0 681
8
2
8
0 314
8
2
8
0 578
8
2
8
0 896
8
2
8
0 245
8
2
8
1 245
8
0 813
8
...

result:

ok 

Test #41:

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

output:

8
0 144
8
2
8
0 425
8
2
8
0 169
8
2
8
0 6
8
2
8
0 24
8
2
8
0 163
8
2
8
0 667
8
2
8
0 754
8
2
8
0 923
8
2
8
0 745
8
2
8
0 149
8
2
8
0 259
8
2
8
0 753
8
2
8
0 100
8
2
8
0 179
8
2
8
0 293
8
2
8
0 419
8
2
8
0 752
8
2
8
1 752
8
0 605
8
2
8
0 483
8
2
8
0 276
8
2
8
0 940
8
2
8
0 239
8
2
8
0 824
8
2
8
0 663...

result:

ok 

Test #42:

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

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

output:

8
0 144
8
2
8
0 425
8
2
8
0 169
8
2
8
0 6
8
2
8
0 24
8
2
8
0 163
8
2
8
0 667
8
2
8
0 754
8
2
8
0 923
8
2
8
0 745
8
2
8
0 149
8
2
8
0 259
8
2
8
0 753
8
2
8
0 100
8
2
8
0 179
8
2
8
0 293
8
2
8
0 419
8
2
8
0 752
8
2
8
0 605
8
2
8
0 483
8
2
8
0 276
8
2
8
0 940
8
2
8
0 239
8
2
8
0 824
8
2
8
0 663
8
2
8
0...

result:

ok 

Subtask #3:

score: 63.47
Acceptable Answer

Test #43:

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

input:

2
1
2
2
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
1
2
2
2

output:

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

result:

ok 

Test #46:

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

input:

6
1
2
2
2
1
2
2
3
4
4
2
3
3
3

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 473
8
2
8
0 1211
8
2
8
1 1211
8
0 1229
8
2
8
1 1229
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
1 361
8
0 633
8
2
8
1 633
8
0 40
8
2
8
1 40
8
0 1703
8
2
8
1 1703
8
0 862
8
2
8
1 862
8
0 216
8
2
8
1 216
8
0 452
8
2
8
1 452
8
0 579
8
2
8
1 579
8
0 773
8
2
8
1 773
8
0 244
8
2
8
1 244
8
0 189
8
2
8
1 189
8
...

result:

ok 

Test #49:

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

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 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
0 159
8
2
8
0 1628
8
2
8
0 580
8
2
8
0 1303
8
2
8
0 362
8
2
8
0 2...

result:

ok 

Test #50:

score: 70.03
Acceptable Answer
time: 7ms
memory: 3812kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
1 40
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
0 159
8
2
8
0 1628
8
2
8
0 580
8
2
8
1 580
8
0 1303
8
2
8
...

result:

points 0.93373333330 points  0.93373333330

Test #51:

score: 63.47
Acceptable Answer
time: 8ms
memory: 3768kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
1 633
8
0 40
8
2
8
0 1703
8
2
8
1 1703
8
0 862
8
2
8
0 216
8
2
8
1 216
8
0 452
8
2
8
1 452
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
0 840
8
2
8
1 840
8
0 712
8
2
8
0 1142
8
2
8
0 159
8
2
8
0 1628
8
2
8...

result:

points 0.84626666670 points  0.84626666670

Test #52:

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

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 473
8
2
8
0 1211
8
2
8
1 1211
8
0 1229
8
2
8
1 1229
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
1 361
8
0 633
8
2
8
1 633
8
0 40
8
2
8
1 40
8
0 1703
8
2
8
1 1703
8
0 862
8
2
8
1 862
8
0 216
8
2
8
1 216
8
0 452
8
2
8
1 452
8
0 579
8
2
8
1 579
8
0 773
8
2
8
1 773
8
0 244
8
2
8
1 244
8
0 189
8
2
8
1 189
8
...

result:

ok 

Test #53:

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

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
1 361
8
0 633
8
2
8
1 633
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
1 216
8
0 452
8
2
8
0 579
8
2
8
1 579
8
0 773
8
2
8
1 773
8
0 244
8
2
8
1 244
8
0 189
8
2
8
0 1037
8
2
8
1 1037
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8...

result:

ok 

Test #54:

score: 72.27
Acceptable Answer
time: 4ms
memory: 3784kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
1 361
8
0 633
8
2
8
1 633
8
0 40
8
2
8
1 40
8
0 1703
8
2
8
0 862
8
2
8
1 862
8
0 216
8
2
8
1 216
8
0 452
8
2
8
1 452
8
0 579
8
2
8
1 579
8
0 773
8
2
8
1 773
8
0 244
8
2
8
1 244
8
0 189
8
2
8
1 189
8
0 1037
8
2
8
1 1037
8
0 840...

result:

points 0.96360 points  0.96360

Test #55:

score: 74.7
Acceptable Answer
time: 11ms
memory: 3812kb

input:

2000
1
1
1
1
1
2
1
1
1
1
1
1
1
1
1
1
1
1
2
2
1
1
1
1
2
2
2
2
1
1
1
2
2
2
2
2
2
1
1
1
2
2
2
2
2
2
1
2
2
1
1
2
1
2
2
2
1
1
1
2
2
1
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
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
2
2
2
2
2
2
2
2
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 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
1 633
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
1 1142
8
0 159
8
2
8
1 159
8
0 1628
8
2
8
0 580
8
2
8
0 1...

result:

points 0.9960 points  0.9960

Test #56:

score: 71.35
Acceptable Answer
time: 12ms
memory: 4052kb

input:

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

output:

8
0 677
8
2
8
0 1577
8
2
8
0 1978
8
2
8
1 1978
8
0 1314
8
2
8
1 1314
8
0 938
8
2
8
0 1387
8
2
8
1 1387
8
0 835
8
2
8
0 871
8
2
8
1 871
8
0 507
8
2
8
0 286
8
2
8
1 286
8
0 1367
8
2
8
1 1367
8
0 576
8
2
8
1 576
8
0 1183
8
2
8
1 1183
8
0 1689
8
2
8
1 1689
8
0 312
8
2
8
1 312
8
0 497
8
2
8
1 497
8
0 130...

result:

points 0.95133333330 points  0.95133333330

Test #57:

score: 69.52
Acceptable Answer
time: 19ms
memory: 4088kb

input:

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

output:

8
0 1850
8
2
8
0 800
8
2
8
0 303
8
2
8
1 303
8
0 180
8
2
8
0 381
8
2
8
0 1650
8
2
8
0 355
8
2
8
1 355
8
0 1837
8
2
8
0 1142
8
2
8
1 1142
8
0 1073
8
2
8
1 1073
8
0 1244
8
2
8
0 1353
8
2
8
1 1353
8
0 1599
8
2
8
1 1599
8
0 1731
8
2
8
1 1731
8
0 861
8
2
8
1 861
8
0 1203
8
2
8
1 1203
8
0 242
8
2
8
1 242
...

result:

points 0.92693333330 points  0.92693333330

Test #58:

score: 68.37
Acceptable Answer
time: 14ms
memory: 3868kb

input:

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

output:

8
0 743
8
2
8
0 1151
8
2
8
0 1384
8
2
8
0 991
8
2
8
0 220
8
2
8
0 882
8
2
8
0 1405
8
2
8
0 648
8
2
8
1 648
8
0 1100
8
2
8
0 388
8
2
8
1 388
8
0 1626
8
2
8
0 373
8
2
8
1 373
8
0 879
8
2
8
0 1617
8
2
8
1 1617
8
0 942
8
2
8
1 942
8
0 1401
8
2
8
1 1401
8
0 1013
8
2
8
1 1013
8
0 266
8
2
8
1 266
8
0 1598
...

result:

points 0.91160 points  0.91160

Test #59:

score: 68.65
Acceptable Answer
time: 13ms
memory: 4048kb

input:

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

output:

8
0 677
8
2
8
0 1577
8
2
8
0 1978
8
2
8
0 1314
8
2
8
0 938
8
2
8
1 938
8
0 1387
8
2
8
0 835
8
2
8
0 871
8
2
8
0 507
8
2
8
0 286
8
2
8
1 286
8
0 1367
8
2
8
1 1367
8
0 576
8
2
8
0 1183
8
2
8
1 1183
8
0 1689
8
2
8
0 312
8
2
8
1 312
8
0 497
8
2
8
1 497
8
0 1305
8
2
8
0 1473
8
2
8
1 1473
8
0 1614
8
2
8
1...

result:

points 0.91533333330 points  0.91533333330

Test #60:

score: 68.14
Acceptable Answer
time: 11ms
memory: 3816kb

input:

1996
1
1
1
1
1
2
1
2
2
2
2
2
1
2
1
1
2
2
1
1
2
2
2
1
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2...

output:

8
0 1668
8
2
8
0 312
8
2
8
0 1545
8
2
8
0 1123
8
2
8
0 1848
8
2
8
0 409
8
2
8
1 409
8
0 173
8
2
8
0 1106
8
2
8
1 1106
8
0 1316
8
2
8
1 1316
8
0 713
8
2
8
1 713
8
0 226
8
2
8
1 226
8
0 125
8
2
8
1 125
8
0 815
8
2
8
0 1792
8
2
8
1 1792
8
0 1993
8
2
8
0 1787
8
2
8
0 1558
8
2
8
1 1558
8
0 680
8
2
8
1 68...

result:

points 0.90853333330 points  0.90853333330

Test #61:

score: 65.93
Acceptable Answer
time: 0ms
memory: 3872kb

input:

2000
1
1
1
2
1
1
1
2
1
1
1
1
2
2
2
2
1
1
2
2
1
2
1
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
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
1 1703
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
1 773
8
0 244
8
2
8
1 244
8
0 189
8
2
8
1 189
8
0 1037
8
2
8
1 1037
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
1 1142
8
0 159...

result:

points 0.87906666670 points  0.87906666670

Test #62:

score: 70.16
Acceptable Answer
time: 5ms
memory: 3792kb

input:

1998
1
1
1
1
1
2
1
1
1
1
1
1
1
1
2
1
2
1
1
1
2
2
2
1
2
1
2
1
1
1
1
2
2
1
2
2
1
2
1
1
2
1
1
2
1
2
1
2
2
1
1
2
2
1
2
2
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
1
2
1
1
2
2
2
2
2
1
2
2
1
2
2
2
2
2
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
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 677
8
2
8
0 1577
8
2
8
0 1978
8
2
8
0 1314
8
2
8
0 938
8
2
8
0 1387
8
2
8
1 1387
8
0 835
8
2
8
0 871
8
2
8
0 507
8
2
8
0 286
8
2
8
0 1367
8
2
8
0 576
8
2
8
0 1183
8
2
8
0 1689
8
2
8
0 312
8
2
8
1 312
8
0 497
8
2
8
0 1305
8
2
8
1 1305
8
0 1473
8
2
8
0 1614
8
2
8
0 1020
8
2
8
0 1252
8
2
8
1 1252
8...

result:

points 0.93546666670 points  0.93546666670

Test #63:

score: 72.63
Acceptable Answer
time: 13ms
memory: 4072kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
0 159
8
2
8
1 159
8
0 1628
8
2
8
0 580
8
2
8
0 1303
8
2
8
0 362
8...

result:

points 0.96840 points  0.96840

Test #64:

score: 73.21
Acceptable Answer
time: 12ms
memory: 3884kb

input:

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

output:

8
0 497
8
2
8
0 1517
8
2
8
0 339
8
2
8
0 1506
8
2
8
0 1928
8
2
8
0 378
8
2
8
0 296
8
2
8
0 1675
8
2
8
0 798
8
2
8
0 1475
8
2
8
0 245
8
2
8
1 245
8
0 659
8
2
8
0 1540
8
2
8
0 1703
8
2
8
0 874
8
2
8
0 12
8
2
8
0 423
8
2
8
0 605
8
2
8
1 605
8
0 729
8
2
8
0 1874
8
2
8
0 122
8
2
8
1 122
8
0 559
8
2
8
0 1...

result:

points 0.97613333330 points  0.97613333330

Test #65:

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

input:

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

output:

8
0 1850
8
2
8
0 800
8
2
8
0 303
8
2
8
0 180
8
2
8
0 381
8
2
8
0 1650
8
2
8
0 355
8
2
8
0 1837
8
2
8
0 1142
8
2
8
0 1073
8
2
8
1 1073
8
0 1244
8
2
8
0 1353
8
2
8
0 1599
8
2
8
0 1731
8
2
8
0 861
8
2
8
0 1203
8
2
8
0 242
8
2
8
0 441
8
2
8
0 56
8
2
8
0 1868
8
2
8
0 457
8
2
8
0 1412
8
2
8
0 1556
8
2
8
0...

result:

ok 

Test #66:

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

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

output:

8
0 677
8
2
8
0 1577
8
2
8
0 1978
8
2
8
0 1314
8
2
8
0 938
8
2
8
0 1387
8
2
8
0 835
8
2
8
0 871
8
2
8
0 507
8
2
8
0 286
8
2
8
0 1367
8
2
8
0 576
8
2
8
0 1183
8
2
8
0 1689
8
2
8
0 312
8
2
8
0 497
8
2
8
0 1305
8
2
8
0 1473
8
2
8
0 1614
8
2
8
0 1020
8
2
8
0 1252
8
2
8
0 706
8
2
8
0 335
8
2
8
0 1516
8
2...

result:

ok 

Test #67:

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

input:

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

output:

8
0 1850
8
2
8
0 800
8
2
8
0 303
8
2
8
0 180
8
2
8
0 381
8
2
8
0 1650
8
2
8
0 355
8
2
8
0 1837
8
2
8
0 1142
8
2
8
0 1073
8
2
8
0 1244
8
2
8
0 1353
8
2
8
0 1599
8
2
8
0 1731
8
2
8
0 861
8
2
8
0 1203
8
2
8
0 242
8
2
8
0 441
8
2
8
0 56
8
2
8
0 1868
8
2
8
0 457
8
2
8
0 1412
8
2
8
0 1556
8
2
8
0 112
8
2
...

result:

ok 

Test #68:

score: 71.61
Acceptable Answer
time: 12ms
memory: 4044kb

input:

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

output:

8
0 879
8
2
8
0 918
8
2
8
0 1638
8
2
8
0 915
8
2
8
0 197
8
2
8
0 1925
8
2
8
0 5
8
2
8
0 1143
8
2
8
0 707
8
2
8
0 270
8
2
8
0 416
8
2
8
0 403
8
2
8
0 1609
8
2
8
0 1753
8
2
8
0 1720
8
2
8
0 1042
8
2
8
0 447
8
2
8
1 447
8
0 508
8
2
8
0 1909
8
2
8
0 888
8
2
8
1 888
8
0 378
8
2
8
0 939
8
2
8
0 6
8
2
8
1 ...

result:

points 0.95480 points  0.95480

Test #69:

score: 71.37
Acceptable Answer
time: 16ms
memory: 4080kb

input:

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

output:

8
0 879
8
2
8
0 918
8
2
8
0 1638
8
2
8
0 915
8
2
8
0 197
8
2
8
0 1925
8
2
8
0 5
8
2
8
0 1143
8
2
8
0 707
8
2
8
0 270
8
2
8
0 416
8
2
8
0 403
8
2
8
0 1609
8
2
8
0 1753
8
2
8
0 1720
8
2
8
0 1042
8
2
8
0 447
8
2
8
1 447
8
0 508
8
2
8
0 1909
8
2
8
0 888
8
2
8
1 888
8
0 378
8
2
8
0 939
8
2
8
0 6
8
2
8
1 ...

result:

points 0.95160 points  0.95160

Test #70:

score: 67.69
Acceptable Answer
time: 0ms
memory: 3796kb

input:

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

output:

8
0 879
8
2
8
0 918
8
2
8
0 1638
8
2
8
0 915
8
2
8
0 197
8
2
8
0 1925
8
2
8
0 5
8
2
8
0 1143
8
2
8
0 707
8
2
8
1 707
8
0 270
8
2
8
1 270
8
0 416
8
2
8
0 403
8
2
8
0 1609
8
2
8
1 1609
8
0 1753
8
2
8
0 1720
8
2
8
1 1720
8
0 1042
8
2
8
0 447
8
2
8
1 447
8
0 508
8
2
8
0 1909
8
2
8
0 888
8
2
8
0 378
8
2
...

result:

points 0.90253333330 points  0.90253333330

Test #71:

score: 68.04
Acceptable Answer
time: 26ms
memory: 4072kb

input:

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

output:

8
0 879
8
2
8
0 918
8
2
8
0 1638
8
2
8
0 915
8
2
8
0 197
8
2
8
0 1925
8
2
8
0 5
8
2
8
0 1143
8
2
8
0 707
8
2
8
0 270
8
2
8
1 270
8
0 416
8
2
8
0 403
8
2
8
0 1609
8
2
8
1 1609
8
0 1753
8
2
8
0 1720
8
2
8
1 1720
8
0 1042
8
2
8
0 447
8
2
8
1 447
8
0 508
8
2
8
0 1909
8
2
8
0 888
8
2
8
0 378
8
2
8
0 939
...

result:

points 0.90720 points  0.90720

Test #72:

score: 68.34
Acceptable Answer
time: 0ms
memory: 3792kb

input:

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

output:

8
0 733
8
2
8
0 1022
8
2
8
0 401
8
2
8
0 438
8
2
8
1 438
8
0 1563
8
2
8
0 1668
8
2
8
0 752
8
2
8
0 548
8
2
8
0 341
8
2
8
0 237
8
2
8
0 1470
8
2
8
0 1395
8
2
8
0 1679
8
2
8
0 1405
8
2
8
0 1412
8
2
8
0 586
8
2
8
1 586
8
0 1821
8
2
8
0 605
8
2
8
0 90
8
2
8
0 435
8
2
8
0 1358
8
2
8
1 1358
8
0 1877
8
2
8...

result:

points 0.91120 points  0.91120

Test #73:

score: 68.32
Acceptable Answer
time: 19ms
memory: 3812kb

input:

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

output:

8
0 733
8
2
8
0 1022
8
2
8
0 401
8
2
8
0 438
8
2
8
0 1563
8
2
8
0 1668
8
2
8
0 752
8
2
8
1 752
8
0 548
8
2
8
0 341
8
2
8
0 237
8
2
8
1 237
8
0 1470
8
2
8
0 1395
8
2
8
0 1679
8
2
8
0 1405
8
2
8
0 1412
8
2
8
0 586
8
2
8
0 1821
8
2
8
0 605
8
2
8
0 90
8
2
8
1 90
8
0 435
8
2
8
1 435
8
0 1358
8
2
8
0 1877...

result:

points 0.91093333330 points  0.91093333330

Test #74:

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

input:

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

output:

8
0 1564
8
2
8
0 628
8
2
8
0 523
8
2
8
0 194
8
2
8
0 1239
8
2
8
0 661
8
2
8
0 1190
8
2
8
0 1074
8
2
8
1 1074
8
0 560
8
2
8
0 610
8
2
8
1 610
8
0 1472
8
2
8
0 443
8
2
8
0 72
8
2
8
0 1854
8
2
8
0 1549
8
2
8
0 1197
8
2
8
0 60
8
2
8
0 1859
8
2
8
0 1173
8
2
8
0 476
8
2
8
0 1122
8
2
8
1 1122
8
0 263
8
2
8...

result:

ok 

Test #75:

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

input:

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

output:

8
0 1564
8
2
8
0 628
8
2
8
0 523
8
2
8
0 194
8
2
8
0 1239
8
2
8
0 661
8
2
8
0 1190
8
2
8
0 1074
8
2
8
1 1074
8
0 560
8
2
8
0 610
8
2
8
1 610
8
0 1472
8
2
8
0 443
8
2
8
0 72
8
2
8
0 1854
8
2
8
0 1549
8
2
8
0 1197
8
2
8
0 60
8
2
8
0 1859
8
2
8
0 1173
8
2
8
0 476
8
2
8
0 1122
8
2
8
1 1122
8
0 263
8
2
8...

result:

ok 

Test #76:

score: 69.97
Acceptable Answer
time: 4ms
memory: 3812kb

input:

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

output:

8
0 10
8
2
8
0 30
8
2
8
0 1717
8
2
8
0 669
8
2
8
0 1147
8
2
8
1 1147
8
0 1650
8
2
8
0 1909
8
2
8
0 1389
8
2
8
0 1512
8
2
8
1 1512
8
0 1840
8
2
8
0 779
8
2
8
0 893
8
2
8
1 893
8
0 454
8
2
8
0 1707
8
2
8
1 1707
8
0 39
8
2
8
0 585
8
2
8
0 1841
8
2
8
0 610
8
2
8
0 373
8
2
8
0 481
8
2
8
0 909
8
2
8
1 909...

result:

points 0.93293333330 points  0.93293333330

Test #77:

score: 70.52
Acceptable Answer
time: 3ms
memory: 4076kb

input:

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

output:

8
0 10
8
2
8
0 30
8
2
8
0 1717
8
2
8
0 669
8
2
8
0 1147
8
2
8
0 1650
8
2
8
0 1909
8
2
8
0 1389
8
2
8
0 1512
8
2
8
0 1840
8
2
8
0 779
8
2
8
0 893
8
2
8
1 893
8
0 454
8
2
8
0 1707
8
2
8
1 1707
8
0 39
8
2
8
0 585
8
2
8
0 1841
8
2
8
0 610
8
2
8
0 373
8
2
8
0 481
8
2
8
0 909
8
2
8
0 1036
8
2
8
0 873
8
2
...

result:

points 0.94026666670 points  0.94026666670

Test #78:

score: 70.18
Acceptable Answer
time: 12ms
memory: 4044kb

input:

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

output:

8
0 1030
8
2
8
0 1228
8
2
8
0 548
8
2
8
0 1234
8
2
8
0 347
8
2
8
0 838
8
2
8
0 1720
8
2
8
0 809
8
2
8
0 741
8
2
8
0 1453
8
2
8
0 521
8
2
8
0 73
8
2
8
0 186
8
2
8
1 186
8
0 1148
8
2
8
1 1148
8
0 464
8
2
8
0 508
8
2
8
0 925
8
2
8
0 249
8
2
8
0 1308
8
2
8
0 413
8
2
8
0 927
8
2
8
1 927
8
0 272
8
2
8
1 2...

result:

points 0.93573333330 points  0.93573333330

Test #79:

score: 70.72
Acceptable Answer
time: 4ms
memory: 3784kb

input:

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

output:

8
0 1030
8
2
8
0 1228
8
2
8
0 548
8
2
8
0 1234
8
2
8
0 347
8
2
8
0 838
8
2
8
0 1720
8
2
8
0 809
8
2
8
0 741
8
2
8
0 1453
8
2
8
0 521
8
2
8
0 73
8
2
8
0 186
8
2
8
1 186
8
0 1148
8
2
8
1 1148
8
0 464
8
2
8
0 508
8
2
8
0 925
8
2
8
0 249
8
2
8
0 1308
8
2
8
0 413
8
2
8
0 927
8
2
8
1 927
8
0 272
8
2
8
1 2...

result:

points 0.94293333330 points  0.94293333330

Test #80:

score: 72.26
Acceptable Answer
time: 4ms
memory: 4076kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
1 244
8
0 189
8
2
8
0 1037
8
2
8
1 1037
8
0 840
8
2
8
0 712
8
2
8
1 712
8
0 1142
8
2
8
0 159
8
2
8
0 1628
8
2
8
0 580
8
2
8
0 1...

result:

points 0.96346666670 points  0.96346666670

Test #81:

score: 71.9
Acceptable Answer
time: 3ms
memory: 3720kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
1 244
8
0 189
8
2
8
0 1037
8
2
8
1 1037
8
0 840
8
2
8
0 712
8
2
8
1 712
8
0 1142
8
2
8
0 159
8
2
8
0 1628
8
2
8
0 580
8
2
8
0 1...

result:

points 0.95866666670 points  0.95866666670

Test #82:

score: 71.08
Acceptable Answer
time: 10ms
memory: 4044kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
1 1037
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
1 1142
8
0 159
8
2
8
0 1628
8
2
8
1 1628
8
0 580
8
2
8
0...

result:

points 0.94773333330 points  0.94773333330

Test #83:

score: 70.28
Acceptable Answer
time: 11ms
memory: 4088kb

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
1 1037
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
1 1142
8
0 159
8
2
8
0 1628
8
2
8
0 580
8
2
8
0 1303
8
2...

result:

points 0.93706666670 points  0.93706666670

Test #84:

score: 71.09
Acceptable Answer
time: 3ms
memory: 3796kb

input:

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

output:

8
0 65
8
2
8
0 488
8
2
8
1 488
8
0 350
8
2
8
1 350
8
0 478
8
2
8
1 478
8
0 324
8
2
8
0 77
8
2
8
1 77
8
0 53
8
2
8
1 53
8
0 381
8
2
8
1 381
8
0 487
8
2
8
1 487
8
0 393
8
2
8
1 393
8
0 396
8
2
8
1 396
8
0 474
8
2
8
1 474
8
0 121
8
2
8
1 121
8
0 8
8
2
8
1 8
8
0 155
8
2
8
1 155
8
0 16
8
2
8
1 16
8
0 332...

result:

points 0.94786666670 points  0.94786666670

Test #85:

score: 72.91
Acceptable Answer
time: 3ms
memory: 3784kb

input:

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

output:

8
0 113
8
2
8
0 1331
8
2
8
1 1331
8
0 214
8
2
8
1 214
8
0 665
8
2
8
1 665
8
0 273
8
2
8
0 484
8
2
8
1 484
8
0 1111
8
2
8
1 1111
8
0 1086
8
2
8
1 1086
8
0 1586
8
2
8
1 1586
8
0 1508
8
2
8
1 1508
8
0 1807
8
2
8
1 1807
8
0 783
8
2
8
1 783
8
0 1789
8
2
8
1 1789
8
0 443
8
2
8
1 443
8
0 325
8
2
8
1 325
8
...

result:

points 0.97213333330 points  0.97213333330

Test #86:

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

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
1 1211
8
0 1229
8
2
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
1 361
8
0 633
8
2
8
1 633
8
0 40
8
2
8
1 40
8
0 1703
8
2
8
1 1703
8
0 862
8
2
8
1 862
8
0 216
8
2
8
1 216
8
0 452
8
2
8
1 452
8
0 579
8
2
8
1 579
8
0 773
8
2
8
1 773
8
0 244
8
2
8
1 244
8
0 189
8
2
8
1 189
8
0 1037
8
...

result:

ok 

Test #87:

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

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
0 361
8
2
8
1 361
8
0 633
8
2
8
1 633
8
0 40
8
2
8
1 40
8
0 1703
8
2
8
0 862
8
2
8
1 862
8
0 216
8
2
8
1 216
8
0 452
8
2
8
1 452
8
0 579
8
2
8
1 579
8
0 773
8
2
8
1 773
8
0 244
8
2
8
1 244
8
0 189
8
2
8
1 189
8
0 1037
8
2
8
0 840
8
2
8
1 840
8
0 7...

result:

ok 

Test #88:

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

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
1 1229
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
0 633
8
2
8
0 40
8
2
8
0 1703
8
2
8
1 1703
8
0 862
8
2
8
0 216
8
2
8
0 452
8
2
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
0 189
8
2
8
0 1037
8
2
8
1 1037
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
1 1142
8
0 159
8
2
8
0 1628
8...

result:

ok 

Test #89:

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

input:

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

output:

8
0 473
8
2
8
0 1211
8
2
8
0 1229
8
2
8
0 1707
8
2
8
1 1707
8
0 361
8
2
8
1 361
8
0 633
8
2
8
0 40
8
2
8
1 40
8
0 1703
8
2
8
1 1703
8
0 862
8
2
8
0 216
8
2
8
1 216
8
0 452
8
2
8
1 452
8
0 579
8
2
8
0 773
8
2
8
0 244
8
2
8
1 244
8
0 189
8
2
8
1 189
8
0 1037
8
2
8
0 840
8
2
8
0 712
8
2
8
0 1142
8
2
8
...

result:

ok