QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#73568#4208. Flight to the FordFISHER_100 ✓106ms3752kbC++142.2kb2023-01-25 23:40:212023-02-03 22:47:45

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-03 22:47:45]
  • 评测
  • 测评结果:100
  • 用时:106ms
  • 内存:3752kb
  • [2023-01-25 23:40:21]
  • 提交

answer

#include "communication.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define PB push_back
#define EB emplace_back
using namespace std;
struct Lset {
	int tot;
	vector<pair<int, int>> seg;
	Lset(int s = 0) : tot(s) {}
	Lset(int l, int r) : tot(r - l + 1) { seg.EB(l, r); }
	pair<Lset, Lset> split(int d) {
		int mid = (tot + d) / 2;
		Lset L(mid), R(tot - mid);
		int sum = 0;
		for (const auto& p : seg) {
			if (sum == mid) R.seg.PB(p);
			else if (sum + p.se - p.fi + 1 <= mid) L.seg.PB(p), sum += p.se - p.fi + 1;
			else {
				L.seg.EB(p.fi, p.fi + mid - sum - 1), R.seg.EB(p.fi + mid - sum, p.se);
				sum = mid;
			}
		}
		return {L, R};
	}
	bool find(int x) {
		for (const auto& p : seg)
			if (p.fi <= x && x <= p.se) return 1;
		return 0;
	}
	vector<int> all() {
		vector<int> res;
		for (const auto& p : seg)
			for (int i = p.fi; i <= p.se; i++) res.PB(i);
		return res;
	}
};
Lset merge(const Lset& L, const Lset& R) {
	Lset res(L.tot + R.tot);
	res.seg = L.seg, res.seg.insert(res.seg.end(), R.seg.begin(), R.seg.end());
	return res;
}
void encode(int n, int x) {
	Lset tc(1, n), tw;
	while (tc.tot + tw.tot > 3) {
		Lset tc1, tc2, tw1, tw2;
		tie(tc1, tc2) = tc.split(0), tie(tw1, tw2) = tw.split(1);
		int res;
		if (tc1.find(x) || tw1.find(x)) res = send(1);
		else res = send(0);
		if (res) tc = merge(tc1, tw1), tw = tc2;
		else tc = merge(tc2, tw2), tw = tc1;
	}
	auto lft = merge(tc, tw).all();
	if (lft.size() == 3) {
		if (x == lft[0]) send(0), send(0), send(0), send(0);
		else if (x == lft[1]) send(0), send(1), send(1), send(0);
		else send(1), send(1), send(1), send(1);
	}
}
const int t[16] = {2, 2, 2, 2, 2, 1, 0, 0, 2, 2, 1, 0, 0, 0, 0, 0};
pair<int, int> decode(int n) {
	Lset tc(1, n), tw;
	while (tc.tot + tw.tot > 3) {
		Lset tc1, tc2, tw1, tw2;
		tie(tc1, tc2) = tc.split(0), tie(tw1, tw2) = tw.split(1);
		if (receive()) tc = merge(tc1, tw1), tw = tc2;
		else tc = merge(tc2, tw2), tw = tc1;
	}
	auto lft = merge(tc, tw).all();
	if (lft.size() == 3) {
		int s = 0;
		for (int i = 0; i < 4; i++) s = s << 1 | receive();
		if (t[s] == 0) return {lft[1], lft[2]};
		if (t[s] == 1) return {lft[0], lft[2]};
		return {lft[0], lft[1]};
	}
	return {lft[0], lft[1]};
}

详细

Subtask #1:

score: 15
Accepted

Test #1:

score: 15
Accepted
time: 6ms
memory: 3740kb
Overall Time Limit: 500ms

input:

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

output:

510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

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

output:

510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

2
3
0
1
1
0
2
3
1
0
1
0
2
3
0
0
0
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
1
0
1
0
2
3
1
1
1
1
2
3
1
0
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
1
1
1
1
2
3
0
1
1
0
2
3
1
1
1
1
2
3
0
0
0
0
2
3
0
0
0
0
2
3
1
1
1
1
2
3
1
1
1
1
2
3
0
0
1
0
2
3
1
0
1
0
2
3
0
0
0
0
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
...

input:

2
3
1
1
1
1
2
3
0
0
0
0
2
3
0
1
1
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
1
1
1
1
2
3
1
0
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
1
1
1
1
2
3
1
1
1
1
2
3
1
0
1
0
2
3
0
0
0
0
2
3
1
1
1
1
2
3
0
0
0
0
2
3
0
0
1
0
2
3
1
0
1
0
2
3
1
0
1
0
2
3
0
1
1
0
2
3
0
0
0
0
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 2 3
510
410
410
410
410
...

result:

points 1.0

Test #2:

score: 15
Accepted
time: 3ms
memory: 3676kb
Overall Time Limit: 250ms

input:

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

output:

510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

2
3
0
1
1
0
2
3
1
1
1
1
2
3
1
1
1
1
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
1
1
0
2
3
0
1
1
0
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3

result:

points 1.0

Test #3:

score: 15
Accepted
time: 2ms
memory: 3684kb
Overall Time Limit: 375ms

input:

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

output:

510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
0
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
1
0
-1
-1

output:

510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
...

result:

points 1.0

Test #4:

score: 15
Accepted
time: 2ms
memory: 3652kb
Overall Time Limit: 500ms

input:

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

output:

510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
84...

input:

2
3
0
1
0
1
2
3
0
0
0
0
2
3
1
0
0
1
2
3
1
0
1
0
2
3
0
1
0
0
2
3
1
0
1
0
2
3
1
0
0
1
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
1
0
0
2
3
0
1
0
0
2
3
1
1
1
1
2
3
0
1
0
1
2
3
1
0
1
0
2
3
0
1
0
1
2
3
1
1
1
1
2
3
1
0
0
1
2
3
1
0
1
0
2
3
0
1
0
1
-1
-1

output:

510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
...

result:

points 1.0

Test #5:

score: 15
Accepted
time: 8ms
memory: 3652kb
Overall Time Limit: 2000ms

input:

1
3
1
0
0
0
0
1
3
2
0
0
1
0
1
3
1
0
0
0
0
1
3
1
0
0
0
0
1
3
1
0
0
0
0
1
3
3
0
1
0
1
1
3
2
0
0
1
0
1
3
3
0
1
0
1
1
3
3
0
1
0
1
1
3
2
0
0
1
0
1
3
3
0
1
0
1
1
3
3
0
1
0
1
1
3
3
0
1
0
1
1
3
3
0
1
0
1
1
3
1
0
0
0
0
1
3
2
0
0
1
0
1
3
1
0
0
0
0
1
3
3
0
1
0
1
1
3
1
0
0
0
0
1
3
1
0
0
0
0
1
3
3
0
1
0
1
1
3
1
...

output:

510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
84...

input:

2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
0
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
1
0
1
2
3
0
1
0
1
2
3
0
0
1
0
2
3
0
0
1
0
2
3
0
0
0
0
2
3
0
0
0
0
2
3
0
0
0
0
...

output:

510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
...

result:

points 1.0

Test #6:

score: 15
Accepted
time: 3ms
memory: 3584kb
Overall Time Limit: 250ms

input:

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

output:

510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 0
849 0
849 0
347
510
849 1
84...

input:

2
3
0
1
0
0
2
3
1
0
0
1
2
3
1
1
1
0
2
3
0
1
0
1
2
3
0
1
1
1
2
3
0
1
0
1
2
3
0
1
0
1
2
3
1
1
1
0
2
3
1
0
0
1
2
3
1
1
1
1
-1
-1

output:

510
410
410
410
410
167 1 2
510
410
410
410
410
167 1 2
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 1 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 1 2
510
410
410
410
410
167 2 3

result:

points 1.0

Test #7:

score: 15
Accepted
time: 2ms
memory: 3600kb
Overall Time Limit: 375ms

input:

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

output:

510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
849 1
849 1
849 0
347
510
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 1
849 1
347
510
849 0
84...

input:

2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
2
3
0
1
1
0
-1
-1

output:

510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
167 2 3
510
410
410
410
410
...

result:

points 1.0

Subtask #2:

score: 85
Accepted

Test #8:

score: 85
Accepted
time: 59ms
memory: 3612kb
Overall Time Limit: 2210ms

input:

1
684392489
188482225
1
0
0
1
1
1
0
0
0
0
0
0
1
1
0
0
0
1
0
0
0
1
1
0
0
0
1
1
0
1
0
1
0
0
1
1
1
1
1
0
1
0
0
1
0
1
0
0
0
1
0
0
1
1
0
0
1
1
1
1
0
0
1
0
0
0
1
0
1
0
0
0
1
0
1
0
0
0
0
0
0
1
1
1
0
1
0
0
1
1
0
0
1
1
0
1
108863931
73193881
1
1
1
0
0
0
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
1
1
1...

output:

510
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
84...

input:

2
662444436
0
0
1
1
1
0
1
0
0
0
1
0
0
0
1
0
0
0
1
1
0
0
1
1
1
1
1
1
0
1
1
1
1
0
1
0
1
1
1
0
0
1
0
1
0
1
1
1
1
0
0
1
1
1
1
0
0
0
1
0
1
0
0
1
1
1
1
0
1
1
0
1
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
1
0
0
0
0
1
0
0
2
556515756
0
0
0
0
1
0
0
1
0
0
1
0
0
0
0
1
1
0
0
1
1
0
0
0
1
1
0
1
0
1
1
0
1
1
0
0
1
0
1
1
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #9:

score: 85
Accepted
time: 100ms
memory: 3720kb
Overall Time Limit: 2955ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
0
2
1000000000
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
1
0
0
1
0
2
1000000000
1
0
0
0
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
1
1
1
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #10:

score: 85
Accepted
time: 82ms
memory: 3728kb
Overall Time Limit: 2020ms

input:

1
1000000000
336586080
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
0
1
1
1
1
1
0
1
0
1
1
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
0
0
1
1000000000
995427135
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
0
0
1
0
0
1
0
0
1
0
0
0
1
1
1
...

output:

510
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
174122621
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
0
1
1
1
1
1
0
1
0
1
1
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
1
0
0
1
1
1
0
1
0
0
1
1000000000
141969875
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
0
0
1
0
0
1
0
0
1
0
0
0
1
1
1
...

output:

510
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
84...

input:

2
1000000000
1
0
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
0
0
1
1
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
1
0
1
1
1
0
0
1
0
1
0
1
0
1
0
0
1
0
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
1
1
2
1000000000
1
0
1
1
1
0
1
1
1
1
1
1
0
1
0
1
1
0
1
1
1
0
1
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
0
0
1
1
1
0
1
1
1
0
1
0
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
1
1
1
1
1
0
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
0
1
0
0
2
1000000000
1
0
1
0
1
1
0
1
1
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
1
0
0
1
1
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #11:

score: 85
Accepted
time: 47ms
memory: 3752kb
Overall Time Limit: 1235ms

input:

1
1000000000
458314021
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1000000000
458314021
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
1
0
1
1
0
0
...

output:

510
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
437207149
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1000000000
437207149
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
1
0
1
1
0
0
...

output:

510
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
84...

input:

2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
1
0
0
1
1
0
0
1
0
0
1
0
1
1
0
1
1
0
0
0
1
1
0
0
1
1
1
1
0
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
1
1
0
0
1
0
0
1
1
0
0
1
1
1
1
0
0
1
0
1
1
0
1
0
1
0
2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
1
0
1
0
0
1
0
0
1
1
0
0
0
1
1
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
1
0
0
0
0
0
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
0
0
1
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
1
1
1
0
1
0
1
1
0
0
0
1
1
1
0
1
0
2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
1
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #12:

score: 85
Accepted
time: 74ms
memory: 3676kb
Overall Time Limit: 2500ms

input:

1
1000000000
198638718
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1
0
1
1
1
0
1
1
0
0
0
0
1
0
1
0
1
0
0
0
1
0
1
1000000000
227274056
1
1
0
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
...

output:

510
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
615950227
1
1
1
1
1
0
1
0
0
0
1
1
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
1
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1
0
1
1
1
0
1
1
0
0
0
0
1
0
1
0
1
0
0
0
1
0
1
1000000000
482427607
1
1
0
0
0
0
1
0
1
0
0
1
1
0
0
1
1
1
0
1
1
0
1
1
1
0
1
1
1
0
...

output:

510
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 0
84...

input:

1
1000000000
198638718
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
0
1
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
1
0
0
1
0
0
0
1
0
0
1
1
1
1
0
0
0
0
0
1
0
1
0
1
1000000000
227274056
1
0
0
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
...

output:

510
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
84...

input:

1
1000000000
615950227
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
0
1
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
0
1
0
0
1
0
0
0
1
0
0
1
1
1
1
0
0
0
0
0
1
0
1
0
1
1000000000
482427607
1
0
0
0
0
1
1
1
1
1
0
1
0
1
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 1
84...

input:

2
1000000000
0
0
0
1
0
1
1
1
0
0
0
0
1
0
1
0
1
1
0
0
1
0
1
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
1
1
0
1
1
0
1
0
0
0
1
0
1
0
0
0
0
1
1
0
0
0
0
1
1
1
0
1
1
0
0
1
1
1
1
1
1
2
1000000000
1
1
1
0
1
1
1
1
0
1
0
1
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
1
0
1
1
0
1
0
0
1
1
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
0
1
0
0
0
0
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
1
1
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
1
1
1
1
0
1
0
1
1
0
1
1
0
1
1
1
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
1
1
1
1
0
0
1
0
2
1000000000
1
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
0
1
0
1
0
1
0
0
0
0
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
0
0
1
1
0
0
1
0
1
1
1
0
1
0
0
0
1
0
1
1
1
1
0
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
0
1
0
1
0
1
0
0
1
0
1
0
0
0
0
1
1
1
1
0
0
0
0
0
1
1
1
0
1
0
1
1
0
0
1
0
2
1000000000
0
1
0
0
0
0
1
0
0
0
1
0
0
0
0
1
1
0
1
0
0
1
0
1
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
1
1
1
0
0
1
1
1
1
1
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
1
1
1
1
0
0
1
0
0
0
1
0
0
0
0
1
0
1
1
1
0
1
0
0
1
1
0
1
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
0
0
1
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
2
1000000000
0
1
0
1
0
0
1
1
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
1
1
0
0
0
0
0
0
1
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #13:

score: 85
Accepted
time: 85ms
memory: 3676kb
Overall Time Limit: 2965ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
1
0
1
0
0
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
2
1000000000
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #14:

score: 85
Accepted
time: 82ms
memory: 3688kb
Overall Time Limit: 2955ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
1
0
1
0
0
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
2
1000000000
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #15:

score: 85
Accepted
time: 83ms
memory: 3684kb
Overall Time Limit: 2960ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
0
2
1000000000
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
1
0
0
1
0
2
1000000000
1
0
0
0
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
1
1
1
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #16:

score: 85
Accepted
time: 60ms
memory: 3680kb
Overall Time Limit: 1210ms

input:

1
1000000000
755120568
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
0
0
1
1
0
0
1
1
1
0
0
1
1
1
0
0
1
0
0
1
0
0
1
1000000000
755120568
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
84...

input:

1
1000000000
614457618
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
0
0
1
1
0
0
1
1
1
0
0
1
1
1
0
0
1
0
0
1
0
0
1
1000000000
614457618
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
84...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
0
1
0
1
0
0
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
0
0
0
1
1
1
1
0
1
1
1
0
0
1
1
0
1
0
0
0
0
0
1
1
0
1
1
1
0
1
0
0
1
1
0
1
1
1
1
0
0
0
1
0
1
0
2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
1
1
0
0
0
0
0
1
1
1
1
0
0
1
0
0
0
1
0
0
1
1
1
1
0
0
1
1
1
1
0
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
1
0
1
0
1
1
0
0
1
1
0
0
1
0
2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
1
0
0
1
1
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #17:

score: 85
Accepted
time: 34ms
memory: 3612kb
Overall Time Limit: 1050ms

input:

1
1000000000
295341091
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1000000000
135439260
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
0
...

output:

510
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

2
1000000000
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
2
1000000000
1
1
0
1
0
0
1
0
0
1
0
0
1
0
0
1
0
0
1
1
0
1
0
0
1
0
0
1
0
0
0
0
0
0
0
0
1
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #18:

score: 85
Accepted
time: 58ms
memory: 3668kb
Overall Time Limit: 2300ms

input:

1
1000000000
448772181
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
0
0
0
0
1
1
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
1
0
0
0
1
0
1
1
0
0
1
0
1
1
0
0
1
0
1
1
0
0
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
1
0
0
0
1
1
0
0
0
0
1
1
1
1000000000
183638812
0
1
0
0
0
0
0
1
0
1
0
0
0
1
0
0
0
0
0
1
0
0
1
0
0
1
0
0
0
1
...

output:

510
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
0
0
1
0
0
0
0
1
0
1
0
1
0
0
0
1
1
1
0
0
0
1
0
1
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
1
0
1
0
1
0
0
0
1
1
0
1
2
1000000000
0
0
1
0
0
1
1
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #19:

score: 85
Accepted
time: 38ms
memory: 3616kb
Overall Time Limit: 1255ms

input:

1
1000000000
143098526
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
1
1000000000
143098526
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
...

output:

510
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
84...

input:

1
1000000000
237847677
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
1
1000000000
237847677
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
...

output:

510
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
84...

input:

2
1000000000
1
1
1
0
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
0
1
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
1
0
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
0
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
0
1
1
0
1
0
0
0
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
0
1
0
0
0
1
1
1
0
1
0
1
0
1
0
1
0
0
0
0
1
0
1
1
0
1
0
0
1
0
1
0
1
1
1
1
1
1
1
0
1
1
1
1
0
0
1
1
1
1
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
1
0
1
0
1
0
1
1
1
1
0
1
1
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #20:

score: 85
Accepted
time: 51ms
memory: 3656kb
Overall Time Limit: 1250ms

input:

1
1000000000
143098526
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
1
1000000000
143098526
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
...

output:

510
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 0
84...

input:

1
1000000000
237847677
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
1
1
1
0
1
0
0
1
0
0
1
0
0
1
1
0
1
1
1
0
0
1
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
0
1
1000000000
237847677
1
1
1
1
1
0
1
1
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
0
1
0
0
0
0
...

output:

510
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
84...

input:

2
1000000000
1
1
1
0
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
0
1
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
1
0
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
0
0
0
0
0
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
0
0
0
1
0
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
1
1
0
0
0
1
1
0
0
0
1
1
0
1
0
0
0
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
1
1
0
0
0
1
1
1
1
0
1
0
0
0
1
1
1
0
1
0
1
0
1
0
1
0
0
0
0
1
0
1
1
0
1
0
0
1
0
1
0
1
1
1
1
1
1
1
0
1
1
1
1
0
0
1
1
1
1
2
1000000000
1
1
1
1
1
0
1
1
0
1
0
1
1
0
0
1
0
0
0
0
1
0
1
0
1
0
1
1
1
1
0
1
1
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #21:

score: 85
Accepted
time: 2ms
memory: 3624kb
Overall Time Limit: 250ms

input:

1
1337
42
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
1
1
1337
42
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
1
1
1337
42
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
1
1
1337
42
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
...

output:

510
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
347
510
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 0
...

input:

2
1337
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
1
2
1337
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
1
2
1337
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
1
2
1337
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
1
1
1
1
0
0
0
1
1
0
1
0
0
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
167 297 42
510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
167 297 4...

result:

points 1.0

Test #22:

score: 85
Accepted
time: 52ms
memory: 3688kb
Overall Time Limit: 1230ms

input:

1
1000000000
458314021
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1000000000
458314021
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
1
0
1
1
0
0
...

output:

510
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
437207149
1
0
1
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
0
0
0
1
1
0
1
1
0
0
0
1
1
1
1
0
0
1
1
1
0
1
0
0
1
0
0
0
1
0
1
0
1
0
1
0
1
1000000000
437207149
1
0
1
0
0
1
0
0
0
0
1
1
0
0
0
0
1
1
0
0
1
0
1
1
1
0
1
1
0
0
...

output:

510
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
84...

input:

2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
1
0
0
0
0
1
0
0
1
1
0
0
1
0
0
1
0
1
1
0
1
1
0
0
0
1
1
0
0
1
1
1
1
0
1
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
1
1
0
0
1
0
0
1
1
0
0
1
1
1
1
0
0
1
0
1
1
0
1
0
1
0
2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
0
0
1
0
1
0
0
1
0
0
1
1
0
0
0
1
1
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
1
1
0
0
1
0
0
0
0
0
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
0
1
0
1
1
0
0
1
0
1
0
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
1
0
0
1
1
1
1
0
1
0
1
1
0
0
0
1
1
1
0
1
0
2
1000000000
1
0
1
0
0
1
0
1
0
0
0
1
1
1
0
0
1
1
0
1
1
1
0
1
1
0
0
0
1
0
1
1
0
0
0
1
1
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #23:

score: 85
Accepted
time: 71ms
memory: 3724kb
Overall Time Limit: 3210ms

input:

1
1000000000
993192100
0
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1
1
0
1
0
0
1
1000000000
884727289
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
...

output:

510
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
84...

input:

1
1000000000
990822595
0
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
1
0
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
0
0
1
0
0
1
0
0
1
0
0
1
1
1
0
1
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1
1
0
1
0
0
1
1000000000
751258761
0
0
1
1
1
1
1
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
...

output:

510
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
84...

input:

2
1000000000
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
0
1
1
1
1
1
0
1
0
1
0
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
1
0
1
0
1
0
1
0
1
1
1
1
2
1000000000
1
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
0
0
0
1
1
1
0
1
0
1
1
0
0
0
0
0
0
1
1
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
1
1
1
1
1
1
1
1
0
0
1
0
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
0
0
1
1
1
1
0
1
1
1
0
1
0
1
1
1
0
0
1
1
1
0
0
1
0
0
0
1
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
1
0
0
1
0
0
2
1000000000
1
1
1
1
1
1
1
0
0
1
1
1
1
1
0
0
0
1
1
1
1
1
1
0
1
1
0
0
1
1
1
1
1
0
0
1
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #24:

score: 85
Accepted
time: 36ms
memory: 3620kb
Overall Time Limit: 1300ms

input:

1
1000000000
541788479
1
1
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
1
0
0
0
0
0
1
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
1000000000
871205524
0
1
1
0
0
1
0
1
0
1
0
0
0
1
1
0
0
0
0
0
0
1
0
0
0
1
0
0
0
...

output:

510
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
84...

input:

2
1000000000
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
0
1
1
1
0
0
1
1
0
1
1
1
0
0
0
1
0
0
1
1
0
0
1
1
0
0
1
1
1
0
1
1
0
0
1
0
0
0
0
1
0
0
1
1
1
0
1
1
0
0
1
1
0
0
0
1
0
0
1
1
0
0
1
1
1
0
1
1
0
0
1
1
1
0
1
1
2
1000000000
0
0
1
0
1
0
1
0
0
1
0
0
1
1
1
0
1
0
0
1
0
0
1
0
1
1
1
0
0
1
1
1
0
0
1
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #25:

score: 85
Accepted
time: 99ms
memory: 3684kb
Overall Time Limit: 4995ms

input:

1
1000000000
576564152
1
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
1000000000
576564152
1
1
0
1
0
1
0
0
1
1
1
1
0
0
0
0
0
0
1
0
1
1
0
0
1
1
0
1
0
0
1
...

output:

510
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
84...

input:

1
1000000000
484828360
1
1
0
1
0
1
0
0
1
1
0
1
0
1
1
0
1
0
0
1
1
0
1
1
1
0
1
1
1
0
0
0
1
1
1
0
0
0
1
1
0
0
0
1
0
0
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
0
0
0
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
0
1
0
0
0
1
0
0
0
1
0
1
0
1
0
1
1000000000
484828360
1
1
0
1
0
1
0
0
1
1
1
1
0
0
0
0
0
0
1
0
1
1
0
0
1
1
0
1
0
0
1
...

output:

510
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
84...

input:

2
1000000000
0
0
1
0
0
0
0
1
1
1
1
0
1
0
0
1
1
1
1
0
0
1
1
1
0
1
1
0
1
0
0
1
0
1
1
0
0
0
1
1
0
1
0
1
0
1
1
0
1
1
1
0
0
1
1
1
1
1
1
1
0
1
1
0
1
1
0
1
1
0
0
0
1
1
0
1
1
1
0
0
0
0
0
0
0
0
1
1
0
1
1
0
1
0
0
0
1
0
2
1000000000
0
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
1
0
1
1
1
1
1
0
1
0
0
1
0
1
1
0
1
0
0
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
0
1
0
1
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0
0
0
0
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
1
0
1
1
1
0
0
0
0
1
1
1
0
1
0
0
1
1
0
1
0
1
1
1
1
1
1
1
1
1
0
0
0
1
0
1
1
1
1
0
1
0
0
1
0
1
1
1
0
0
1
1
1
1
0
0
1
0
2
1000000000
1
1
0
1
0
1
0
0
1
1
1
1
0
0
0
1
0
0
0
0
0
1
1
0
0
0
1
0
1
0
0
0
1
0
1
1
0
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #26:

score: 85
Accepted
time: 80ms
memory: 3752kb
Overall Time Limit: 2000ms

input:

1
1000000000
883386153
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
1000000000
278730866
0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
84...

input:

2
1000000000
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
0
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
2
1000000000
0
1
0
0
0
0
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
1
0
0
0
1
0
0
0
0
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #27:

score: 85
Accepted
time: 54ms
memory: 3728kb
Overall Time Limit: 1220ms

input:

1
1000000000
755120568
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
0
0
1
1
0
0
1
1
1
0
0
1
1
1
0
0
1
0
0
1
0
0
1
1000000000
755120568
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
84...

input:

1
1000000000
614457618
0
0
1
0
1
1
1
1
0
0
1
1
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
0
0
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
1
0
1
0
0
1
0
1
0
0
1
1
1
1
1
1
0
0
0
1
1
1
1
1
1
1
1
1
1
0
0
1
1
0
0
1
1
1
0
0
1
1
1
0
0
1
0
0
1
0
0
1
1000000000
614457618
0
0
1
1
0
1
0
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
0
0
1
1
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
84...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
0
1
0
1
0
0
1
1
1
1
1
1
1
0
1
1
1
0
1
1
0
0
0
0
1
1
1
1
0
1
1
1
0
0
1
1
0
1
0
0
0
0
0
1
1
0
1
1
1
0
1
0
0
1
1
0
1
1
1
1
0
0
0
1
0
1
0
2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
1
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
1
1
0
0
0
0
1
1
0
1
1
1
1
0
0
1
0
0
1
0
1
0
0
1
1
0
0
0
0
0
1
1
1
1
0
0
1
0
0
0
1
0
0
1
1
1
1
0
0
1
1
1
1
0
1
0
1
1
0
1
0
0
0
0
1
1
1
0
0
1
1
1
0
1
0
1
1
0
0
1
1
0
0
1
0
2
1000000000
0
1
1
0
0
1
1
0
0
0
1
0
1
0
0
1
1
0
1
0
0
1
0
1
1
1
1
0
1
0
0
1
0
0
1
1
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #28:

score: 85
Accepted
time: 53ms
memory: 3688kb
Overall Time Limit: 1710ms

input:

1
1000000000
182158063
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1000000000
854157332
0
0
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
...

output:

510
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
84...

input:

2
1000000000
0
1
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
2
1000000000
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #29:

score: 85
Accepted
time: 91ms
memory: 3720kb
Overall Time Limit: 2355ms

input:

1
1000000000
2321558
0
1
1
1
0
0
1
0
0
0
0
1
0
1
1
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
0
1
0
1
0
1
1
1
0
1
0
0
1
1000000000
2321558
1
0
1
1
1
0
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
0
0
0
1
0
1
0
1
1
0
...

output:

510
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
821874523
0
1
1
1
0
0
1
0
0
0
0
1
0
1
1
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
0
1
1
0
0
0
0
1
1
0
0
0
0
1
1
1
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
0
1
1
0
1
1
0
0
1
1
1
1
1
1
1
1
0
0
0
0
1
1
0
1
0
1
0
1
1
1
0
1
0
0
1
1000000000
821874523
1
0
1
1
1
0
1
1
1
0
1
0
0
0
1
1
1
1
1
0
1
1
0
0
0
1
0
1
0
1
...

output:

510
849 0
849 0
849 1
849 0
849 0
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
84...

input:

2
1000000000
0
1
1
1
0
0
1
1
0
1
1
1
0
1
0
0
0
0
1
0
0
1
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
1
0
0
0
0
1
1
1
0
0
0
1
0
0
1
1
1
1
1
1
0
0
0
0
0
0
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
1
1
1
0
1
1
1
0
2
1000000000
0
1
1
1
0
1
0
1
1
0
1
0
0
1
1
0
0
0
1
1
0
1
0
1
0
0
0
0
0
0
0
1
0
0
1
0
1
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
1
1
0
1
0
1
1
0
1
0
0
1
0
0
0
1
0
0
0
1
0
0
1
1
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
1
0
0
0
0
1
0
0
1
1
0
0
0
1
0
0
0
0
0
0
1
1
1
1
1
0
0
1
1
0
0
1
1
1
0
0
1
1
0
0
1
0
1
1
0
1
0
0
1
0
0
2
1000000000
0
1
1
1
0
0
1
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
1
1
0
0
1
1
1
0
0
1
1
1
1
0
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #30:

score: 85
Accepted
time: 79ms
memory: 3748kb
Overall Time Limit: 2960ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
849 1
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
0
1
1
1
1
1
1
1
1
1
1
0
0
0
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
1
1
1
1
1
1
0
1
1...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
0
0
1
1
0
0
1
1
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
0
1
1
0
0
1
1
0
0
0
0
1
0
1
0
0
0
0
0
0
1
0
1
0
0
1
0
1
0
1
0
0
1
0
1
0
0
1
1
0
0
0
1
0
0
0
1
1
1
1
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
0
0
0
0
0
1
0
0
0
0
0
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 1
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
0
0
1
1
1
1
0
1
0
1
0
0
1
0
0
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
1
1
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
2
1000000000
1
1
0
1
1
1
0
0
1
1
1
1
1
0
1
0
1
0
1
0
1
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
0
0
0
0
1
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
0
1
0
1
0
0
0
0
0
1
0
0
1
1
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
0
1
0
0
1
0
1
0
1
0
1
1
0
0
1
1
0
0
0
0
1
0
2
1000000000
1
0
0
0
0
0
0
1
0
0
0
1
1
1
1
0
0
0
0
1
1
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
0
1
0
1
1
0
1
0
1
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
1
1
0
0
1
1
0
1
0
1
1
1
1
0
0
0
0
1
1
0
0
0
0
0
0
1
1
0
0
1
0
1
0
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
0
0
0
0
1
0
1
0
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
0
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
1
0
0
1
1
0
0
0
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0

Test #31:

score: 85
Accepted
time: 106ms
memory: 3688kb
Overall Time Limit: 2965ms

input:

1
1000000000
684392485
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
1
0
1
1
1
1
1
1000000000
235162311
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0
...

output:

510
849 0
849 1
849 1
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
84...

input:

1
1000000000
872874714
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1000000000
52798983
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
0
0
0
1
0
1
0
1
1
1
0
1
0...

output:

510
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 0
849 1
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 0
84...

input:

1
1000000000
694087436
0
1
1
0
0
1
0
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
1
1
1
1
1
1
1
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
1
1
1
1
1
1
1
0
1
1
0
0
1
0
1
1
0
1
1
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
0
1
1
1
0
1
0
1
1000000000
737327485
1
1
1
0
1
0
1
0
0
1
1
1
1
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
...

output:

510
849 0
849 1
849 1
849 0
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 0
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 1
849 0
849 1
849 1
849 1
849 0
849 1
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 0
849 0
849 1
849 1
849 0
84...

input:

2
1000000000
0
1
1
1
1
0
1
0
0
0
1
1
0
1
1
1
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
0
1
0
0
0
0
1
1
1
1
0
1
0
1
0
0
0
0
1
0
1
0
1
0
0
0
0
0
0
1
1
1
1
0
1
1
1
1
0
1
1
1
0
0
1
1
1
1
1
1
0
0
0
0
1
1
0
1
1
0
0
0
1
0
1
0
2
1000000000
1
1
0
1
0
0
0
0
0
1
1
0
0
0
0
1
0
1
0
1
1
1
0
1
0
1
0
1
1
0
1
1
1
1
1
0
1
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
1
0
0
0
1
1
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
0
0
0
1
0
1
1
0
1
1
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
0
1
0
1
0
1
1
1
0
0
0
0
1
1
1
0
1
0
1
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
1
1
0
1
1
1
0
0
1
1
0
0
1
0
2
1000000000
1
0
0
0
0
0
0
1
1
0
1
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
0
1
0
0
0
0
0
0
1
1
0
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

input:

2
1000000000
0
1
0
1
0
1
0
1
0
1
1
1
0
1
0
0
0
1
1
0
0
0
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
0
1
1
1
0
1
1
0
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
0
1
1
0
1
0
1
0
1
0
1
0
1
1
1
0
1
1
1
0
1
0
1
1
1
1
2
1000000000
1
0
0
0
0
1
1
1
1
1
0
1
1
0
1
0
1
0
0
0
1
1
0
0
0
1
1
1
1
1
0
1
1
0
1
0
0
1
1
...

output:

510
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
410
...

result:

points 1.0