QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#537979#4565. Rarest InsectsYahia_Emara#25 40ms10312kbC++202.3kb2024-08-30 20:25:292024-08-30 20:25:30

Judging History

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

  • [2024-08-30 20:25:30]
  • 评测
  • 测评结果:25
  • 用时:40ms
  • 内存:10312kb
  • [2024-08-30 20:25:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define sz(x) int(x.size())
#define dbg(x) cout << (#x) << " : " << x << endl
#define pb push_back
#define bk(x) x.back()
#define all(x) x.begin(),x.end()
#define LOOP(n) for(int rp=0;rp<n;rp++)
#define sq(x) ((x)*(x))
typedef long long ll;
typedef long double dl;
const int SZ=5e5+7;
const ll INF=1e18+7;
const dl eps=1e-9;
int MOD=1e9+7;
mt19937_64 rng(time(0));
int rnd(int l,int r){
    return uniform_int_distribution<int>(l,r)(rng);
}
ll trig(ll x){
    return x*(x+1)/2;
}
int getN(){
    int n;cin >> n;
    return n;
}
#define cmbntrcs fact[0]=1;for(int i=1;i<SZ;i++)fact[i]=mul(fact[i-1],i);finv[SZ-1]=inv(fact[SZ-1]);for(int i=SZ-2;i>0;i--)finv[i]=mul(finv[i+1],i+1);
int fact[SZ],finv[SZ];
int add(int x,int y,int MOD=MOD){
    x+=y;if(x>=MOD)x-=MOD;
    return x;
}
int sub(int x,int y,int MOD=MOD){
    x-=y;if(x<0)x+=MOD;
    return x;
}
int mul(int x,int y,int MOD=MOD){
    return(x*1ll*y)%MOD;
}
int pwr(int x,ll b,int MOD=MOD){
    int rt=1;
    while(b>0){
        if(b&1)rt=mul(rt,x,MOD);
        x=mul(x,x,MOD),b>>=1;
    }
    return rt;
}
int inv(int x,int MOD=MOD){
    return pwr(x,MOD-2,MOD);
}
#include "insects.h"
//#include "stub.cpp"
int n,p[SZ],a[SZ],k,vs[SZ];
vector<int>v;
void ins(int i){
    i=p[i];
    vs[i]=1;
    move_inside(i);
    v.pb(i);
}
void dlt(){
    vs[bk(v)]=0;
    move_outside(bk(v));
    v.pop_back();
}
void permdlt(){
    vs[bk(v)]=2;
    move_outside(bk(v));
    v.pop_back();
}
int card(){
    return press_button();
}
int min_cardinality(int N){
    n=N;
    for(int i=0;i<n;i++)p[i]=i,swap(p[i],p[rnd(0,i)]);
    for(int i=0;i<n;i++){
        ins(i);
        if(card()>1)dlt();
    }
    k=sz(v);
    int ans=n/k;
    for(int i=0;i<n;i++){
        if(vs[p[i]])continue;
        ins(i);
        if(card()>ans)permdlt();
    }
    while(ans>1){
        if(sz(v)==ans*k)break;
        ans--;
        while(card()>ans)dlt();
        for(int i=0;i<n;i++){
            if(vs[p[i]])continue;
            ins(i);
            if(card()>ans)permdlt();
        }
    }
    return ans;
}
/*int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    //cout << fixed << setprecision(12);
    int tt=1;
    //cin >> tt;
    LOOP(tt){
        //code
    }
    return 0;
}*/

詳細信息

Subtask #1:

score: 10
Accepted

Test #1:

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

input:

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

output:

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

result:

ok 

Test #2:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #3:

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

input:

2
1
1

output:

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

result:

ok 

Test #4:

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

input:

3
1
1
2
2

output:

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

result:

ok 

Test #5:

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

input:

5
1
1
2
2
2
2
2
3

output:

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

result:

ok 

Test #6:

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

input:

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

output:

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

result:

ok 

Test #7:

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

input:

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

output:

8
0 103
8
2
8
0 44
8
2
8
1 44
8
0 65
8
2
8
1 65
8
0 186
8
2
8
1 186
8
0 141
8
2
8
1 141
8
0 147
8
2
8
1 147
8
0 60
8
2
8
1 60
8
0 62
8
2
8
1 62
8
0 38
8
2
8
1 38
8
0 54
8
2
8
1 54
8
0 111
8
2
8
1 111
8
0 83
8
2
8
1 83
8
0 117
8
2
8
1 117
8
0 85
8
2
8
1 85
8
0 135
8
2
8
1 135
8
0 122
8
2
8
1 122
8
0 ...

result:

ok 

Test #8:

score: 10
Accepted
time: 2ms
memory: 10012kb

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 103
8
2
8
0 44
8
2
8
0 65
8
2
8
0 186
8
2
8
0 141
8
2
8
0 147
8
2
8
0 60
8
2
8
0 62
8
2
8
0 38
8
2
8
0 54
8
2
8
0 111
8
2
8
0 83
8
2
8
0 117
8
2
8
0 85
8
2
8
0 135
8
2
8
0 122
8
2
8
0 91
8
2
8
0 69
8
2
8
0 161
8
2
8
0 30
8
2
8
0 155
8
2
8
0 133
8
2
8
0 174
8
2
8
0 63
8
2
8
0 45
8
2
8
0 181
8
2
8...

result:

ok 

Test #9:

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

input:

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

output:

8
0 103
8
2
8
0 44
8
2
8
0 65
8
2
8
0 186
8
2
8
0 141
8
2
8
0 147
8
2
8
0 60
8
2
8
0 62
8
2
8
0 38
8
2
8
0 54
8
2
8
1 54
8
0 111
8
2
8
1 111
8
0 83
8
2
8
0 117
8
2
8
0 85
8
2
8
1 85
8
0 135
8
2
8
1 135
8
0 122
8
2
8
1 122
8
0 91
8
2
8
1 91
8
0 69
8
2
8
0 161
8
2
8
1 161
8
0 30
8
2
8
1 30
8
0 155
8
2...

result:

ok 

Test #10:

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

input:

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

output:

8
0 103
8
2
8
0 44
8
2
8
0 65
8
2
8
0 186
8
2
8
0 141
8
2
8
0 147
8
2
8
0 60
8
2
8
1 60
8
0 62
8
2
8
1 62
8
0 38
8
2
8
1 38
8
0 54
8
2
8
0 111
8
2
8
0 83
8
2
8
1 83
8
0 117
8
2
8
0 85
8
2
8
0 135
8
2
8
1 135
8
0 122
8
2
8
1 122
8
0 91
8
2
8
0 69
8
2
8
1 69
8
0 161
8
2
8
1 161
8
0 30
8
2
8
1 30
8
0 1...

result:

ok 

Test #11:

score: 10
Accepted
time: 2ms
memory: 9968kb

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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 184
8
2
8
0 143
8
2
8
1 143
8
0 79
8
2
8
1 79
8
0 113
8
2
8
1 113
8
0 151
8
2
8
1 151
8
0 196
8
2
8
1 196
8
0 104
8
2
8
1 104
8
0 117
8
2
8
1 117
8
0 156
8
2
8
1 156
8
0 180
8
2
8
1 180
8
0 53
8
2
8
1 53
8
0 34
8
2
8
1 34
8
0 46
8
2
8
1 46
8
0 173
8
2
8
1 173
8
0 115
8
2
8
1 115
8
0 30
8
2
8
1 3...

result:

ok 

Test #12:

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

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
1 143
8
0 79
8
2
8
0 113
8
2
8
1 113
8
0 151
8
2
8
1 151
8
0 196
8
2
8
0 104
8
2
8
0 117
8
2
8
0 156
8
2
8
0 180
8
2
8
1 180
8
0 53
8
2
8
1 53
8
0 34
8
2
8
1 34
8
0 46
8
2
8
0 173
8
2
8
0 115
8
2
8
1 115
8
0 30
8
2
8
0 57
8
2
8
0 15
8
2
8
1 15
8
0 77
8
2
8
0 152
8
2
8
1 152...

result:

ok 

Test #13:

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

input:

197
1
1
1
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
1 113
8
0 151
8
2
8
1 151
8
0 196
8
2
8
0 104
8
2
8
1 104
8
0 117
8
2
8
1 117
8
0 156
8
2
8
1 156
8
0 180
8
2
8
1 180
8
0 53
8
2
8
1 53
8
0 34
8
2
8
1 34
8
0 46
8
2
8
1 46
8
0 173
8
2
8
1 173
8
0 115
8
2
8
1 115
8
0 30
8
2
8
1 30
8
0 57
8
2
8
1 57
8
0...

result:

ok 

Test #14:

score: 10
Accepted
time: 4ms
memory: 10276kb

input:

198
1
1
1
1
1
2
2
1
1
1
2
2
1
1
1
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
0 151
8
2
8
0 196
8
2
8
1 196
8
0 104
8
2
8
1 104
8
0 117
8
2
8
0 156
8
2
8
0 180
8
2
8
0 53
8
2
8
1 53
8
0 34
8
2
8
1 34
8
0 46
8
2
8
0 173
8
2
8
0 115
8
2
8
0 30
8
2
8
1 30
8
0 57
8
2
8
1 57
8
0 15
8
2
8
1 15
8
0 77
8
2
8
1 77
8
0 152
8
2
8
1 152
8
...

result:

ok 

Test #15:

score: 10
Accepted
time: 5ms
memory: 9948kb

input:

200
1
1
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 184
8
2
8
0 143
8
2
8
0 79
8
2
8
1 79
8
0 113
8
2
8
1 113
8
0 151
8
2
8
0 196
8
2
8
1 196
8
0 104
8
2
8
1 104
8
0 117
8
2
8
0 156
8
2
8
0 180
8
2
8
1 180
8
0 53
8
2
8
1 53
8
0 34
8
2
8
1 34
8
0 46
8
2
8
1 46
8
0 173
8
2
8
1 173
8
0 115
8
2
8
1 115
8
0 30
8
2
8
1 30
8
0 57
8
2
8
1 57
8
0 15
8
2
8...

result:

ok 

Test #16:

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

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
1 113
8
0 151
8
2
8
0 154
8
2
8
0 104
8
2
8
0 117
8
2
8
0 156
8
2
8
1 156
8
0 180
8
2
8
1 180
8
0 53
8
2
8
1 53
8
0 34
8
2
8
1 34
8
0 46
8
2
8
0 173
8
2
8
1 173
8
0 115
8
2
8
1 115
8
0 30
8
2
8
1 30
8
0 57
8
2
8
1 57
8
0 15
8
2
8
1 15
8
0 77
8
2
8
1 7...

result:

ok 

Test #17:

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

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
0 151
8
2
8
0 196
8
2
8
1 196
8
0 104
8
2
8
0 117
8
2
8
1 117
8
0 156
8
2
8
1 156
8
0 180
8
2
8
0 53
8
2
8
1 53
8
0 34
8
2
8
1 34
8
0 46
8
2
8
1 46
8
0 173
8
2
8
1 173
8
0 115
8
2
8
1 115
8
0 30
8
2
8
1 30
8
0 57
8
2
8
1 57
8
0 15
8
2
8
0 77
8
2
8
1 7...

result:

ok 

Test #18:

score: 10
Accepted
time: 6ms
memory: 9988kb

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
0 151
8
2
8
0 154
8
2
8
0 104
8
2
8
0 117
8
2
8
1 117
8
0 156
8
2
8
1 156
8
0 180
8
2
8
0 53
8
2
8
0 34
8
2
8
0 46
8
2
8
1 46
8
0 173
8
2
8
1 173
8
0 115
8
2
8
0 30
8
2
8
1 30
8
0 57
8
2
8
1 57
8
0 15
8
2
8
0 77
8
2
8
1 77
8
0 152
8
2
8
1 152
8
0 62
8...

result:

ok 

Test #19:

score: 10
Accepted
time: 10ms
memory: 10284kb

input:

196
1
1
2
2
1
1
1
2
1
1
1
2
1
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 184
8
2
8
0 143
8
2
8
0 79
8
2
8
1 79
8
0 113
8
2
8
1 113
8
0 151
8
2
8
0 154
8
2
8
0 104
8
2
8
0 117
8
2
8
1 117
8
0 156
8
2
8
0 180
8
2
8
0 53
8
2
8
0 34
8
2
8
1 34
8
0 46
8
2
8
0 173
8
2
8
1 173
8
0 115
8
2
8
1 115
8
0 30
8
2
8
1 30
8
0 57
8
2
8
1 57
8
0 15
8
2
8
1 15
8
0 77
8
2
8
1 77
8
0 15...

result:

ok 

Test #20:

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

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
1 113
8
0 151
8
2
8
1 151
8
0 154
8
2
8
0 104
8
2
8
0 117
8
2
8
1 117
8
0 156
8
2
8
0 180
8
2
8
0 53
8
2
8
0 34
8
2
8
1 34
8
0 46
8
2
8
0 173
8
2
8
0 115
8
2
8
0 30
8
2
8
0 57
8
2
8
1 57
8
0 15
8
2
8
1 15
8
0 77
8
2
8
0 152
8
2
8
1 152
8
0 62
8
2
8
1 ...

result:

ok 

Test #21:

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

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
0 151
8
2
8
0 196
8
2
8
0 104
8
2
8
0 117
8
2
8
0 156
8
2
8
0 180
8
2
8
0 53
8
2
8
1 53
8
0 34
8
2
8
0 46
8
2
8
0 173
8
2
8
0 115
8
2
8
0 30
8
2
8
0 57
8
2
8
0 15
8
2
8
1 15
8
0 77
8
2
8
0 152
8
2
8
1 152
8
0 62
8
2
8
0 44
8
2
8
0 85
8
2
8
1 85
8
0 48...

result:

ok 

Test #22:

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

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
0 79
8
2
8
1 79
8
0 113
8
2
8
0 151
8
2
8
0 196
8
2
8
0 104
8
2
8
0 117
8
2
8
0 156
8
2
8
0 180
8
2
8
0 53
8
2
8
0 34
8
2
8
0 46
8
2
8
0 173
8
2
8
0 115
8
2
8
0 30
8
2
8
0 57
8
2
8
0 15
8
2
8
1 15
8
0 77
8
2
8
1 77
8
0 152
8
2
8
1 152
8
0 62
8
2
8
0 44
8
2
8
0 85
8
2
8
1 85...

result:

ok 

Test #23:

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

input:

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

output:

8
0 184
8
2
8
0 143
8
2
8
0 79
8
2
8
0 113
8
2
8
0 151
8
2
8
0 196
8
2
8
0 104
8
2
8
0 117
8
2
8
0 156
8
2
8
0 180
8
2
8
0 53
8
2
8
0 34
8
2
8
0 46
8
2
8
0 173
8
2
8
0 115
8
2
8
0 30
8
2
8
0 57
8
2
8
0 15
8
2
8
0 77
8
2
8
0 152
8
2
8
0 62
8
2
8
1 62
8
0 44
8
2
8
0 85
8
2
8
0 48
8
2
8
0 163
8
2
8
0 1...

result:

ok 

Subtask #2:

score: 15
Accepted

Test #24:

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

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 536
8
2
8
0 541
8
2
8
1 541
8
0 769
8
2
8
1 769
8
0 893
8
2
8
1 893
8
0 990
8
2
8
1 990
8
0 407
8
2
8
1 407
8
0 998
8
2
8
1 998
8
0 435
8
2
8
1 435
8
0 669
8
2
8
1 669
8
0 767
8
2
8
1 767
8
0 736
8
2
8
1 736
8
0 755
8
2
8
1 755
8
0 316
8
2
8
1 316
8
0 914
8
2
8
1 914
8
0 115
8
2
8
1 115
8
0 777
...

result:

ok 

Test #25:

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

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 536
8
2
8
0 541
8
2
8
0 769
8
2
8
0 893
8
2
8
0 990
8
2
8
0 407
8
2
8
0 998
8
2
8
0 435
8
2
8
0 669
8
2
8
0 767
8
2
8
0 736
8
2
8
0 755
8
2
8
0 316
8
2
8
0 914
8
2
8
0 115
8
2
8
0 777
8
2
8
0 220
8
2
8
0 600
8
2
8
0 226
8
2
8
0 239
8
2
8
0 587
8
2
8
0 831
8
2
8
0 85
8
2
8
0 253
8
2
8
0 199
8
2
8...

result:

ok 

Test #26:

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

input:

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

output:

8
0 536
8
2
8
0 541
8
2
8
0 769
8
2
8
0 893
8
2
8
0 990
8
2
8
0 407
8
2
8
0 998
8
2
8
1 998
8
0 435
8
2
8
0 669
8
2
8
0 767
8
2
8
0 736
8
2
8
0 755
8
2
8
1 755
8
0 316
8
2
8
1 316
8
0 914
8
2
8
1 914
8
0 115
8
2
8
0 777
8
2
8
0 220
8
2
8
0 600
8
2
8
1 600
8
0 226
8
2
8
0 239
8
2
8
1 239
8
0 587
8
2
...

result:

ok 

Test #27:

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

input:

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

output:

8
0 536
8
2
8
0 541
8
2
8
0 769
8
2
8
0 893
8
2
8
0 990
8
2
8
0 407
8
2
8
0 998
8
2
8
0 435
8
2
8
0 669
8
2
8
1 669
8
0 767
8
2
8
1 767
8
0 736
8
2
8
0 755
8
2
8
0 316
8
2
8
0 914
8
2
8
1 914
8
0 115
8
2
8
1 115
8
0 777
8
2
8
0 220
8
2
8
0 600
8
2
8
0 226
8
2
8
0 239
8
2
8
0 587
8
2
8
1 587
8
0 831
...

result:

ok 

Test #28:

score: 15
Accepted
time: 5ms
memory: 10092kb

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 399
8
2
8
0 192
8
2
8
1 192
8
0 577
8
2
8
1 577
8
0 815
8
2
8
1 815
8
0 517
8
2
8
1 517
8
0 724
8
2
8
1 724
8
0 353
8
2
8
1 353
8
0 886
8
2
8
1 886
8
0 420
8
2
8
1 420
8
0 474
8
2
8
1 474
8
0 325
8
2
8
1 325
8
0 295
8
2
8
1 295
8
0 690
8
2
8
1 690
8
0 809
8
2
8
1 809
8
0 508
8
2
8
1 508
8
0 926
...

result:

ok 

Test #29:

score: 15
Accepted
time: 5ms
memory: 8232kb

input:

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

output:

8
0 399
8
2
8
0 192
8
2
8
1 192
8
0 577
8
2
8
1 577
8
0 815
8
2
8
1 815
8
0 517
8
2
8
1 517
8
0 724
8
2
8
1 724
8
0 353
8
2
8
1 353
8
0 886
8
2
8
1 886
8
0 420
8
2
8
1 420
8
0 474
8
2
8
1 474
8
0 325
8
2
8
1 325
8
0 295
8
2
8
0 690
8
2
8
1 690
8
0 809
8
2
8
0 508
8
2
8
0 926
8
2
8
1 926
8
0 919
8
2
...

result:

ok 

Test #30:

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

input:

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

output:

8
0 399
8
2
8
0 192
8
2
8
0 577
8
2
8
1 577
8
0 815
8
2
8
1 815
8
0 517
8
2
8
1 517
8
0 724
8
2
8
1 724
8
0 353
8
2
8
0 886
8
2
8
0 420
8
2
8
1 420
8
0 474
8
2
8
1 474
8
0 325
8
2
8
1 325
8
0 295
8
2
8
1 295
8
0 690
8
2
8
1 690
8
0 809
8
2
8
1 809
8
0 508
8
2
8
1 508
8
0 926
8
2
8
1 926
8
0 919
8
2
...

result:

ok 

Test #31:

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

input:

998
1
1
1
1
1
1
1
1
2
1
2
1
1
2
1
1
2
2
2
1
2
2
1
1
1
2
1
2
2
2
1
1
2
1
2
2
1
1
2
2
1
1
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 399
8
2
8
0 192
8
2
8
0 577
8
2
8
0 815
8
2
8
0 517
8
2
8
0 724
8
2
8
0 353
8
2
8
0 886
8
2
8
0 420
8
2
8
1 420
8
0 474
8
2
8
0 325
8
2
8
1 325
8
0 295
8
2
8
0 690
8
2
8
0 809
8
2
8
1 809
8
0 508
8
2
8
0 926
8
2
8
0 919
8
2
8
1 919
8
0 644
8
2
8
1 644
8
0 832
8
2
8
1 832
8
0 890
8
2
8
0 948
8
2
...

result:

ok 

Test #32:

score: 15
Accepted
time: 7ms
memory: 9952kb

input:

1000
1
1
1
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 377
8
2
8
0 944
8
2
8
0 10
8
2
8
0 593
8
2
8
1 593
8
0 551
8
2
8
0 216
8
2
8
0 64
8
2
8
1 64
8
0 961
8
2
8
1 961
8
0 952
8
2
8
1 952
8
0 393
8
2
8
1 393
8
0 306
8
2
8
1 306
8
0 533
8
2
8
1 533
8
0 470
8
2
8
1 470
8
0 176
8
2
8
1 176
8
0 274
8
2
8
1 274
8
0 598
8
2
8
1 598
8
0 499
8
2
8
1 499
8
0...

result:

ok 

Test #33:

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

input:

996
1
2
1
1
1
1
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 377
8
2
8
0 944
8
2
8
1 944
8
0 10
8
2
8
0 593
8
2
8
0 551
8
2
8
0 216
8
2
8
0 64
8
2
8
1 64
8
0 961
8
2
8
1 961
8
0 952
8
2
8
0 393
8
2
8
1 393
8
0 306
8
2
8
1 306
8
0 533
8
2
8
1 533
8
0 470
8
2
8
1 470
8
0 176
8
2
8
1 176
8
0 274
8
2
8
0 598
8
2
8
1 598
8
0 499
8
2
8
1 499
8
0 413
8
2
8
1 413...

result:

ok 

Test #34:

score: 15
Accepted
time: 9ms
memory: 9952kb

input:

1000
1
1
1
1
2
2
1
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 377
8
2
8
0 944
8
2
8
0 10
8
2
8
0 593
8
2
8
0 551
8
2
8
1 551
8
0 216
8
2
8
1 216
8
0 64
8
2
8
0 961
8
2
8
1 961
8
0 952
8
2
8
1 952
8
0 393
8
2
8
1 393
8
0 306
8
2
8
0 533
8
2
8
0 470
8
2
8
1 470
8
0 176
8
2
8
0 274
8
2
8
1 274
8
0 598
8
2
8
1 598
8
0 499
8
2
8
0 413
8
2
8
1 413
8
0 929
8
2
8
...

result:

ok 

Test #35:

score: 15
Accepted
time: 8ms
memory: 10024kb

input:

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

output:

8
0 377
8
2
8
0 944
8
2
8
0 10
8
2
8
0 593
8
2
8
1 593
8
0 551
8
2
8
1 551
8
0 216
8
2
8
0 64
8
2
8
0 961
8
2
8
1 961
8
0 952
8
2
8
0 393
8
2
8
0 306
8
2
8
1 306
8
0 533
8
2
8
0 470
8
2
8
1 470
8
0 176
8
2
8
0 274
8
2
8
0 598
8
2
8
1 598
8
0 499
8
2
8
1 499
8
0 413
8
2
8
1 413
8
0 929
8
2
8
1 929
8
...

result:

ok 

Test #36:

score: 15
Accepted
time: 9ms
memory: 10020kb

input:

997
1
1
1
1
1
1
2
1
1
2
1
1
1
2
2
2
1
2
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 377
8
2
8
0 944
8
2
8
0 10
8
2
8
0 593
8
2
8
0 551
8
2
8
0 216
8
2
8
0 64
8
2
8
1 64
8
0 961
8
2
8
0 952
8
2
8
0 393
8
2
8
1 393
8
0 306
8
2
8
0 533
8
2
8
0 470
8
2
8
0 176
8
2
8
1 176
8
0 274
8
2
8
1 274
8
0 598
8
2
8
1 598
8
0 499
8
2
8
0 413
8
2
8
1 413
8
0 929
8
2
8
1 929
8
0 379
8
2
8
1 379...

result:

ok 

Test #37:

score: 15
Accepted
time: 19ms
memory: 10024kb

input:

995
1
1
1
1
1
2
2
1
1
1
1
1
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
2
2
1
2
2
2
2
2
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 834
8
2
8
0 935
8
2
8
0 537
8
2
8
0 894
8
2
8
0 910
8
2
8
0 118
8
2
8
1 118
8
0 863
8
2
8
1 863
8
0 938
8
2
8
0 706
8
2
8
0 746
8
2
8
0 864
8
2
8
0 2
8
2
8
0 524
8
2
8
0 901
8
2
8
0 53
8
2
8
0 623
8
2
8
1 623
8
0 73
8
2
8
1 73
8
0 562
8
2
8
1 562
8
0 934
8
2
8
0 703
8
2
8
1 703
8
0 981
8
2
8
1 9...

result:

ok 

Test #38:

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

input:

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

output:

8
0 834
8
2
8
0 935
8
2
8
0 537
8
2
8
0 894
8
2
8
0 910
8
2
8
0 118
8
2
8
0 863
8
2
8
0 938
8
2
8
0 706
8
2
8
1 706
8
0 746
8
2
8
0 864
8
2
8
1 864
8
0 2
8
2
8
0 524
8
2
8
1 524
8
0 901
8
2
8
0 53
8
2
8
1 53
8
0 623
8
2
8
0 73
8
2
8
0 562
8
2
8
0 934
8
2
8
1 934
8
0 703
8
2
8
0 981
8
2
8
0 38
8
2
8
...

result:

ok 

Test #39:

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

input:

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

output:

8
0 834
8
2
8
0 935
8
2
8
0 537
8
2
8
0 894
8
2
8
0 910
8
2
8
0 118
8
2
8
0 863
8
2
8
0 938
8
2
8
0 706
8
2
8
0 746
8
2
8
0 864
8
2
8
0 2
8
2
8
0 524
8
2
8
1 524
8
0 901
8
2
8
0 53
8
2
8
0 623
8
2
8
0 73
8
2
8
0 562
8
2
8
0 934
8
2
8
0 703
8
2
8
0 981
8
2
8
0 38
8
2
8
1 38
8
0 585
8
2
8
0 144
8
2
8
...

result:

ok 

Test #40:

score: 15
Accepted
time: 3ms
memory: 10296kb

input:

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

output:

8
0 834
8
2
8
0 935
8
2
8
0 537
8
2
8
0 894
8
2
8
0 910
8
2
8
0 118
8
2
8
0 863
8
2
8
0 938
8
2
8
0 706
8
2
8
0 746
8
2
8
0 864
8
2
8
0 2
8
2
8
0 524
8
2
8
0 901
8
2
8
0 53
8
2
8
0 623
8
2
8
0 73
8
2
8
0 562
8
2
8
0 934
8
2
8
0 703
8
2
8
0 981
8
2
8
0 38
8
2
8
0 585
8
2
8
0 144
8
2
8
0 464
8
2
8
0 8...

result:

ok 

Test #41:

score: 15
Accepted
time: 3ms
memory: 7964kb

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

output:

8
0 834
8
2
8
0 935
8
2
8
0 537
8
2
8
0 894
8
2
8
0 910
8
2
8
0 118
8
2
8
0 863
8
2
8
0 938
8
2
8
0 706
8
2
8
0 746
8
2
8
0 864
8
2
8
0 2
8
2
8
0 524
8
2
8
0 901
8
2
8
0 53
8
2
8
0 623
8
2
8
0 73
8
2
8
0 562
8
2
8
0 934
8
2
8
0 703
8
2
8
0 981
8
2
8
0 38
8
2
8
0 585
8
2
8
0 144
8
2
8
0 464
8
2
8
0 8...

result:

ok 

Test #42:

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

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

output:

8
0 565
8
2
8
0 72
8
2
8
0 124
8
2
8
0 363
8
2
8
0 591
8
2
8
0 805
8
2
8
0 330
8
2
8
0 283
8
2
8
0 899
8
2
8
0 843
8
2
8
0 610
8
2
8
0 680
8
2
8
0 408
8
2
8
0 405
8
2
8
0 896
8
2
8
0 692
8
2
8
0 113
8
2
8
0 659
8
2
8
0 129
8
2
8
0 454
8
2
8
0 821
8
2
8
0 290
8
2
8
0 309
8
2
8
0 695
8
2
8
0 818
8
2
8...

result:

ok 

Subtask #3:

score: 0
Wrong Answer

Test #43:

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

input:

2
1
2
2

output:

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

result:

ok 

Test #44:

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

input:

2
1
1

output:

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

result:

ok 

Test #45:

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

input:

3
1
2
1
2

output:

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

result:

ok 

Test #46:

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

input:

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

output:

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

result:

ok 

Test #47:

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

input:

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

output:

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

result:

ok 

Test #48:

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

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 1016
8
2
8
0 72
8
2
8
1 72
8
0 124
8
2
8
1 124
8
0 363
8
2
8
1 363
8
0 1596
8
2
8
1 1596
8
0 1561
8
2
8
1 1561
8
0 1776
8
2
8
1 1776
8
0 1513
8
2
8
1 1513
8
0 899
8
2
8
1 899
8
0 1363
8
2
8
1 1363
8
0 610
8
2
8
1 610
8
0 1391
8
2
8
1 1391
8
0 1382
8
2
8
1 1382
8
0 1505
8
2
8
1 1505
8
0 1411
8
2
...

result:

ok 

Test #49:

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

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 1016
8
2
8
0 72
8
2
8
0 124
8
2
8
0 363
8
2
8
0 1596
8
2
8
0 1561
8
2
8
0 1776
8
2
8
0 1513
8
2
8
0 899
8
2
8
0 1363
8
2
8
0 610
8
2
8
0 1391
8
2
8
0 1382
8
2
8
0 1505
8
2
8
0 1411
8
2
8
0 1381
8
2
8
0 1638
8
2
8
0 1440
8
2
8
0 1179
8
2
8
0 1703
8
2
8
0 1127
8
2
8
0 290
8
2
8
0 309
8
2
8
0 1713
...

result:

ok 

Test #50:

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

input:

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

output:

8
0 1016
8
2
8
0 72
8
2
8
0 124
8
2
8
0 363
8
2
8
0 1596
8
2
8
0 1561
8
2
8
0 1776
8
2
8
0 1513
8
2
8
0 899
8
2
8
0 1363
8
2
8
0 610
8
2
8
0 1391
8
2
8
0 1382
8
2
8
0 1505
8
2
8
1 1505
8
0 1411
8
2
8
0 1381
8
2
8
0 1638
8
2
8
1 1638
8
0 1440
8
2
8
0 1179
8
2
8
0 1703
8
2
8
0 1127
8
2
8
1 1127
8
0 29...

result:

ok 

Test #51:

score: 21.22
Acceptable Answer
time: 38ms
memory: 8036kb

input:

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

output:

8
0 1016
8
2
8
0 72
8
2
8
0 124
8
2
8
0 363
8
2
8
0 1596
8
2
8
0 1561
8
2
8
0 1776
8
2
8
1 1776
8
0 1513
8
2
8
1 1513
8
0 899
8
2
8
0 1363
8
2
8
0 610
8
2
8
0 1391
8
2
8
0 1382
8
2
8
0 1505
8
2
8
0 1411
8
2
8
1 1411
8
0 1381
8
2
8
1 1381
8
0 1638
8
2
8
1 1638
8
0 1440
8
2
8
0 1179
8
2
8
0 1703
8
2
8...

result:

points 0.28293333330 points  0.28293333330

Test #52:

score: 72.84
Acceptable Answer
time: 11ms
memory: 10000kb

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 1888
8
2
8
0 1939
8
2
8
1 1939
8
0 1556
8
2
8
1 1556
8
0 241
8
2
8
1 241
8
0 1221
8
2
8
1 1221
8
0 1924
8
2
8
1 1924
8
0 1070
8
2
8
1 1070
8
0 935
8
2
8
1 935
8
0 505
8
2
8
1 505
8
0 333
8
2
8
1 333
8
0 1393
8
2
8
1 1393
8
0 1729
8
2
8
1 1729
8
0 853
8
2
8
1 853
8
0 377
8
2
8
1 377
8
0 1821
8
2
...

result:

points 0.97120 points  0.97120

Test #53:

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

input:

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

output:

8
0 1888
8
2
8
0 1939
8
2
8
0 1556
8
2
8
0 241
8
2
8
1 241
8
0 1221
8
2
8
0 1924
8
2
8
0 1070
8
2
8
1 1070
8
0 935
8
2
8
1 935
8
0 505
8
2
8
1 505
8
0 333
8
2
8
0 1393
8
2
8
1 1393
8
0 1729
8
2
8
0 853
8
2
8
1 853
8
0 377
8
2
8
1 377
8
0 1821
8
2
8
0 923
8
2
8
1 923
8
0 161
8
2
8
0 135
8
2
8
0 503
8...

result:

ok 

Test #54:

score: 16.07
Acceptable Answer
time: 40ms
memory: 10004kb

input:

2000
1
2
1
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
2
2
2
2
2
2
2
2
2
2
2
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 1888
8
2
8
0 1939
8
2
8
1 1939
8
0 1556
8
2
8
0 241
8
2
8
1 241
8
0 1221
8
2
8
1 1221
8
0 1924
8
2
8
0 1070
8
2
8
1 1070
8
0 935
8
2
8
1 935
8
0 505
8
2
8
1 505
8
0 333
8
2
8
1 333
8
0 1393
8
2
8
1 1393
8
0 1729
8
2
8
1 1729
8
0 853
8
2
8
1 853
8
0 377
8
2
8
0 1821
8
2
8
1 1821
8
0 923
8
2
8
1 9...

result:

points 0.21426666670 points  0.21426666670

Test #55:

score: 22.14
Acceptable Answer
time: 30ms
memory: 7968kb

input:

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

output:

8
0 690
8
2
8
0 1089
8
2
8
0 392
8
2
8
0 469
8
2
8
1 469
8
0 1826
8
2
8
0 1796
8
2
8
1 1796
8
0 466
8
2
8
0 1970
8
2
8
0 114
8
2
8
0 1621
8
2
8
0 287
8
2
8
0 1386
8
2
8
1 1386
8
0 1952
8
2
8
0 1257
8
2
8
1 1257
8
0 1627
8
2
8
0 1347
8
2
8
0 890
8
2
8
0 1912
8
2
8
0 1363
8
2
8
0 1537
8
2
8
0 292
8
2
...

result:

points 0.29520 points  0.29520

Test #56:

score: 65.45
Acceptable Answer
time: 9ms
memory: 10008kb

input:

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

output:

8
0 431
8
2
8
0 1956
8
2
8
0 1857
8
2
8
0 568
8
2
8
1 568
8
0 1145
8
2
8
0 13
8
2
8
1 13
8
0 1777
8
2
8
1 1777
8
0 1967
8
2
8
1 1967
8
0 1520
8
2
8
0 356
8
2
8
1 356
8
0 190
8
2
8
1 190
8
0 1366
8
2
8
1 1366
8
0 1381
8
2
8
1 1381
8
0 1162
8
2
8
1 1162
8
0 1343
8
2
8
1 1343
8
0 1496
8
2
8
1 1496
8
0 ...

result:

points 0.87266666670 points  0.87266666670

Test #57:

score: 68.36
Acceptable Answer
time: 4ms
memory: 10292kb

input:

1999
1
1
2
2
1
2
1
1
2
2
2
1
2
2
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1836
8
2
8
0 222
8
2
8
1 222
8
0 769
8
2
8
1 769
8
0 1007
8
2
8
0 1421
8
2
8
1 1421
8
0 54
8
2
8
0 1493
8
2
8
0 1383
8
2
8
1 1383
8
0 1657
8
2
8
1 1657
8
0 1096
8
2
8
1 1096
8
0 638
8
2
8
0 428
8
2
8
1 428
8
0 1831
8
2
8
1 1831
8
0 776
8
2
8
0 95
8
2
8
0 572
8
2
8
1 572
8
0 732
8
2
8...

result:

points 0.91146666670 points  0.91146666670

Test #58:

score: 52.08
Acceptable Answer
time: 11ms
memory: 10000kb

input:

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

output:

8
0 191
8
2
8
0 1836
8
2
8
0 222
8
2
8
1 222
8
0 769
8
2
8
0 1007
8
2
8
0 1421
8
2
8
1 1421
8
0 54
8
2
8
0 1493
8
2
8
1 1493
8
0 1383
8
2
8
0 1657
8
2
8
0 1096
8
2
8
1 1096
8
0 638
8
2
8
1 638
8
0 428
8
2
8
1 428
8
0 1831
8
2
8
1 1831
8
0 776
8
2
8
0 95
8
2
8
0 572
8
2
8
1 572
8
0 732
8
2
8
1 732
8
...

result:

points 0.69440 points  0.69440

Test #59:

score: 34.91
Acceptable Answer
time: 35ms
memory: 7916kb

input:

1998
1
1
1
1
1
1
2
1
2
1
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
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 191
8
2
8
0 1836
8
2
8
0 222
8
2
8
0 769
8
2
8
0 1007
8
2
8
0 1421
8
2
8
0 54
8
2
8
1 54
8
0 1493
8
2
8
0 1383
8
2
8
1 1383
8
0 1657
8
2
8
0 1096
8
2
8
0 638
8
2
8
1 638
8
0 428
8
2
8
1 428
8
0 1831
8
2
8
1 1831
8
0 776
8
2
8
0 95
8
2
8
1 95
8
0 572
8
2
8
0 732
8
2
8
1 732
8
0 61
8
2
8
1 61
8
0 ...

result:

points 0.46546666670 points  0.46546666670

Test #60:

score: 60.35
Acceptable Answer
time: 15ms
memory: 10308kb

input:

1996
1
1
1
1
1
1
1
1
2
2
1
2
1
2
2
2
2
2
2
1
2
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
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 1706
8
2
8
0 8
8
2
8
0 514
8
2
8
0 746
8
2
8
0 1949
8
2
8
0 1609
8
2
8
0 1401
8
2
8
0 1946
8
2
8
0 1780
8
2
8
1 1780
8
0 401
8
2
8
1 401
8
0 1842
8
2
8
0 1169
8
2
8
1 1169
8
0 1437
8
2
8
0 325
8
2
8
1 325
8
0 734
8
2
8
1 734
8
0 227
8
2
8
1 227
8
0 1758
8
2
8
1 1758
8
0 1638
8
2
8
1 1638
8
0 701...

result:

points 0.80466666670 points  0.80466666670

Test #61:

score: 30.47
Acceptable Answer
time: 34ms
memory: 10268kb

input:

2000
1
1
1
2
1
1
1
1
1
2
1
2
1
1
2
1
1
1
2
1
1
2
2
2
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
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 1706
8
2
8
0 8
8
2
8
0 514
8
2
8
0 746
8
2
8
1 746
8
0 1949
8
2
8
0 1609
8
2
8
0 1401
8
2
8
0 1946
8
2
8
0 1780
8
2
8
0 401
8
2
8
1 401
8
0 1842
8
2
8
0 1169
8
2
8
1 1169
8
0 1437
8
2
8
0 325
8
2
8
0 734
8
2
8
1 734
8
0 227
8
2
8
0 1758
8
2
8
0 1638
8
2
8
0 701
8
2
8
1 701
8
0 367
8
2
8
0 137
8
...

result:

points 0.40626666670 points  0.40626666670

Test #62:

score: 23.01
Acceptable Answer
time: 27ms
memory: 10016kb

input:

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

output:

8
0 1113
8
2
8
0 64
8
2
8
0 809
8
2
8
0 486
8
2
8
0 270
8
2
8
0 496
8
2
8
0 1091
8
2
8
0 1283
8
2
8
0 1423
8
2
8
0 1906
8
2
8
0 783
8
2
8
0 1354
8
2
8
1 1354
8
0 647
8
2
8
0 585
8
2
8
0 1876
8
2
8
1 1876
8
0 126
8
2
8
0 903
8
2
8
0 294
8
2
8
0 779
8
2
8
0 151
8
2
8
0 1476
8
2
8
0 749
8
2
8
0 1747
8
...

result:

points 0.30680 points  0.30680

Test #63:

score: 34.15
Acceptable Answer
time: 13ms
memory: 10008kb

input:

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

output:

8
0 1429
8
2
8
0 1945
8
2
8
0 1244
8
2
8
0 445
8
2
8
0 1779
8
2
8
0 123
8
2
8
0 938
8
2
8
0 587
8
2
8
0 1317
8
2
8
1 1317
8
0 1650
8
2
8
1 1650
8
0 1238
8
2
8
0 1163
8
2
8
0 677
8
2
8
0 1461
8
2
8
0 422
8
2
8
0 1519
8
2
8
0 188
8
2
8
1 188
8
0 1197
8
2
8
0 406
8
2
8
0 1819
8
2
8
0 1702
8
2
8
0 1869
...

result:

points 0.45533333330 points  0.45533333330

Test #64:

score: 40.29
Acceptable Answer
time: 13ms
memory: 10292kb

input:

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

output:

8
0 1429
8
2
8
0 1945
8
2
8
0 1244
8
2
8
0 445
8
2
8
0 1779
8
2
8
0 123
8
2
8
0 938
8
2
8
0 587
8
2
8
0 1317
8
2
8
0 1650
8
2
8
0 1238
8
2
8
0 1163
8
2
8
0 677
8
2
8
0 1461
8
2
8
0 422
8
2
8
0 1519
8
2
8
0 188
8
2
8
0 1197
8
2
8
0 406
8
2
8
0 1819
8
2
8
1 1819
8
0 1702
8
2
8
0 1869
8
2
8
0 1642
8
2
...

result:

points 0.53720 points  0.53720

Test #65:

score: 69.42
Acceptable Answer
time: 15ms
memory: 10016kb

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

output:

8
0 1976
8
2
8
0 1658
8
2
8
0 1194
8
2
8
0 1536
8
2
8
0 883
8
2
8
0 567
8
2
8
0 528
8
2
8
0 636
8
2
8
0 1780
8
2
8
0 231
8
2
8
0 909
8
2
8
0 1784
8
2
8
0 1926
8
2
8
0 476
8
2
8
0 1542
8
2
8
0 28
8
2
8
0 1081
8
2
8
0 805
8
2
8
0 22
8
2
8
0 782
8
2
8
0 377
8
2
8
0 115
8
2
8
0 67
8
2
8
0 1866
8
2
8
0 7...

result:

points 0.92560 points  0.92560

Test #66:

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

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

output:

8
0 1976
8
2
8
0 1658
8
2
8
0 1194
8
2
8
0 1536
8
2
8
0 883
8
2
8
0 567
8
2
8
0 528
8
2
8
0 636
8
2
8
0 1780
8
2
8
0 231
8
2
8
0 909
8
2
8
0 1784
8
2
8
0 1926
8
2
8
0 476
8
2
8
0 1542
8
2
8
0 28
8
2
8
0 1081
8
2
8
0 805
8
2
8
0 22
8
2
8
0 782
8
2
8
0 377
8
2
8
0 115
8
2
8
0 67
8
2
8
0 1866
8
2
8
0 7...

result:

ok 

Test #67:

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

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

output:

8
0 1976
8
2
8
0 1658
8
2
8
0 1194
8
2
8
0 1536
8
2
8
0 883
8
2
8
0 567
8
2
8
0 528
8
2
8
0 636
8
2
8
0 1780
8
2
8
0 231
8
2
8
0 909
8
2
8
0 1784
8
2
8
0 1926
8
2
8
0 476
8
2
8
0 1542
8
2
8
0 28
8
2
8
0 1081
8
2
8
0 805
8
2
8
0 22
8
2
8
0 782
8
2
8
0 377
8
2
8
0 115
8
2
8
0 67
8
2
8
0 1866
8
2
8
0 7...

result:

ok 

Test #68:

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

input:

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

output:

8
0 1976
8
2
8
0 1658
8
2
8
0 1194
8
2
8
0 1536
8
2
8
0 883
8
2
8
0 567
8
2
8
0 528
8
2
8
0 636
8
2
8
0 1780
8
2
8
0 231
8
2
8
0 909
8
2
8
0 1784
8
2
8
1 1784
8
0 1926
8
2
8
0 476
8
2
8
0 1542
8
2
8
0 28
8
2
8
0 1081
8
2
8
0 805
8
2
8
1 805
8
0 22
8
2
8
0 782
8
2
8
0 377
8
2
8
0 115
8
2
8
1 115
8
0 ...

result:

ok 

Test #69:

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

input:

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

output:

8
0 1976
8
2
8
0 1658
8
2
8
0 1194
8
2
8
0 1536
8
2
8
0 883
8
2
8
0 567
8
2
8
0 528
8
2
8
0 636
8
2
8
0 1780
8
2
8
0 231
8
2
8
0 909
8
2
8
0 1784
8
2
8
1 1784
8
0 1926
8
2
8
0 476
8
2
8
0 1542
8
2
8
0 28
8
2
8
0 1081
8
2
8
0 805
8
2
8
1 805
8
0 22
8
2
8
1 22
8
0 782
8
2
8
0 377
8
2
8
0 115
8
2
8
1 1...

result:

ok 

Test #70:

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

input:

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

output:

8
0 288
8
2
8
0 745
8
2
8
0 1750
8
2
8
0 1537
8
2
8
0 1105
8
2
8
0 229
8
2
8
0 126
8
2
8
1 126
8
0 902
8
2
8
1 902
8
0 976
8
2
8
0 243
8
2
8
0 1030
8
2
8
0 906
8
2
8
0 1143
8
2
8
0 525
8
2
8
1 525
8
0 369
8
2
8
0 1890
8
2
8
0 1467
8
2
8
0 1223
8
2
8
1 1223
8
0 1336
8
2
8
0 429
8
2
8
0 1472
8
2
8
0 5...

result:

ok 

Test #71:

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

input:

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

output:

8
0 288
8
2
8
0 745
8
2
8
0 1750
8
2
8
0 1537
8
2
8
0 1105
8
2
8
0 229
8
2
8
0 126
8
2
8
1 126
8
0 902
8
2
8
1 902
8
0 976
8
2
8
0 243
8
2
8
0 1030
8
2
8
0 906
8
2
8
0 1143
8
2
8
0 525
8
2
8
1 525
8
0 369
8
2
8
0 1890
8
2
8
0 1467
8
2
8
0 1223
8
2
8
1 1223
8
0 1336
8
2
8
0 429
8
2
8
0 1472
8
2
8
0 5...

result:

ok 

Test #72:

score: 35.69
Acceptable Answer
time: 13ms
memory: 10032kb

input:

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

output:

8
0 288
8
2
8
0 745
8
2
8
0 1750
8
2
8
0 1537
8
2
8
0 1105
8
2
8
0 229
8
2
8
1 229
8
0 126
8
2
8
0 902
8
2
8
0 976
8
2
8
0 243
8
2
8
0 1030
8
2
8
0 906
8
2
8
0 1143
8
2
8
0 525
8
2
8
0 369
8
2
8
0 1890
8
2
8
0 1467
8
2
8
0 1223
8
2
8
1 1223
8
0 1336
8
2
8
0 429
8
2
8
0 1472
8
2
8
0 536
8
2
8
0 1148
...

result:

points 0.47586666670 points  0.47586666670

Test #73:

score: 38.74
Acceptable Answer
time: 12ms
memory: 8260kb

input:

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

output:

8
0 288
8
2
8
0 745
8
2
8
0 1750
8
2
8
0 1537
8
2
8
0 1105
8
2
8
0 229
8
2
8
0 126
8
2
8
0 902
8
2
8
0 976
8
2
8
0 243
8
2
8
0 1030
8
2
8
0 906
8
2
8
0 1143
8
2
8
0 525
8
2
8
0 369
8
2
8
0 1890
8
2
8
0 1467
8
2
8
0 1223
8
2
8
0 1336
8
2
8
0 429
8
2
8
0 1472
8
2
8
0 536
8
2
8
0 1148
8
2
8
1 1148
8
0 ...

result:

points 0.51653333330 points  0.51653333330

Test #74:

score: 29.87
Acceptable Answer
time: 30ms
memory: 10064kb

input:

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

output:

8
0 769
8
2
8
0 246
8
2
8
0 1829
8
2
8
0 701
8
2
8
0 1466
8
2
8
0 74
8
2
8
1 74
8
0 1006
8
2
8
0 22
8
2
8
0 710
8
2
8
1 710
8
0 733
8
2
8
0 355
8
2
8
0 1186
8
2
8
0 312
8
2
8
0 58
8
2
8
0 1933
8
2
8
0 813
8
2
8
0 4
8
2
8
0 277
8
2
8
0 351
8
2
8
0 1198
8
2
8
0 1903
8
2
8
0 9
8
2
8
0 625
8
2
8
1 625
8...

result:

points 0.39826666670 points  0.39826666670

Test #75:

score: 28
Acceptable Answer
time: 22ms
memory: 10108kb

input:

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

output:

8
0 1535
8
2
8
0 1069
8
2
8
0 44
8
2
8
0 694
8
2
8
0 1327
8
2
8
0 1723
8
2
8
0 1336
8
2
8
0 1472
8
2
8
0 325
8
2
8
0 492
8
2
8
0 1559
8
2
8
1 1559
8
0 1321
8
2
8
0 980
8
2
8
0 1251
8
2
8
0 424
8
2
8
0 1808
8
2
8
0 1393
8
2
8
0 494
8
2
8
0 1376
8
2
8
0 930
8
2
8
0 1027
8
2
8
1 1027
8
0 1847
8
2
8
0 1...

result:

points 0.37333333330 points  0.37333333330

Test #76:

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

input:

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

output:

8
0 1535
8
2
8
0 1069
8
2
8
0 44
8
2
8
0 694
8
2
8
0 1327
8
2
8
0 1723
8
2
8
0 1336
8
2
8
0 1472
8
2
8
0 325
8
2
8
0 492
8
2
8
0 1559
8
2
8
0 1321
8
2
8
1 1321
8
0 980
8
2
8
0 1251
8
2
8
0 424
8
2
8
1 424
8
0 1808
8
2
8
0 1393
8
2
8
1 1393
8
0 494
8
2
8
0 1376
8
2
8
0 930
8
2
8
0 1027
8
2
8
0 1847
8...

result:

ok 

Test #77:

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

input:

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

output:

8
0 1535
8
2
8
0 1069
8
2
8
0 44
8
2
8
0 694
8
2
8
0 1327
8
2
8
0 1723
8
2
8
0 1336
8
2
8
0 1472
8
2
8
0 325
8
2
8
0 492
8
2
8
0 1559
8
2
8
0 1321
8
2
8
0 980
8
2
8
0 1251
8
2
8
0 424
8
2
8
1 424
8
0 1808
8
2
8
1 1808
8
0 1393
8
2
8
0 494
8
2
8
1 494
8
0 1376
8
2
8
0 930
8
2
8
0 1027
8
2
8
1 1027
8
...

result:

ok 

Test #78:

score: 33.23
Acceptable Answer
time: 12ms
memory: 10312kb

input:

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

output:

8
0 208
8
2
8
0 990
8
2
8
0 1055
8
2
8
0 1629
8
2
8
0 1600
8
2
8
0 1159
8
2
8
0 904
8
2
8
0 1766
8
2
8
0 256
8
2
8
0 1719
8
2
8
0 797
8
2
8
0 1345
8
2
8
0 407
8
2
8
0 1687
8
2
8
0 723
8
2
8
0 573
8
2
8
0 1185
8
2
8
0 155
8
2
8
0 1277
8
2
8
1 1277
8
0 730
8
2
8
0 479
8
2
8
1 479
8
0 1538
8
2
8
0 699
...

result:

points 0.44306666670 points  0.44306666670

Test #79:

score: 35.89
Acceptable Answer
time: 37ms
memory: 9968kb

input:

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

output:

8
0 208
8
2
8
0 990
8
2
8
0 1055
8
2
8
0 1629
8
2
8
0 1600
8
2
8
0 1159
8
2
8
0 904
8
2
8
0 1766
8
2
8
0 256
8
2
8
0 1719
8
2
8
0 797
8
2
8
0 1345
8
2
8
0 407
8
2
8
0 1687
8
2
8
0 723
8
2
8
0 573
8
2
8
0 1185
8
2
8
0 155
8
2
8
0 1277
8
2
8
1 1277
8
0 730
8
2
8
0 479
8
2
8
1 479
8
0 1538
8
2
8
0 699
...

result:

points 0.47853333330 points  0.47853333330

Test #80:

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

input:

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

output:

8
0 78
8
2
8
0 124
8
2
8
0 308
8
2
8
0 1889
8
2
8
0 371
8
2
8
0 21
8
2
8
0 191
8
2
8
1 191
8
0 1263
8
2
8
0 1642
8
2
8
0 1222
8
2
8
0 1691
8
2
8
0 1384
8
2
8
0 1193
8
2
8
0 1752
8
2
8
0 1955
8
2
8
0 1844
8
2
8
0 307
8
2
8
0 1306
8
2
8
0 1623
8
2
8
0 203
8
2
8
0 1800
8
2
8
0 1532
8
2
8
0 1279
8
2
8
0...

result:

ok 

Test #81:

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

input:

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

output:

8
0 78
8
2
8
0 124
8
2
8
0 308
8
2
8
0 1889
8
2
8
0 371
8
2
8
0 21
8
2
8
0 191
8
2
8
1 191
8
0 1263
8
2
8
0 1642
8
2
8
0 1222
8
2
8
0 1691
8
2
8
0 1384
8
2
8
0 1193
8
2
8
0 1752
8
2
8
0 1955
8
2
8
0 1844
8
2
8
0 307
8
2
8
0 1306
8
2
8
0 1623
8
2
8
0 203
8
2
8
0 1800
8
2
8
0 1532
8
2
8
0 1279
8
2
8
0...

result:

ok 

Test #82:

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

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

output:

8
0 78
8
2
8
0 124
8
2
8
0 308
8
2
8
0 1889
8
2
8
0 371
8
2
8
0 21
8
2
8
0 191
8
2
8
0 1263
8
2
8
0 1642
8
2
8
0 1222
8
2
8
0 1691
8
2
8
0 1384
8
2
8
0 1193
8
2
8
0 1752
8
2
8
0 1955
8
2
8
0 1844
8
2
8
0 307
8
2
8
0 1306
8
2
8
0 1623
8
2
8
0 203
8
2
8
1 203
8
0 1800
8
2
8
0 1532
8
2
8
0 1279
8
2
8
0...

result:

ok 

Test #83:

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

input:

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

output:

8
0 78
8
2
8
0 124
8
2
8
0 308
8
2
8
0 1889
8
2
8
0 371
8
2
8
0 21
8
2
8
0 191
8
2
8
0 1263
8
2
8
0 1642
8
2
8
1 1642
8
0 1222
8
2
8
0 1691
8
2
8
0 1384
8
2
8
0 1193
8
2
8
1 1193
8
0 1752
8
2
8
0 1955
8
2
8
0 1844
8
2
8
0 307
8
2
8
1 307
8
0 1306
8
2
8
0 1623
8
2
8
0 203
8
2
8
0 1800
8
2
8
0 1532
8
...

result:

ok 

Test #84:

score: 0
Wrong Answer
time: 18ms
memory: 10280kb

input:

540
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
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
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 78
8
2
8
0 124
8
2
8
1 124
8
0 308
8
2
8
1 308
8
0 360
8
2
8
1 360
8
0 371
8
2
8
1 371
8
0 21
8
2
8
0 191
8
2
8
1 191
8
0 282
8
2
8
1 282
8
0 102
8
2
8
1 102
8
0 440
8
2
8
1 440
8
0 397
8
2
8
0 165
8
2
8
1 165
8
0 508
8
2
8
1 508
8
0 33
8
2
8
1 33
8
0 368
8
2
8
1 368
8
0 467
8
2
8
1 467
8
0 307
...

result:

wrong answer Too many queries.