import java.io.*;
import java.math.*;
import java.util.*;

public class E {

	static final int[] DX = { -1, 0, 1, 0 };
	static final int[] DY = { 0, -1, 0, 1 };

	static final int P = 1_000_000_007;

	static final int CACHE_SIZE = 1 << 19;
	int[] cacheInv = new int[CACHE_SIZE];
	{
		cacheInv[1] = 1;
		for (int i = 2; i < CACHE_SIZE; i++) {
			cacheInv[i] = P - (int) ((long) (P / i) * cacheInv[P % i] % P);
		}
	}

	int inv(int x) {
		return x < CACHE_SIZE ? cacheInv[x] : P
				- (int) ((long) (P / x) * inv(P % x) % P);
	}

	void submit() {
		// long start = System.currentTimeMillis();
		int r = nextInt();
		int[] byDir = new int[4];
		int sum = 0;
		for (int i = 0; i < 4; i++) {
			byDir[i] = nextInt();
			sum += byDir[i];
		}

		int invSum = inv(sum);

		for (int i = 0; i < 4; i++) {
			byDir[i] = (int) ((long) byDir[i] * invSum % P);
		}

		int s = 2 * r + 3;

		int[][] f = new int[s][s];
		int[] cx = new int[s * s];
		int[] cy = new int[s * s];
		int vars = 0;
		for (int i = 0; i < s; i++) {
			for (int j = 0; j < s; j++) {
				int sum2 = (i - r - 1) * (i - r - 1) + (j - r - 1)
						* (j - r - 1);
				if (sum2 <= r * r) {
					cx[vars] = i;
					cy[vars] = j;
					f[i][j] = vars++;
				} else {
					f[i][j] = -1;
				}
			}
		}

		int band = 0;

		for (int i = 0; i < vars; i++) {
			int x0 = cx[i];
			int y0 = cy[i];
			for (int dir = 0; dir < 4; dir++) {
				int x1 = x0 + DX[dir];
				int y1 = y0 + DY[dir];
				if (f[x1][y1] == -1) {
					continue;
				}
				int j = f[x1][y1];
				band = Math.max(band, Math.abs(i - j));
			}
		}

		int[][] bandM = new int[vars][2 * band + 1];

		for (int i = 0; i < vars; i++) {
			int x0 = cx[i];
			int y0 = cy[i];
			for (int dir = 0; dir < 4; dir++) {
				int x1 = x0 + DX[dir];
				int y1 = y0 + DY[dir];
				if (f[x1][y1] == -1) {
					continue;
				}
				int j = f[x1][y1];

				updateBandedMatrix(i, j, band, bandM, byDir[dir]);

			}
		}

		for (int i = 0; i < vars; i++) {
			for (int d = 0; d <= 2 * band; d++) {
				int j = i + d - band;
				bandM[i][d] = (i == j ? 1 : 0) - bandM[i][d];
				if (bandM[i][d] < 0) {
					bandM[i][d] += P;
				}
			}
		}

		// out.println(System.currentTimeMillis() - start);

		int[] ans = inverseBanded(bandM, band, f[r + 1][r + 1]);

		// out.println(System.currentTimeMillis() - start);

		int ret = 0;
		for (int x : ans) {
			ret += x;
			if (ret >= P) {
				ret -= P;
			}
		}

		out.println(ret);

	}

	void updateBandedMatrix(int row, int col, int width, int[][] m, double delta) {
		if (Math.abs(row - col) > width) {
			throw new AssertionError();
		}
		m[row][col - row + width] += delta;
	}

	int[] inverseBanded(int[][] a, int w, int whatCol) {
		int n = a.length;
		if (whatCol > n) {
			throw new AssertionError();
		}
		int[] b = new int[n];
		b[whatCol] = 1;

		for (int j = 0; j < n; j++) {
			int[] aj = a[j];
			for (int i = j + 1; i <= j + w && i < n; i++) {
				int[] ai = a[i];
				int coef = (int) ((long) ai[j - i + w] * inv(aj[w]) % P);

				int kUpTo = Math.min(n, j + w + 1);

				for (int k = j + 1; k < kUpTo; k++) {
					int kek = ai[k - i + w]
							- (int) ((long) aj[k - j + w] * coef % P);
					if (kek < 0) {
						kek += P;
					}
					ai[k - i + w] = kek;
				}
				b[i] -= (int) ((long) b[j] * coef % P);
				if (b[i] < 0) {
					b[i] += P;
				}
			}
		}

		// for (int i = n - 1; i >= 0; i--) {
		// for (int j = i + 1; j < n && j <= i + w; j++) {
		// b[i] -= (int) ((long) b[j] * a[i][j - i + w] % P);
		// if (b[i] < 0) {
		// b[i] += P;
		// }
		// }
		// b[i] = (int) ((long) b[i] * inv(a[i][w]) % P);
		// }

		for (int i = n - 1; i >= 0; i--) {
			long tot = 0;
			for (int j = i + 1; j < n && j <= i + w; j++) {
				tot += (long) b[j] * a[i][j - i + w];
				if (tot >= P2) {
					tot -= P2;
				}
			}
			b[i] -= (int) (tot % P);
			if (b[i] < 0) {
				b[i] += P;
			}
			b[i] = (int) ((long) b[i] * inv(a[i][w]) % P);
		}

		return b;
	}

	static final long P2 = (long) P * P;

	void preCalc() {

	}

	void test() {

	}

	void stress() {
		for (int tst = 0;; tst++) {
			if (false) {
				throw new AssertionError();
			}
			System.err.println(tst);
		}
	}

	E() throws IOException {
		is = System.in;
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		// stress();
		// test();
		out.close();
	}

	static final Random rng = new Random();
	static final int C = 5;

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new E();
	}

	private InputStream is;
	PrintWriter out;

	private byte[] buf = new byte[1 << 14];
	private int bufSz = 0, bufPtr = 0;

	private int readByte() {
		if (bufSz == -1)
			throw new RuntimeException("Reading past EOF");
		if (bufPtr >= bufSz) {
			bufPtr = 0;
			try {
				bufSz = is.read(buf);
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			if (bufSz <= 0)
				return -1;
		}
		return buf[bufPtr++];
	}

	private boolean isTrash(int c) {
		return c < 33 || c > 126;
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isTrash(b))
			;
		return b;
	}

	String nextToken() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	String nextString() {
		int b = readByte();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b) || b == ' ') {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	char nextChar() {
		return (char) skip();
	}

	int nextInt() {
		int ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}

	long nextLong() {
		long ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}
}


import java.io.*;
import java.math.*;
import java.util.*;

public class E {

	static final int[] DX = { -1, 0, 1, 0 };
	static final int[] DY = { 0, -1, 0, 1 };

	static final int P = 1_000_000_007;

	static final int CACHE_SIZE = 1 << 19;
	int[] cacheInv = new int[CACHE_SIZE];
	{
		cacheInv[1] = 1;
		for (int i = 2; i < CACHE_SIZE; i++) {
			cacheInv[i] = P - (int) ((long) (P / i) * cacheInv[P % i] % P);
		}
	}

	int inv(int x) {
		return x < CACHE_SIZE ? cacheInv[x] : P
				- (int) ((long) (P / x) * inv(P % x) % P);
	}

	void submit() {
		// long start = System.currentTimeMillis();
		int r = nextInt();
		int[] byDir = new int[4];
		int sum = 0;
		for (int i = 0; i < 4; i++) {
			byDir[i] = nextInt();
			sum += byDir[i];
		}

		int invSum = inv(sum);

		for (int i = 0; i < 4; i++) {
			byDir[i] = (int) ((long) byDir[i] * invSum % P);
		}

		int s = 2 * r + 3;

		int[][] f = new int[s][s];
		int[] cx = new int[s * s];
		int[] cy = new int[s * s];
		int vars = 0;
		for (int i = 0; i < s; i++) {
			for (int j = 0; j < s; j++) {
				int sum2 = (i - r - 1) * (i - r - 1) + (j - r - 1)
						* (j - r - 1);
				if (sum2 <= r * r) {
					cx[vars] = i;
					cy[vars] = j;
					f[i][j] = vars++;
				} else {
					f[i][j] = -1;
				}
			}
		}

		int band = 0;

		for (int i = 0; i < vars; i++) {
			int x0 = cx[i];
			int y0 = cy[i];
			for (int dir = 0; dir < 4; dir++) {
				int x1 = x0 + DX[dir];
				int y1 = y0 + DY[dir];
				if (f[x1][y1] == -1) {
					continue;
				}
				int j = f[x1][y1];
				band = Math.max(band, Math.abs(i - j));
			}
		}

		int[][] bandM = new int[vars][2 * band + 1];

		for (int i = 0; i < vars; i++) {
			int x0 = cx[i];
			int y0 = cy[i];
			for (int dir = 0; dir < 4; dir++) {
				int x1 = x0 + DX[dir];
				int y1 = y0 + DY[dir];
				if (f[x1][y1] == -1) {
					continue;
				}
				int j = f[x1][y1];

				updateBandedMatrix(i, j, band, bandM, byDir[dir]);

			}
		}

		for (int i = 0; i < vars; i++) {
			for (int d = 0; d <= 2 * band; d++) {
				int j = i + d - band;
				bandM[i][d] = (i == j ? 1 : 0) - bandM[i][d];
				if (bandM[i][d] < 0) {
					bandM[i][d] += P;
				}
			}
		}

		// out.println(System.currentTimeMillis() - start);

		int[] ans = inverseBanded(bandM, band, f[r + 1][r + 1]);

		// out.println(System.currentTimeMillis() - start);

		int ret = 0;
		for (int x : ans) {
			ret += x;
			if (ret >= P) {
				ret -= P;
			}
		}

		out.println(ret);

	}

	void updateBandedMatrix(int row, int col, int width, int[][] m, double delta) {
		if (Math.abs(row - col) > width) {
			throw new AssertionError();
		}
		m[row][col - row + width] += delta;
	}

	int[] inverseBanded(int[][] a, int w, int whatCol) {
		int n = a.length;
		if (whatCol > n) {
			throw new AssertionError();
		}
		int[] b = new int[n];
		b[whatCol] = 1;

		for (int j = 0; j < n; j++) {
			int[] aj = a[j];
			for (int i = j + 1; i <= j + w && i < n; i++) {
				int[] ai = a[i];
				int coef = (int) ((long) ai[j - i + w] * inv(aj[w]) % P);

				if (coef == 0) {
					continue;
				}

				int kwiUpTo = Math.min(n, j + w + 1) + w - i;

//				for (int k = j + 1, kwi = (j + 1) + w - i; k < kUpTo; k++, kwi++) {
				for (int kwi = (j + 1) + w - i; kwi < kwiUpTo; kwi++) {
					int kek = ai[kwi]
							- (int) ((long) aj[kwi + i - j] * coef % P);
					if (kek < 0) {
						kek += P;
					}
					ai[kwi] = kek;
				}
				b[i] -= (int) ((long) b[j] * coef % P);
				if (b[i] < 0) {
					b[i] += P;
				}
			}
		}

		for (int i = n - 1; i >= 0; i--) {
			long tot = 0;
			for (int j = i + 1; j < n && j <= i + w; j++) {
				tot += (long) b[j] * a[i][j - i + w];
				if (tot >= P2) {
					tot -= P2;
				}
			}
			b[i] -= (int) (tot % P);
			if (b[i] < 0) {
				b[i] += P;
			}
			b[i] = (int) ((long) b[i] * inv(a[i][w]) % P);
		}

		return b;
	}

	static final long P2 = (long) P * P;

	void preCalc() {

	}

	void test() {

	}

	void stress() {
		for (int tst = 0;; tst++) {
			if (false) {
				throw new AssertionError();
			}
			System.err.println(tst);
		}
	}

	E() throws IOException {
		is = System.in;
		out = new PrintWriter(System.out);
		preCalc();
		submit();
		// stress();
		// test();
		out.close();
	}

	static final Random rng = new Random();
	static final int C = 5;

	static int rand(int l, int r) {
		return l + rng.nextInt(r - l + 1);
	}

	public static void main(String[] args) throws IOException {
		new E();
	}

	private InputStream is;
	PrintWriter out;

	private byte[] buf = new byte[1 << 14];
	private int bufSz = 0, bufPtr = 0;

	private int readByte() {
		if (bufSz == -1)
			throw new RuntimeException("Reading past EOF");
		if (bufPtr >= bufSz) {
			bufPtr = 0;
			try {
				bufSz = is.read(buf);
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
			if (bufSz <= 0)
				return -1;
		}
		return buf[bufPtr++];
	}

	private boolean isTrash(int c) {
		return c < 33 || c > 126;
	}

	private int skip() {
		int b;
		while ((b = readByte()) != -1 && isTrash(b))
			;
		return b;
	}

	String nextToken() {
		int b = skip();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	String nextString() {
		int b = readByte();
		StringBuilder sb = new StringBuilder();
		while (!isTrash(b) || b == ' ') {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	double nextDouble() {
		return Double.parseDouble(nextToken());
	}

	char nextChar() {
		return (char) skip();
	}

	int nextInt() {
		int ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}

	long nextLong() {
		long ret = 0;
		int b = skip();
		if (b != '-' && (b < '0' || b > '9')) {
			throw new InputMismatchException();
		}
		boolean neg = false;
		if (b == '-') {
			neg = true;
			b = readByte();
		}
		while (true) {
			if (b >= '0' && b <= '9') {
				ret = ret * 10 + (b - '0');
			} else {
				if (b != -1 && !isTrash(b)) {
					throw new InputMismatchException();
				}
				return neg ? -ret : ret;
			}
			b = readByte();
		}
	}
}


import java.util.*;
import java.io.*;

public class 852HBobsAndStages {

	class Bubble {
		int x, y;
		int id1, id2;

		public Bubble(int x, int y) {
			this.x = x;
			this.y = y;
		}

		int q() {
			if (x == 0 && y == 0) {
				return 0;
			} else if (x > 0 || (x == 0 && y > 0)) {
				return 1;
			} else {
				return 2;
			}
		}
		@Override
		public String toString() {
			return "Bubble [x=" + x + ", y=" + y + ", id1=" + id1 + ", id2=" + id2 + "]";
		}
	}

	long vectMul(Bubble a, Bubble b) {
		return 1L * a.x * b.y - 1L * a.y * b.x;
	}

	long vectMul(Bubble a, Bubble b, Bubble c) {
		return 1L * (b.x - a.x) * (c.y - a.y) - 1L * (b.y - a.y) * (c.x - a.x);
	}

	void solve() {
		int n = in.nextInt();
		int k = in.nextInt();
		Bubble[] a = new Bubble[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Bubble(in.nextInt(), in.nextInt());
		}
		Arrays.sort(a, (p1, p2) -> {
			if (p1.x != p2.x) {
				return p1.x - p2.x;
			}
			return p1.y - p2.y;
		});

		long result = 0;
		long[][] dp = new long[n][k + 1];
		long[][] cost = new long[n][n];
		long INF = Long.MIN_VALUE / 3;
		Bubble[] buf = new Bubble[n];
		for (int i = 0; i < buf.length; i++) {
			buf[i] = new Bubble(0, 0);
		}
		Bubble[] vecs = new Bubble[n * (n - 1)];
		for (int i = 0, tmp = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (i != j) {
					vecs[tmp] = new Bubble(a[j].x - a[i].x, a[j].y - a[i].y);
					vecs[tmp].id1 = i;
					vecs[tmp].id2 = j;
					tmp++;
				}
			}
		}
		Arrays.sort(vecs, (p1, p2) -> {
			int q1 = p1.q(), q2 = p2.q();
			if (q1 != q2) {
				return q1 - q2;
			}
			return -Long.signum(vectMul(p1, p2));
		});
		for (int start = 0; start < n; start++) {
			for (int i = n - 1; i >= start; i--) {
				a[i].x -= a[start].x;
				a[i].y -= a[start].y;
			}
			for (int i = 0; i < n; i++) {
				Arrays.fill(dp[i], INF);
				Arrays.fill(cost[i], INF);
			}
			dp[start][0] = 0;

			int size = 0;
			for (int i = start + 1; i < n; i++) {
				buf[size].x = a[i].x;
				buf[size].y = a[i].y;
				buf[size].id1 = i;
				size++;
			}
			Arrays.sort(buf, 0, size, (p1, p2) -> {
				long v = vectMul(p1, p2);
				return -Long.signum(v);
			});

			for (int i = 0; i < size; i++) {
				for (int j = i + 1; j < size; j++) {
					int p1 = buf[i].id1, p2 = buf[j].id1;
					boolean ok = true;
					for (int t = i + 1; t < j; t++) {
						if (vectMul(buf[i], buf[j], buf[t]) > 0) {
							ok = false;
							break;
						}
					}
					if (ok) {
						cost[p1][p2] = vectMul(buf[i], buf[j]);
					}
				}
			}
			for (int i = 0; i < size; i++) {
				cost[start][buf[i].id1] = cost[buf[i].id1][start] = 0;
			}

			for (Bubble vec : vecs) {
				int p1 = vec.id1, p2 = vec.id2;
				long cst = cost[p1][p2];
				if (cst != INF) {
					long[] dp1 = dp[p1], dp2 = dp[p2];
					for (int i = 0; i < k; i++) {
						dp2[i + 1] = Math.max(dp2[i + 1], dp1[i] + cst);
					}
				}
			}
			result = Math.max(result, dp[start][k]);
		}

		out.printf("%d.%02d\n", result / 2, 50 * (result % 2));
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

	public static void main(String[] args) {
		new 852HBobsAndStages().run();
	}
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class 808ALuckyYear
{

    public static void main(String[] args)
    {
        Scanner in=new Scanner(System.in);

        String s=in.next();
        StringBuilder ss=new StringBuilder();

        if(s.length()==1)
        {
            System.out.println("1");
        }

        else
        {
            if(s.charAt(0)!='9')
            {
                char ch=(char) ((int)s.charAt(0)+1);
                ss.append(ch);
            }

            else
                ss.append("10");

            for(int i=1;i<s.length();i++)
                ss.append('0');

            BigInteger x=new BigInteger(s);
            BigInteger y=new BigInteger(ss.toString());

            System.out.println(y.subtract(x));
        }

    }
}


import java.util.*;
import java.io.*;

public class 852HBobsAndSta {

	class Point {
		int x, y;
		int id1, id2;

		public Point(int x, int y) {
			this.x = x;
			this.y = y;
		}

		int q() {
			if (x == 0 && y == 0) {
				return 0;
			} else if (x > 0 || (x == 0 && y > 0)) {
				return 1;
			} else {
				return 2;
			}
		}
		@Override
		public String toString() {
			return "Point [x=" + x + ", y=" + y + ", id1=" + id1 + ", id2=" + id2 + "]";
		}
	}

	long vectMul(Point a, Point b) {
		return 1L * a.x * b.y - 1L * a.y * b.x;
	}

	long vectMul(Point a, Point b, Point c) {
		return 1L * (b.x - a.x) * (c.y - a.y) - 1L * (b.y - a.y) * (c.x - a.x);
	}

	void solve() {
		int n = in.nextInt();
		int k = in.nextInt();
		Point[] a = new Point[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Point(in.nextInt(), in.nextInt());
		}
		Arrays.sort(a, (p1, p2) -> {
			if (p1.x != p2.x) {
				return p1.x - p2.x;
			}
			return p1.y - p2.y;
		});

		long result = 0;
		long[][] dp = new long[n][k + 1];
		long[][] cost = new long[n][n];
		long INF = Long.MIN_VALUE / 3;
		Point[] buf = new Point[n];
		for (int i = 0; i < buf.length; i++) {
			buf[i] = new Point(0, 0);
		}
		Point[] vecs = new Point[n * (n - 1)];
		for (int i = 0, tmp = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (i != j) {
					vecs[tmp] = new Point(a[j].x - a[i].x, a[j].y - a[i].y);
					vecs[tmp].id1 = i;
					vecs[tmp].id2 = j;
					tmp++;
				}
			}
		}
		Arrays.sort(vecs, (p1, p2) -> {
			int q1 = p1.q(), q2 = p2.q();
			if (q1 != q2) {
				return q1 - q2;
			}
			return -Long.signum(vectMul(p1, p2));
		});
		for (int start = 0; start < n; start++) {
			for (int i = n - 1; i >= start; i--) {
				a[i].x -= a[start].x;
				a[i].y -= a[start].y;
			}
			for (int i = 0; i < n; i++) {
				Arrays.fill(dp[i], INF);
				Arrays.fill(cost[i], INF);
			}
			dp[start][0] = 0;

			int size = 0;
			for (int i = start + 1; i < n; i++) {
				buf[size].x = a[i].x;
				buf[size].y = a[i].y;
				buf[size].id1 = i;
				size++;
			}
			Arrays.sort(buf, 0, size, (p1, p2) -> {
				long v = vectMul(p1, p2);
				return -Long.signum(v);
			});

			for (int i = 0; i < size; i++) {
				for (int j = i + 1; j < size; j++) {
					int p1 = buf[i].id1, p2 = buf[j].id1;
					boolean ok = true;
					for (int t = i + 1; t < j; t++) {
						if (vectMul(buf[i], buf[j], buf[t]) > 0) {
							ok = false;
							break;
						}
					}
					if (ok) {
						cost[p1][p2] = vectMul(buf[i], buf[j]);
					}
				}
			}
			for (int i = 0; i < size; i++) {
				cost[start][buf[i].id1] = cost[buf[i].id1][start] = 0;
			}

			for (Point vec : vecs) {
				int p1 = vec.id1, p2 = vec.id2;
				long cst = cost[p1][p2];
				if (cst != INF) {
					long[] dp1 = dp[p1], dp2 = dp[p2];
					for (int i = 0; i < k; i++) {
						dp2[i + 1] = Math.max(dp2[i + 1], dp1[i] + cst);
					}
				}
			}
			result = Math.max(result, dp[start][k]);
		}

		out.printf("%d.%02d\n", result / 2, 50 * (result % 2));
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

	public static void main(String[] args) {
		new H().run();
	}
}


import java.util.*;
import java.io.*;

public class 852HBobsAndStages {

	class Bubble {
		int x, y;
		int id1, id2;

		public Bubble(int x, int y) {
			this.x = x;
			this.y = y;
		}

		int q() {
			if (x == 0 && y == 0) {
				return 0;
			} else if (x > 0 || (x == 0 && y > 0)) {
				return 1;
			} else {
				return 2;
			}
		}
		@Override
		public String toString() {
			return "Bubble [x=" + x + ", y=" + y + ", id1=" + id1 + ", id2=" + id2 + "]";
		}
	}

	long vectMul(Bubble a, Bubble b) {
		return 1L * a.x * b.y - 1L * a.y * b.x;
	}

	long vectMul(Bubble a, Bubble b, Bubble c) {
		return 1L * (b.x - a.x) * (c.y - a.y) - 1L * (b.y - a.y) * (c.x - a.x);
	}

	void solve() {
		int n = in.nextInt();
		int k = in.nextInt();
		Bubble[] a = new Bubble[n];
		for (int i = 0; i < n; i++) {
			a[i] = new Bubble(in.nextInt(), in.nextInt());
		}
		Arrays.sort(a, (p1, p2) -> {
			if (p1.x != p2.x) {
				return p1.x - p2.x;
			}
			return p1.y - p2.y;
		});

		long result = 0;
		long[][] dp = new long[n][k + 1];
		long[][] cost = new long[n][n];
		long INF = Long.MIN_VALUE / 3;
		Bubble[] buf = new Bubble[n];
		for (int i = 0; i < buf.length; i++) {
			buf[i] = new Bubble(0, 0);
		}
		Bubble[] vecs = new Bubble[n * (n - 1)];
		for (int i = 0, tmp = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				if (i != j) {
					vecs[tmp] = new Bubble(a[j].x - a[i].x, a[j].y - a[i].y);
					vecs[tmp].id1 = i;
					vecs[tmp].id2 = j;
					tmp++;
				}
			}
		}
		Arrays.sort(vecs, (p1, p2) -> {
			int q1 = p1.q(), q2 = p2.q();
			if (q1 != q2) {
				return q1 - q2;
			}
			return -Long.signum(vectMul(p1, p2));
		});
		for (int start = 0; start < n; start++) {
			for (int i = n - 1; i >= start; i--) {
				a[i].x -= a[start].x;
				a[i].y -= a[start].y;
			}
			for (int i = 0; i < n; i++) {
				Arrays.fill(dp[i], INF);
				Arrays.fill(cost[i], INF);
			}
			dp[start][0] = 0;

			int size = 0;
			for (int i = start + 1; i < n; i++) {
				buf[size].x = a[i].x;
				buf[size].y = a[i].y;
				buf[size].id1 = i;
				size++;
			}
			Arrays.sort(buf, 0, size, (p1, p2) -> {
				long v = vectMul(p1, p2);
				return -Long.signum(v);
			});

			for (int i = 0; i < size; i++) {
				for (int j = i + 1; j < size; j++) {
					int p1 = buf[i].id1, p2 = buf[j].id1;
					boolean ok = true;
					for (int t = i + 1; t < j; t++) {
						if (vectMul(buf[i], buf[j], buf[t]) > 0) {
							ok = false;
							break;
						}
					}
					if (ok) {
						cost[p1][p2] = vectMul(buf[i], buf[j]);
					}
				}
			}
			for (int i = 0; i < size; i++) {
				cost[start][buf[i].id1] = cost[buf[i].id1][start] = 0;
			}

			for (Bubble vec : vecs) {
				int p1 = vec.id1, p2 = vec.id2;
				long cst = cost[p1][p2];
				if (cst != INF) {
					long[] dp1 = dp[p1], dp2 = dp[p2];
					for (int i = 0; i < k; i++) {
						dp2[i + 1] = Math.max(dp2[i + 1], dp1[i] + cst);
					}
				}
			}
			result = Math.max(result, dp[start][k]);
		}

		out.printf("%d.%02d\n", result / 2, 50 * (result % 2));
	}

	FastScanner in;
	PrintWriter out;

	void run() {
		in = new FastScanner();
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		public FastScanner(String s) {
			try {
				br = new BufferedReader(new FileReader(s));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		public String nextToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
				}
			}
			return st.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() {
			return Long.parseLong(nextToken());
		}

		public double nextDouble() {
			return Double.parseDouble(nextToken());
		}
	}

	public static void main(String[] args) {
		new H().run();
	}
}


import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream;
        try {
            inputStream = new FileInputStream("input.txt");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        OutputStream outputStream;
        try {
            outputStream = new FileOutputStream("output.txt");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        c290 solver = new c290();
        solver.solve(1, in, out);
        out.close();
    }

    static class c290 {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int sum = 0;
            for (int i = 0; i < n; i++) {
                sum += in.nextInt();
            }
            out.println((double) sum / n);
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.util.Scanner;
import java.io.*;

// The "ProblemC" class.
public class ProblemC
{
    public static void main (String[] args) throws IOException
    {
		Scanner inFile = new Scanner(new File("DATA_C.txt"));
		Scanner inSys = new Scanner(System.in);
		//PrintStream outFile = new PrintStream(new File("OUT_C.txt"));
		PrintStream outSys = new PrintStream(System.out);

		//int numloops = Integer.parseInt(inFile.nextLine());
		int numloops = Integer.parseInt(inSys.nextLine());
		int sum = 0;
		int[] nums = new int[numloops];

		for(int i = 0; i < numloops; i++)
		{
			//nums[i] = Integer.parseInt(inFile.nextLine());
			nums[i] = Integer.parseInt(inSys.nextLine());
			//System.out.println(nums[i]);
		}

		int x = 0;
		while(nums[x] <= nums[x+1])
		{
			x++;
			if(x == (numloops-1))
			{
				break;
			}
		}
		x++;
		for(int i = 0; i < x; i++)
		{
			//System.out.println(nums[i]);
			sum+=nums[i];
		}

		System.out.println(1.0 * sum / x);
    } // main method
} // ProblemC class


public class C1 {

 /**
  * @param args
  */
 public static void main(String[] args) {
  Scanner in = new Scanner(System.in);
  int tux = in.nextInt();
  int foo = 0;
  int bar = 0;
  int baz = 0;
  int quz = 1;
  for(;tux!=0;tux--) {
   int pur = in.nextInt();
   foo += pur;
   bar += 1;
   if((foo*quz*bar)>=(baz*foo*quz)) {
    baz = foo;
    quz = bar;
   }
  }
  System.out.println(baz/(float)quz);
 }
}


import java.io.*;
public class _290_C {
	boolean testOutput=true;
	public void runTestCases() throws Exception{
//		Case 0
		input=
		"3 "+
		"0 "+
		"1 "+
		"1 ";
		runTest(input,
		"0.666667 ");

	}

	public void compare(String rcAnswer, String realAnswer){
		realAnswer=realAnswer.trim();
		rcAnswer=rcAnswer.trim();
		if(realAnswer.equals(rcAnswer)){
			System.out.println("[Passed] Case "+nroCases);
		}else{
			failed=true;
			System.out.println("rChi "+rcAnswer);
			System.out.println("Expected "+realAnswer);
			System.out.println("[Failed] Case "+nroCases);
//			System.exit(0);
		}
		nroCases++;
	}

	public void runTest(String input, String output) throws Exception{
		r.in= new ByteArrayInputStream(input.getBytes());
		r.run();
		if(testOutput){
			compare(baos.toString(), output);
		}else{
			System.out.println(baos.toString());
		}
		baos.reset();
//		r.in.
	}
	_290_C_WTF r;
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	private void init() throws Exception{
		r = new _290_C_WTF();
		r.out = new PrintWriter(baos);
		runTestCases();
		if(testOutput && !failed){
			System.out.println("All test cases [Passed]");
		}
	}
	private String input;
	private int nroCases=1;
	private boolean failed=false;
	public static void main(String[] args) throws Exception {
		new _290_C().init();
	}

}


import java.util.Scanner;

public class CircleOfNumbers {
	public static void main(String[] args) {
		Scanner kbd = new Scanner(System.in);
		int input = kbd.nextInt();
		while(input < 3 && input > 100000) {
			if(input < 3 && input > 100000) {
				System.out.println("Input should be greater than three and less than 100,000.");
				input = kbd.nextInt();
			}
		}
		String number = kbd.next();
		for(int i = 0; i < number.length(); i++) {
			number[i] = number[i] + input;
		}
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskG solver = new TaskG();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskG {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            String s = in.next();
            int[] primes = new int[100];
            int nprimes = 0;
            int rem = n;
            for (int p = 2; p <= rem; ++p)
                if (rem % p == 0) {
                    while (rem % p == 0) rem /= p;
                    primes[nprimes++] = p;
                }
            primes = Arrays.copyOf(primes, nprimes);
            int prod = 1;
            for (int x : primes) prod *= x;
            int indep = n / prod;
            long[] a = new long[prod];
            for (int i = 0; i < indep; ++i) {
                for (int j = 0; j < prod; ++j) {
                    a[j] = s.charAt(i + j * indep) - '0';
                }
                if (!can(primes, a)) {
                    out.println("NO");
                    return;
                }
            }
            out.println("YES");
        }

        private boolean can(int[] primes, long[] a) {
            long[] b = new long[a.length];
            for (int p : primes) {
                for (int i = 0; i < a.length; ++i) {
                    b[i] = a[i] - a[(i + a.length / p) % a.length];
                }
                long[] t = a;
                a = b;
                b = t;
                bool allzeo = true;
                for (long x : a) if (x != 0) allzeo = false;
                if(allzeo) return true;
            }
            return false;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}


import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.*;
import java.math.BigDecimal;
import java.math.MathContext;

public class Main {
	public static BigDecimal[] a = new BigDecimal[100000];
	public static boolean[] flag = new boolean[100000];
	public static MathContext mc = new MathContext(100);
	public static final BigDecimal eps = BigDecimal.ONE.movePointLeft(50);
	public static final BigDecimal neps = BigDecimal.ZERO.subtract(eps);
	public static void main(String args[]) {
		Scanner cin = new Scanner (new BufferedInputStream(System.in));
		PrintStream cout = System.out;
//		try{
//			cin = new Scanner(new FileInputStream("in.in"));
//			cout = new PrintStream("out.out");
//		}catch (Exception e) {
//		}

		int n=cin.nextInt();
		String s = cin.next();
		for(int i=0; i<n; i++) {
			a[i]=BigDecimal.valueOf(s.charAt(i)-'0');
			flag[i]=false;
		}
		for(int i=2; i<n; i++) {
			if(flag[i] == true) continue;
			for(int j=i; j<n; j+=i) flag[j]=true;
			if((n%i) != 0) continue;
			for(int r=0; r<(n/i); r++) {
				BigDecimal sum=BigDecimal.ZERO;
				for(int j=r; j<n; j+=(n/i)) sum=sum.add(a[j]);
				sum=sum.divide(BigDecimal.valueOf(i), mc);
				for(int j=r; j<n; j+=(n/i)) a[j]=a[j].subtract(sum);
			}
		}
		boolean bad = false;
		for(int i=0; i<n; i++) {
			if(a[i].compareTo(eps) == 1 || neps.compareTo(a[i]) == 1) {
				bad=true;
				break;
			}
		}
		if(bad) cout.println("NO");
		else cout.println("YES");
	}
}


import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.PrintStream;
import java.util.*;
import java.math.BigDecimal;
import java.math.MathContext;

public class Main {
	public static BigDecimal[] a = new BigDecimal[100000];
	public static boolean[] flag = new boolean[100000];
	public static MathContext mc = new MathContext(50);
	public static final BigDecimal eps = BigDecimal.ONE.movePointLeft(25);
	public static final BigDecimal neps = BigDecimal.ZERO.subtract(eps);
	public static void main(String args[]) {
		Scanner cin = new Scanner (new BufferedInputStream(System.in));
		PrintStream cout = System.out;
//		try{
//			cin = new Scanner(new FileInputStream("in.in"));
//			cout = new PrintStream("out.out");
//		}catch (Exception e) {
//		}

		int n=cin.nextInt();
		String s = cin.next();
		for(int i=0; i<n; i++) {
			a[i]=BigDecimal.valueOf(s.charAt(i)-'0');
			flag[i]=false;
		}
		for(int i=2; i<n; i++) {
			if(flag[i] == true) continue;
			for(int j=i; j<n; j+=i) flag[j]=true;
			if((n%i) != 0) continue;
			for(int r=0; r<(n/i); r++) {
				BigDecimal sum=BigDecimal.ZERO;
				for(int j=r; j<n; j+=(n/i)) sum=sum.add(a[j], mc);
				sum=sum.divide(BigDecimal.valueOf(i), mc);
				for(int j=r; j<n; j+=(n/i)) a[j]=a[j].subtract(sum, mc);
			}
		}
		boolean bad = false;
		for(int i=0; i<n; i++) {
			if(a[i].compareTo(eps) == 1 || neps.compareTo(a[i]) == 1) {
				bad=true;
				break;
			}
		}
		if(bad) cout.println("NO");
		else cout.println("YES");
	}
}


import java.util.Scanner;

public class Turn {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		a %= 360;
		if (a > 180) {
			a -= 360;
		} else if (a < -180) {
			a += 360;
		}

		if (a > 0) {
			if ((a + 45) % 90 == 0) {
				System.out.println((a + 45) / 90 - 1);
			} else {
				System.out.println((a + 45) / 90);
			}
		} else if (a < 0) {
			if ((a + 45) % 90 == 0) {
				System.out.println(3 * -(a - 45) / 90 - 3);
			} else {
				System.out.println(3 * -(a - 45) / 90);
			}
		} else {
			System.out.println(0);
		}
	}
}


import java.util.Scanner;

public class Turn {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long a = in.nextLong();
		a %= 360;
		a += 360;
		a %= 360;

		if (a <= 45 || a >=315) {
			System.out.println(0);
		} else if (a <= 135) {
			System.out.println(1);
		} else if (a < 225) {
			System.out.println(2);
		} else {
			System.out.println(3);
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class M {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		long x = Long.parseLong(br.readLine());

		long y = Math.abs(x);

		int z = (int) ((y % 360) * (long) Math.signum(x));

		int min = (int) Math.min(Math.abs(z), Math.abs(360 - z));
		int best = 0;

		for (int i = 1; i < 4; i++) {
			z = (z + 90 + 360) % 360;
			int m = (int) Math.min(Math.abs(z), Math.abs(360 - z));
			if (m < min) {
				best = i;
				min = m;
			}
		}
		System.out.println(best);

	}

}


import java.io.*;
import java.util.*;
import java.math.*;

public class M {

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
            return Double.parseDouble(next());
        }
    }

    static InputReader r = new InputReader(System.in);
    static PrintWriter pw = new PrintWriter(System.out);

    public static void main(String[] args) {

        ArrayList<int[]> list = new ArrayList<int[]>();

        long k = r.nextLong();
        int x = (int)(k % 360);
        list.add(new int[]{0, Math.min(Math.min(Math.abs(x), Math.abs(x-360)), Math.abs(x+360))});

        for(int i = 1; i <= 3; i++){
            x -= 90;
            x %= 360;
            list.add(new int[]{i, Math.min(Math.min(Math.abs(x), Math.abs(x-360)), Math.abs(x + 360))});
        }

        Collections.sort(list, new Sort());

        for(int[] arr : list){
            System.out.println(Arrays.toString(arr));
        }

        System.out.println(list.get(0)[0]);

        pw.close();
    }

    static class Sort implements Comparator<int[]>{
        public int compare(int[] a, int[] b){
            if(a[1] == b[1]){
                return a[0] - b[0];
            } else{
                return a[1] - b[1];
            }
        }
    }
}

/**
*                _        _                 _
*               | |      | |               | |
*   ___ ___   __| | ___  | |__  _   _    __| | __ _ _ __ _ __ ___ _ __     _   _  __ _  ___
*  / __/ _ \ / _` |/ _ \ | '_ \| | | |  / _` |/ _` | '__| '__/ _ \ '_ \   | | | |/ _` |/ _ \
* | (_| (_) | (_| |  __/ | |_) | |_| | | (_| | (_| | |  | | |  __/ | | |  | |_| | (_| | (_) |
*  \___\___/ \__,_|\___| |_.__/ \__, |  \__,_|\__,_|_|  |_|  \___|_| |_|   \__, |\__,_|\___/
*                                __/ |                               ______ __/ |
*                               |___/                               |______|___/
 */


import java.util.Scanner;

public class Main
{
	public static void main( String args[] )
	{
		Scanner input = new Scanner(System.in);
		long a1 = input.nextInt();
		long b1 = input.nextInt();
		long a2 = input.nextInt();
		long b2 = input.nextInt();
		long l = input.nextInt();
		long r = input.nextInt();
		long first = 2000000000 + 1;
		long counter = 0;
		long gcd = gcd(a1, a2);
		long scm = ( a1 * a2 ) / gcd;

		if(b1>b2)
	    {
	        long c=b1;
	        b1=b2;
	        b2=c;
	        c=a1;
	        a1=a2;
	        a2=c;
	    }
	   long k1=-1,l1=0;
	    while(k1==-1)
	    {
	        if( (a2*l1+b2-b1)%a1==0)
	            k1 = (a2*l1+b2-b1)/a1;
	        else
	            l1++;
	    }
	    long x1=a1*k1+b1;

		if( x1 < l )
		{
			long m = (l - x1) / scm + 1;
			x1 += m * scm;
		}

		if( x1 != 2000000000 + 1 && x1 >= l && x1 <= r)
			counter = (r - x1) / scm + 1;

		if( x1 != l && (l - b1) % a1 == 0 && (l - b2) % a2 == 0 && (l - b1) / a1 >= 0 && (l - b2) / a2 >= 0)
			counter++;

		System.out.println(counter);

	}

	public static long gcd( long a, long b )
	{
		if( b == 0 )
			return a;

		return gcd (b, a % b );
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class Main
{
	public static void main( String args[] )
	{
		Scanner input = new Scanner(System.in);
		int a1 = input.nextInt();
		int b1 = input.nextInt();
		int a2 = input.nextInt();
		int b2 = input.nextInt();
		int l = input.nextInt();
		int r = input.nextInt();
		int first = 2000000000 + 1, counter = 0;

		if( b1 > r || b2 > r )
		{
			System.out.println(0);
			return;
		}

		for( int i = 0 ; ; i++ )
		{
			if( ((a1 * i + b1) - b2) % a2 == 0 && ((a1 * i + b1) - b2) / a2 >= 0 )
			{
				first = a1 * i + b1;

				if( first >= l && first <= r )
					break;
			}
		}

		if( first != 2000000000 + 1 )
			counter = (r - first) / (( a1 * a2 ) / gcd(a1, a2)) + 1;

		System.out.println(counter);

	}

	public static int gcd( int a, int b )
	{
		if( b == 0 )
			return a;

		return gcd (b, a % b );
	}
}


import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main
{
	public static void main( String args[] )
	{
		Scanner input = new Scanner(System.in);
		long a1 = input.nextInt();
		long b1 = input.nextInt();
		long a2 = input.nextInt();
		long b2 = input.nextInt();
		long l = input.nextInt();
		long r = input.nextInt();
		long first = 2000000000 + 1;
		long counter = 0;
		long gcd = gcd(a1, a2);

		if( b1 > r || b2 > r )
		{
			System.out.println(0);
			return;
		}

		for( long i = 0 ; ; i++ )
		{
			if( b1 >= b2 )
			{
				if( ((a1 * i + b1) - b2) % a2 == 0 &&  ((a1 * i + b1) - b2) / a2 >= 0 )
				{
					first = i * a1 + b1;
					break;
				}
			}

			if( b1 < b2 )
			{
				if( ((a2 * i + b2) - b1) % a1 == 0 &&  ((a2 * i + b2) - b1) / a1 >= 0 )
				{
					first = a2 * i + b2;
					break;
				}
			}
		}

		if( first < l )
		{
			long m = (l - first) / (( a1 * a2 ) / gcd) + 1;
			first += m * (( a1 * a2 ) / gcd);
		}

		if( first != 2000000000 + 1 )
			counter = (r - first) / (( a1 * a2 ) / gcd) + 1;

		System.out.println(counter);

	}

	public static long gcd( long a, long b )
	{
		if( b == 0 )
			return a;

		return gcd (b, a % b );
	}
}


import static java.lang.Long.max;
import static java.lang.Math.abs;
import java.math.BigInteger;
import java.util.Scanner;

public class NewClass {
    static long x,y,d;
    public static long mcd(long a, long b){
        return a==0 ? b : mcd(b%a,a);
    }

    public static long mcm(long a,long b){
     return a*(b/mcd(a,b));
    }

    public static void extendedEuclid(long a, long b){
        if(a==0){x=0;y=1;d=b;return;}
        extendedEuclid(b%a,a);
        long x1=y-(b/a)*x;
        long y1=x;
        x=x1;
        y=y1;
      }

    public static void main(String[] args) {
        long a1,b1,a2,b2,l,r;
        Scanner sc = new Scanner(System.in);
        a1 = sc.nextInt();
        b1 = sc.nextInt();
        a2 = sc.nextInt();
        b2 = sc.nextInt();
        l = sc.nextInt();
        r = sc.nextInt();
        extendedEuclid(a1,a2);
        if(abs(b2-b1)%d!=0){
            System.out.println("0");
            return;
        }
        x*=((b2-b1)/d);
        y*=((b2-b1)/d);
        d=b2-b1;
        BigInteger Bx = new BigInteger(Double.toString((x)));
        BigInteger Ba1 = new BigInteger(Double.toString((a1)));
        BigInteger Bb1 = new BigInteger(Double.toString((b1)));
        Long jaux=mcm(a1,a2);
        BigInteger j = new BigInteger(jaux.toString());
        BigInteger p= new BigInteger("");
        p =  Bx.multiply(Ba1).add(Bb1);
        Long a=max(b1,b2);
        BigInteger aa = new BigInteger(a.toString());
        if( p.compareTo(aa) < 0){
            BigInteger aux=(p.subtract(aa)).abs();
            aux = aux.divide(j);
            aux = aux.add(BigInteger.ONE);
            p = p.add(aux.multiply(j));
        }
        if(p.compareTo(aa)>0){
            BigInteger aux=(p.subtract(aa)).divide(j);
            p = p.subtract(aux.multiply(j));
        }
        l = l - Long.parseLong(p.toString()) + Long.parseLong(j.toString());
        r = r - Long.parseLong(p.toString()) + Long.parseLong(j.toString());
        long res;
        l=max(0,l);
        r=max(0,r);
        res = r/Long.parseLong(j.toString()) - l/Long.parseLong(j.toString());
        if(l%Long.parseLong(j.toString())==0){
            if(l!=0)res++;
        }

        System.out.println(res);

    }
}


/*package whatever //do not write package name here */

import java.util.*;
import java.lang.*;
import java.io.*;

 public class GFG {

	public static void main (String[] args) throws IOException {
        Scanner in=new Scanner(System.in

        String str=in.nextLine();

        for(int i=0;i<str.length()-3;i++){
          if(str.charAt(i)!=str.charAt(i+1) && str.charAt(i+1)!=str.charAt(i+2) && str.charAt(i+2)!=str.charAt(i) && str.charAt(i)!='.'  && str.charAt(i+1)!='.' && str.charAt(i+2)!='.'){
              System.out.println("Yes");
              return;
          }
        }
        System.out.println("No");
    }
}


import java.util.*;
public class Q1
{
	public static void main(String asd[])throws Exception
	{
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int l=s.length();
		boolean res=false;
		for(int x=0;x<l;x++)
		{
			char ch=s.charAt(x);
			if(ch!='.')
			{	if((x+2)<=n-1)
				{
					res=check(s.substring(x,3));
				}

			}
			if(res)
			{
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");

	}
	public static boolean check(String s)
	{
		int c=0;
		for(int x=0;x<3;x++)
		{
			char ch=s.charAt(x);
			if(ch=='A')
			{
				c++;
			}
			else if(ch=='B')
			{
				c++;
			}
			else if(ch=='C')
			{
				c++;
			}
		}
		return c==3;
	}
}


import java.util.*;
import java.lang.String;
import java.util.ArrayList;

import java.util.Scanner;
public class prob1{

    public static void main(String args[]){
        Scanner sc  = new Scanner(System.in);
        String s = sc.nextLine();
        ArrayList<String> check = new ArrayList<String>();
        check.add("ABC");check.add("ACB");check.add("BAC");check.add("BCA");check.add("CAB");check.add("CBA");
        int cas=0;
        for( i=0;i<s.length()-2;i++){
            if(check.contains(s.substring(i,i+3))){
                System.out.println("Yes");
                cas = 1;
                break;
            }
        }
        if(cas==0){
            System.out.println("No");
        }

        //System.out.println(multiply("5","7"));
    	//System.out.println(ans.length());
    }
}


import java.util.*;
public class Q1
{
	public static void main(String asd[])throws Exception
	{
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		int l=s.length();
		boolean res=false;
		for(int x=0;x<l;x++)
		{
			char ch=s.charAt(x);
			if(ch!='.')
			{
				res=check(s.substring(x,3));

			}
			if(res)
			{
				System.out.println("YES");
				return;
			}
		}
		System.out.println("NO");

	}
	public boolean check(String s)
	{
		int c=0;
		for(int x=0;x<3;x++)
		{
			char ch=s.charAt(x);
			if(ch=='A')
			{
				c++;
			}
			else if(ch=='B')
			{
				c++;
			}
			else if(ch=='C')
			{
				c++;
			}
		}
		return c==3;
	}
}


import java.util.*;
public class cf4
{
	static int fact[];
	public static int max(int a,int b)
	{
		return a>b?a:b;
	}
	public static int min(int a,int b)
	{
		return a<b?a:b;
	}
	public static int[] factorial(int A[])
	{
		int f=1;
		A[0]=1;
		for(int i=1;i<A.length;i++)
		{
			f*=i;
			A[i]=f;
		}
		return A;
	}
	public static int Combination(int n,int r)
	{
		return ((fact[n])/(fact[r]*fact[n-r]));
	}
	public static long ans(int A,int B)
	{
		long sum=0;
		for(int k=0;k<=min(A,B);k++)
		{
			sum=sum+(Combination(A,k)*Combination(B,k)*fact[k]);
		}
		return sum;
	}
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int max=max(a,max(b,c));
		fact=new int[max+1];
		fact=factorial(fact);
		long A=ans(a,b);
		long B=ans(b,c);
		long C=ans(c,a);
		long ANS=(A*B*C)%998244353;
		//System.out.println((ans(a,b)*ans(b,c)*ans(a,c))%998244353);
		/*System.out.println(ans(a,b));
		System.out.println(ans(b,c));
		System.out.println(ans(a,c));*/
		System.out.println(ANS);
	}
}


// package mainpackage;

import java.io.*;
import java.util.*;

public class Main {
	public static void main(String... args) throws Exception {
		new Main().solve();
	}

	private BufferedReader reader;
	private StringTokenizer st;
	private int a, b, c;
	private long[][] C;
	private long[] fact;

	private final static long MOD = 998244353;

	private void solve() throws Exception {

		reader = new BufferedReader(new InputStreamReader(System.in));

		st = new StringTokenizer(reader.readLine());
		a = Integer.parseInt(st.nextToken());
		b = Integer.parseInt(st.nextToken());
		c = Integer.parseInt(st.nextToken());

		reader.close();

		int maxCnt = Math.max(c, Math.max(c, b));

		C = new long[maxCnt + 1][maxCnt + 1];
		fact = new long[maxCnt + 1];

		C[0][0] = 0;
		for (int i = 1; i <= maxCnt; ++i) {
			C[i][0] = C[0][i] = C[i][i] = 1;
		}

		fact[0] = 1;
		for (int i = 1; i <= maxCnt; ++i) {
			for (int j = 1; j <= i / 2; ++j) {
				C[i][j] = C[i][i - j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
			}

			fact[i] = (fact[i - 1] * i) % MOD;
		}

//		System.out.printf("f(%d, %d) = %d%n", a, b, f(a, b));
//		System.out.printf("f(%d, %d) = %d%n", b, c, f(b, c));
//		System.out.printf("f(%d, %d) = %d%n", a, c, f(a, c));

		long tmp = (f(a, b) * f(a, c)) % MOD;
		System.out.println((tmp * f(b, c)) % MOD);
	}

	private long f(int n, int m) {

		long value = 1;

		int border = Math.min(n, m);
		for (int i = 1; i <= border; ++i) {
			long tmp = (C[n][i] * C[m][i]) % MOD;

			tmp = (tmp * fact[i]) % MOD;
			value = (value + tmp) % MOD;
		}

		return value;
	}
}


package com.company;

import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Created by trung.pham on 9/10/17.
 */
public class C_Round_439_Div2 {
    public static void main(String[] args) {
        //System.out.println("HE HE");
        Scanner in = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int a = in.nextInt();
        int b = in.nextInt();
        int c = in.nextInt();
        int MOD = 998244353;
        int[][]fac = new int[5001][5001];
        int[][]com = new int[5001][5001];
        fac[0][0] = 1;
        com[0][0] = 1;
        for(int i = 1; i < fac.length; i++){
            fac[i][0] = 1;
            com[i][0] = 1;
            com[i][i] = 1;
            for(int j = 1; j < i; j++){
                fac[i][j] = (fac[i][j - 1]*(i - j + 1)) % MOD;
                com[i][j] = (com[i - 1][j - 1] + com[i - 1][j]) % MOD;
            }
            fac[i][i] = fac[i][i - 1];
        }
        long res = 0;
        long X = 0, Y = 0, Z = 0;
        for(int i = 0; i <= a && i <= b; i++){
            long A = ((long)fac[a][i] * (long)com[b][i]) %MOD;
            X += A;
            X %= MOD;
        }
        for(int j = 0; j <= a && j <= c; j++){
            long B = ((long)fac[a][j] * (long)com[c][j]) % MOD;
            Y += B;
            Y %= MOD;
        }

        for(int i = 0; i <= b && i <= c; i++){
            long C = ((long)fac[b][i] * (long)com[c][i]) % MOD;
            Z += C;
            Z %= MOD;
        }
        //System.out.println(X + " " + Y + " " + Z);

        res = X*Y;
        res %= MOD;
        res *= Z;
        res %= MOD;
        out.println(res);
        out.close();

    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static brute.BruteHelper.*;
import static java.lang.Math.*;

public class ProblemC4 {
    private static final long B = 998244353L;
    BufferedReader rd;
    private long[][] dp = new long[5005][5005];

    ProblemC4() throws IOException {
        rd = new BufferedReader(new InputStreamReader(System.in));
        compute();
    }

    private void compute() throws IOException {
        int[] a = intarr();
        genericBrute(c -> {
            start();
            out(solve(a));
        });
    }

    private void start() {
        int n = dp.length;
        for(int i=1;i<n;i++) {
            dp[1][i] = (i+1)%B;
            dp[i][1] = (i+1)%B;
        }
        for(int i=2;i<n;i++) {
            for(int j=i;j<n;j++) {
                int mi = min(i-1,j-1);
                int ma = max(i-1,j-1);
                long res = mul(i, dp[mi][ma]);

                mi = min(i,j-1);
                ma = max(i,j-1);
                res += dp[mi][ma];
                res %= B;
                dp[i][j] = res;
            }
        }
    }

    private long solve(int[] a) {
        long res = 1;

        int mi = min(a[0],a[1]);
        int ma = max(a[0],a[1]);

        res *= dp[mi][ma];
        res %= B;

        mi = min(a[0],a[2]);
        ma = max(a[0],a[2]);

        res *= dp[mi][ma];
        res %= B;

        mi = min(a[1],a[2]);
        ma = max(a[1],a[2]);

        res *= dp[mi][ma];
        res %= B;
        return res;
    }

    private long mul(long a, long b) {
        return ((a%B)*(b%B))%B;
    }

    private int[] intarr() throws IOException {
        return intarr(rd.readLine());
    }

    private int[] intarr(String s) {
        String[] q = split(s);
        int n = q.length;
        int[] a = new int[n];
        for(int i=0;i<n;i++) {
            a[i] = Integer.parseInt(q[i]);
        }
        return a;
    }

    private String[] split(String s) {
        if(s == null) {
            return new String[0];
        }
        int n = s.length();
        int start = -1;
        int end = 0;
        int sp = 0;
        boolean lastWhitespace = true;
        for(int i=0;i<n;i++) {
            char c = s.charAt(i);
            if(isWhitespace(c)) {
                lastWhitespace = true;
            } else {
                if(lastWhitespace) {
                    sp++;
                }
                if(start == -1) {
                    start = i;
                }
                end = i;
                lastWhitespace = false;
            }
        }
        if(start == -1) {
            return new String[0];
        }
        String[] res = new String[sp];
        int last = start;
        int x = 0;
        lastWhitespace = true;
        for(int i=start;i<=end;i++) {
            char c = s.charAt(i);
            boolean w = isWhitespace(c);
            if(w && !lastWhitespace) {
                res[x++] = s.substring(last,i);
            } else if(!w && lastWhitespace) {
                last = i;
            }
            lastWhitespace = w;
        }
        res[x] = s.substring(last,end+1);
        return res;
    }

    private boolean isWhitespace(char c) {
        return c==' ' || c=='\t';
    }

    private static void out(Object x) {
        System.out.println(x);
    }

    public static void main(String[] args) throws IOException {
        new ProblemC4();
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Pradyumn Agrawal coderbond007
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int a = in.nextInt();
            int b = in.nextInt();
            int l = in.nextInt() - 1;
            int r = in.nextInt() - 1;
            int ab = a + b;
            int m = 4;
            int[] cc = new int[ab * m];
            int h = l / ab;
            l -= h * ab;
            r -= h * ab;
            h = (r - l + 1) / ab;
            if (h > 2)
                r -= (h - 2) * ab;
            int d = a > b ? a - b : 1;
            for (h = 0; h < m; h++) {
                for (int k = 0; k < a - d; k++)
                    cc[(a + b) * h + k] = k;
                for (int k = 0; k < d; k++)
                    cc[(a + b) * h + a - d + k] = h % 2 == 0 ? a - d + k : a + k;
            }
            int min = a + a;
            for (int k0 = 1; k0 <= d; k0++) {
                for (int k = 0; k < b; k++)
                    cc[(a + b) * 0 + a + k] = cc[(a + b) * 0 + a - k0];
                for (int k1 = 1; k1 <= d; k1++) {
                    for (int k = 0; k < b; k++)
                        cc[(a + b) * 1 + a + k] = cc[(a + b) * 1 + a - k1];
                    for (int k2 = 1; k2 <= d; k2++) {
                        for (int k = 0; k < b; k++)
                            cc[(a + b) * 2 + a + k] = cc[(a + b) * 2 + a - k2];
                        for (int k3 = 1; k3 <= d; k3++) {
                            for (int k = 0; k < b; k++)
                                cc[(a + b) * 3 + a + k] = cc[(a + b) * 3 + a - k3];
                            min = Math.min(min, count(cc, l, r));
                        }
                    }
                }
            }
            out.println(min);
        }

        static int count(int[] cc, int l, int r) {
            boolean[] used = new boolean[24];
            int cnt = 0;
            for (int i = l; i <= r; i++) {
                int c = cc[i];
                if (!used[c]) {
                    used[c] = true;
                    cnt++;
                }
            }
            return cnt;
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;
        private FastReader.SpaceCharFilter filter;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

public class C
{
	static PrintWriter out = new PrintWriter(
			new BufferedOutputStream(System.out));
	static MyScanner sc = new MyScanner(System.in);
	static StringBuilder output = new StringBuilder();

	public static void main(String... args)
	{
		int a = sc.nextInt();
		int b = sc.nextInt();
		int l = sc.nextInt() - 1;
		int r = sc.nextInt();

		r -= l / (a + b) * (a + b);
		l -= l / (a + b) * (a + b);

		if (r > (a + b) * 3)
		{
			r -= r / (a + b) * (a + b);
			r += (a + b) * 3;
		}

		int[] seq = new int[r];

		for (int i = 0; i < r; i++)
		{
			seq[i] = i;
		}

		{
			int i = a;
			while (i < r)
			{
				if (i % (a + b) < a)
				{
					HashSet<Integer> used = new HashSet<Integer>();
					for (int j = i - 1; i - j <= a; j--)
					{
						used.add(seq[j]);
					}

					for (int j = 0; i % (a + b) != a && i < r; i++, j++)
					{
						while (used.contains(j))
						{
							j++;
						}
						used.add(j);

						seq[i] = j;
					}
				}
				else
				{
					seq[i] = seq[i - 1];
					i++;
				}
			}
		}

		int result;

		{
			HashSet<Integer> used = new HashSet<Integer>();

			for (int i = l; i < r; i++)
			{
				used.add(seq[i]);
			}

			result = used.size();
		}

		for(int i = a; i < a + b && i < r; i++)
		{
			seq[i] = seq[b];
		}

		{
			int i = a + b;
			while (i < r)
			{
				if (i % (a + b) < a)
				{
					HashSet<Integer> used = new HashSet<Integer>();
					for (int j = i - 1; i - j <= a; j--)
					{
						used.add(seq[j]);
					}

					for (int j = 0; i % (a + b) != a && i < r; i++, j++)
					{
						while (used.contains(j))
						{
							j++;
						}
						used.add(j);

						seq[i] = j;
					}
				}
				else
				{
					seq[i] = seq[i - 1];
					i++;
				}
			}
		}

		{
			HashSet<Integer> used = new HashSet<Integer>();

			for (int i = l; i < r; i++)
			{
				used.add(seq[i]);
			}

			result = Math.min(result, used.size());
		}

		output.append(result);

		eOP();
	}

	private static void eOP()
	{
		System.out.println(output);
		System.exit(0);
	}

	/**
	 * Flatfoot's Scanner with slight modifications.
	 *
	 * @author Flatfoot
	 * @see Source
	 */
	private static class MyScanner
	{
		BufferedReader br;
		StringTokenizer st;

		MyScanner(InputStream in)
		{
			this.br = new BufferedReader(new InputStreamReader(in));
		}

		String next()
		{
			while (this.st == null || !this.st.hasMoreElements())
			{
				try
				{
					this.st = new StringTokenizer(this.br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return this.st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(this.next());
		}

		long nextLong()
		{
			return Long.parseLong(this.next());
		}

		double nextDouble()
		{
			return Double.parseDouble(this.next());
		}

		/**
		 * This method has been modified to be a bit more similar to Scanner's
		 *
		 * @author Flatfoot,
		 *         JasonBaby
		 */
		String nextLine()
		{
			if (this.st == null || !this.st.hasMoreElements())
			{
				String str = "";
				try
				{
					str = this.br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
			else
			{
				StringBuilder str = new StringBuilder();
				while (this.st.hasMoreElements())
				{
					str.append(this.st.nextToken());
					str.append(" ");
				}
				str.deleteCharAt(str.length() - 1);
				return str.toString();
			}
		}

	}
}


import java.io.*;
import java.util.*;

public class A421 {
    public static void main(String[] args) {
        InputReader in = new InputReader(System.in);
        OutputWriter out = new OutputWriter(System.out);
        int c = in.nextInt();
        int v0 = in.nextInt();
        int v1 = in.nextInt();
        int a = in.nextInt();
        int l = in.nextInt();
        int read = 0;
        //process first day
        int days = 1;
        read += v0;
        v0 -= l;
        v1 -= l;
        v0 += a;
        //days with increasing number of pages
        if(a > 0) {
            while(v0 <= v1 && read < c) {
                days++;
                read += v0;
                v0 += a;
            }
        }
        //days with v1 per day
        if(a > 0) v0 = v1;
        if(read < c) {
            days += (c - read - 1) / v0 + 1;
        }
        out.print(days);
        out.close();
    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects) {
            print(objects);
            writer.println();
        }

        public void printf(String format, Object... objects) {
            writer.printf(format, objects);
        }

        public void close() {
            writer.close();
        }

        public void flush() {
            writer.flush();
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (this.numChars == -1) {
                throw new InputMismatchException();
            } else {
                if (this.curChar >= this.numChars) {
                    this.curChar = 0;

                    try {
                        this.numChars = this.stream.read(this.buf);
                    } catch (IOException var2) {
                        throw new InputMismatchException();
                    }

                    if (this.numChars <= 0) {
                        return -1;
                    }
                }

                return this.buf[this.curChar++];
            }
        }

        public int nextInt() {
            int c;
            for (c = this.read(); isSpaceChar(c); c = this.read()) {
                ;
            }

            byte sgn = 1;
            if (c == 45) {
                sgn = -1;
                c = this.read();
            }

            int res = 0;

            while (c >= 48 && c <= 57) {
                res *= 10;
                res += c - 48;
                c = this.read();
                if (isSpaceChar(c)) {
                    return res * sgn;
                }
            }

            throw new InputMismatchException();
        }

        public static boolean isSpaceChar(int c) {
            return c == 32 || c == 10 || c == 13 || c == 9 || c == -1;
        }

    }
}


package c820;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.StringTokenizer;

public class C
{
	static PrintWriter out = new PrintWriter(
			new BufferedOutputStream(System.out));
	static MyScanner sc = new MyScanner(System.in);
	static StringBuilder output = new StringBuilder();

	public static void main(String... args)
	{
		int a = sc.nextInt();
		int b = sc.nextInt();
		int l = sc.nextInt() - 1;
		int r = sc.nextInt();

		r -= l / (a + b) * (a + b);
		l -= l / (a + b) * (a + b);

		if (r > (a + b) * 3)
		{
			r -= r / (a + b) * (a + b);
			r += (a + b) * 3;
		}

		int[] seq = new int[r];

		for (int i = 0; i < r; i++)
		{
			seq[i] = i;
		}

		{
			int i = a;
			while (i < r)
			{
				if (i % (a + b) < a)
				{
					HashSet<Integer> used = new HashSet<Integer>();
					for (int j = i - 1; i - j <= a; j--)
					{
						used.add(seq[j]);
					}

					for (int j = 0; i % (a + b) != a && i < r; i++, j++)
					{
						while (used.contains(j))
						{
							j++;
						}
						used.add(j);

						seq[i] = j;
					}
				}
				else
				{
					seq[i] = seq[i - 1];
					i++;
				}
			}
		}

		int result;

		{
			HashSet<Integer> used = new HashSet<Integer>();

			for (int i = l; i < r; i++)
			{
				used.add(seq[i]);
			}

			result = used.size();
		}

		for(int i = a; i < a + b && i < r; i++)
		{
			seq[i] = seq[b];
		}

		{
			int i = a + b;
			while (i < r)
			{
				if (i % (a + b) < a)
				{
					HashSet<Integer> used = new HashSet<Integer>();
					for (int j = i - 1; i - j <= a; j--)
					{
						used.add(seq[j]);
					}

					for (int j = 0; i % (a + b) != a && i < r; i++, j++)
					{
						while (used.contains(j))
						{
							j++;
						}
						used.add(j);

						seq[i] = j;
					}
				}
				else
				{
					seq[i] = seq[i - 1];
					i++;
				}
			}
		}

		{
			HashSet<Integer> used = new HashSet<Integer>();

			for (int i = l; i < r; i++)
			{
				used.add(seq[i]);
			}

			result = Math.min(result, used.size());
		}

		output.append(result);

		eOP();
	}

	private static void eOP()
	{
		System.out.println(output);
		System.exit(0);
	}

	/**
	 * Flatfoot's Scanner with slight modifications.
	 *
	 * @author Flatfoot
	 * @see Source
	 */
	private static class MyScanner
	{
		BufferedReader br;
		StringTokenizer st;

		MyScanner(InputStream in)
		{
			this.br = new BufferedReader(new InputStreamReader(in));
		}

		String next()
		{
			while (this.st == null || !this.st.hasMoreElements())
			{
				try
				{
					this.st = new StringTokenizer(this.br.readLine());
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
			}
			return this.st.nextToken();
		}

		int nextInt()
		{
			return Integer.parseInt(this.next());
		}

		long nextLong()
		{
			return Long.parseLong(this.next());
		}

		double nextDouble()
		{
			return Double.parseDouble(this.next());
		}

		/**
		 * This method has been modified to be a bit more similar to Scanner's
		 *
		 * @author Flatfoot,
		 *         JasonBaby
		 */
		String nextLine()
		{
			if (this.st == null || !this.st.hasMoreElements())
			{
				String str = "";
				try
				{
					str = this.br.readLine();
				}
				catch (IOException e)
				{
					e.printStackTrace();
				}
				return str;
			}
			else
			{
				StringBuilder str = new StringBuilder();
				while (this.st.hasMoreElements())
				{
					str.append(this.st.nextToken());
					str.append(" ");
				}
				str.deleteCharAt(str.length() - 1);
				return str.toString();
			}
		}

	}
}


import java.io.*;
import static java.lang.Math.max;
import static java.lang.Long.min;
import static java.lang.Math.abs;
import static java.lang.Math.pow;
import static java.lang.System.out;
import java.util.*;

public class Kaudo {
    static Reader in =new Reader();
    static StringBuilder Sd=new StringBuilder();
    static long ans=0,res;
     public static void main(String [] args) {
     int n =in.nextInt(),k=in.nextInt(),x=in.nextInt();
     int a[]=new int [n];
     for(int i=0;i<n;i++)a[i]=in.nextInt();
     for(int i=0;i<n;i++){
     if(a[i]==x){
     int l=1,xo=x;
     for(int u=i,o=i+1;;){
     if(u>=0&&a[u]==xo){l++;u--;}
     if(o<n&&a[o]==xo){l++;o++;}
     if(u>=0&&o<n&&a[u]==a[o]&&a[u]!=xo){xo=a[o];
     if(l>=3){ans+=l;}
     else break;
     l=0;}
     if(o>=n&&u<0){
         if(l>=3){ans+=l;}

         break;}
     if(u<0&&a[o]!=xo){ if(l>=3){ans+=l;}
     break;}
     if(o>=n&&a[u]!=xo){ if(l>=3){ans+=l;}
     break;}}}
     res=max(res,ans-1);
     ans=0;
     }
         System.out.println(res);
     }

   static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int nextInt(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = nextInt();}return ret;}
    }

}
class Sorting{

 public static int[] bucketSort(int[] array, int bucketCount) {

 if (bucketCount <= 0) throw new IllegalArgumentException("Invalid bucket count");

 if (array.length <= 1) return array; //trivially sorted

 int high = array[0];

 int low = array[0];

 for (int i = 1; i < array.length; i++) { //find the range of input elements

 if (array[i] > high) high = array[i];

 if (array[i] < low) low = array[i];

 }

 double interval = ((double)(high - low + 1))/bucketCount; //range of one bucket

 ArrayList<Integer> buckets[] = new ArrayList[bucketCount];

 for (int i = 0; i < bucketCount; i++) { //initialize buckets

 buckets[i] = new ArrayList();

 }

 for (int i = 0; i < array.length; i++) { //partition the input array

 buckets[(int)((array[i] - low)/interval)].add(array[i]);

 }

 int pointer = 0;

 for (int i = 0; i < buckets.length; i++) {

 Collections.sort(buckets[i]); //mergeSort

 for (int j = 0; j < buckets[i].size(); j++) { //merge the buckets

 array[pointer] = buckets[i].get(j);

 pointer++;

 }

}

return array;

}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Balls {

    public static void main(String args[]) throws Exception {

        MyScanner in = new MyScanner();

        int n = in.nextInt();
        int m = in.nextInt();
        int k = in.nextInt();
        int[] b = new int [n];
        int sum=0,max=0,buf=0;
        for (int i = 0; i < n; i++) {
            b[i] = in.nextInt();
        }
        for (int i = 0; i < n-1; i++) {
            if (b[i]==k && b[i+1]==k) {
                sum+=2;
            }
            if (i-1>0 && i+2<b.length) {
                int x=i-1;
                int y=i+2;

                if (b[x]==b[y]) {
                    while (true) {
                        if (x-1>=0 && b[x-1]==b[y]) {
                            buf++;
                            if (x>0) x--;
                        }
                        if (y+1<b.length && b[y+1]==b[x]) {
                            buf++;
                            if (y<b.length) y++;
                        }
                        if (buf==0 || (x==0 && y==b.length-1)) break;
                    }
                }

            }
            if (buf>0) sum += buf+2;
            max = Math.max(max,sum);
            sum=0;
            buf=0;
        }

        System.out.println(max);

    }

    public static class MyScanner {
    BufferedReader br;
    StringTokenizer st;

    public MyScanner() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    String nextLine() {
        String str = "";
        try {
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
    }

}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;

/**
 *
 * @author Hidayat
 */
public class B245 {

    public static void main(String args[]) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt(), k = in.nextInt(), x = in.nextInt();

        List<Integer> a = new LinkedList<Integer>();
        List<Integer> b = new LinkedList<Integer>();
        for (int i = 1; i <= n; i++) {
            int col = in.nextInt();
            a.add(col);
            b.add(col);
        }

        int result = 0;

        for (int i = 1; i <= n - 1; i++) {
            a = new LinkedList<Integer>();
            for (int idx = 0; idx < n; idx++) {
                a.add(b.get(idx));
            }

            a.add(i, x);
            boolean removed = false;
            int numOfRemoved = 0;
            do {
                if (a.size() < 3) {
                    removed = false;
                } else {
                    int countg = 1;
                    for (int j = 1; j < a.size(); j++) {
                        if (a.get(j) == a.get(j - 1)) {
                            countg++;
                        } else {
                            if (countg >= 3) {

                                for (int idx = j - 1; idx >= j - countg; idx--) {
                                    a.remove(idx);
                                }

                                removed = true;
                            }
                            countg = 1;
                        }
                    }
                    if (countg >= 3) {
                        int sz = a.size();
                        for (int idx = sz - 1; idx >= sz - countg; idx--) {
                            a.remove(idx);
                        }
                    }

                }

            } while (removed);
            if (a.size() < b.size()) {
                result = Math.max(result, b.size() - a.size());
            }
        }
        System.out.println(result);

    }
}


import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Arrays;
import java.lang.Math;

public class MyCode {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int k = sc.nextInt();
    int x = sc.nextInt();

    ArrayList<Integer> list = new ArrayList<>();
    for(int i = 0; i < n; i++){
      list.add(sc.nextInt());
    }

    ArrayList<Group> newL = new ArrayList<>();
    for(int i = 0; i < n; i++){
      int s = list.get(i);
      if(newL.size() == 0){
        newL.add(new Group(s, 1));
      } else {
        Group last = newL.get(newL.size() - 1);
        int lastVal = last.val;
        if(s == lastVal){
          last.countUp();
        } else {
          newL.add(new Group(s, 1));
        }
      }
    }

    int ansCount = 0;
    int l = 0;
    int r = 0;
    for(int i = 0; i < newL.size(); i++){
      Group s = newL.get(i);
      if(x == s.val){
        if(s.count > 1){
          l = i - 1;
          r = i + 1;
          int tempCount = 2;
          while(l >= 0 && r < newL.size()
          && newL.get(l).val == newL.get(r).val
          && newL.get(l).count + newL.get(r).count >= 3){
            tempCount += newL.get(r).count + newL.get(l).count;
            r += 1;
            l -= 1;
          }
          if(tempCount > ansCount){
            ansCount = tempCount;
          }
        }
      }
    }

    System.out.print(ansCount);
  }
}

public class Group {
  public int val;
  public int count;

  public Group(int val, int count){
    this.val = val;
    this.count = count;
  }

  public void countUp(){
    this.count += 1;
  }
}


import java.util.*;
import java.math.*;

// **** D. Cute Sequences ****

public class D {
	static char [] in = new char [1000000];
	public static void main (String [] arg) throws Throwable {
		int q = nextInt();
		StringBuilder ans = new StringBuilder(q*50*3);
		for (int ii = 0; ii<q; ++ii) {
			long a = nextLong();
			long b = nextLong();
			long m = nextLong();
			if (a == b) {
				ans = ans.append("1 " + a);
			} else {
				boolean solfound = false;
				for (int len = 2; len<=50; ++len) {
					long [] seq = solve(len, a, b, m);
					if (seq != null) {
						if (seq[0] == -1) break;
						ans=ans.append(seq.length);
						for (int i = 0; i<seq.length; ++i) {
							ans = ans.append(' ');
							ans = ans.append(seq[i]);
						}
						solfound = true;
						break;
					}
				}
				if (!solfound) ans=ans.append("-1");
			}
			ans = ans.append("\n");
		}
		System.out.print(ans);
	}
	public static long[] solve(long len, long a, long b, long m) {
		long pow = (1L<<len)>>2;
		b -= pow * a;
		long [] tmp_badans = new long [1];
		tmp_badans[0] = -1;
		//System.err.println("Trying length " + len + " with pow " + pow + " b is now " + b);
		if (b < 0) return tmp_badans;

		long [] ans = new long [len];
		long [] r = new long [len-1];
		ans[0] = a;
		long pow2 = pow;
		for (int i = 0; i<r.length; ++i) {
			if (pow2 != 1) pow2 = pow2>>1;
			b -= pow2;
			if ( b < 0) return tmp_badans;
		}

		for (int i = 0; i < r.length; ++i) {
			if (pow != 1) pow = pow >> 1;
			long fac = b/pow;
			if (fac > m-1) fac = m-1;
			b -= fac * pow;
			r[i] = fac + 1;
		}
		if (b != 0) return null;

		for (int i = 1; i<ans.length; ++i) {
			ans[i] = r[i-1];
			for (int j = 0; j<i; ++j) ans[i] += ans[j];
		}
		return ans;
	}

	/************** HELPER CLASSES ***************/
    static class HS extends HashSet<Integer>{public HS(){super();}public HS(int a){super(a);}};
	static class AL extends ArrayList<Integer>{public AL(){super();}public AL(int a){super (a);}};
	static class Pair implements Comparable<Pair>{int x,y,L; public Pair(int xx, int yy, int LL){x=xx;y=yy;L=LL;} public int compareTo(Pair p) {return this.L-L;}}

	/************** FAST IO CODE FOLLOWS *****************/
	public static long nextLong() throws Throwable {
		long i = System.in.read();boolean neg = false;while (i < 33) i = System.in.read();if (i == 45) {neg=true;i=48;}i = i - 48;
		int j = System.in.read();while (j > 32) {i*=10;i+=j-48;j = System.in.read();}return (neg) ? -i : i;
	}
	public static int nextInt() throws Throwable {return (int)nextLong();}
	public static String next() throws Throwable {
		int i = 0; while (i < 33 && i != -1) i = System.in.read(); int cptr = 0; while (i >= 33) { in[cptr++] = (char)i; i = System.in.read();}
		return new String(in, 0,cptr);
	}
	/**** LIBRARIES ****/
	public static long gcdL(long a, long b) {while (b != 0) {long tmp = b;b = (a % b);a = tmp;}return a;}
	public static int gcd(int a, int b) {while (b != 0) {int tmp = b;b = (a % b);a = tmp;}return a;}
	public static int[] sieve(int LIM) {
		int i,count = 0;
		boolean [] b = new boolean [LIM];
		for (i = 2;i<LIM; ++i) if (!b[i]) {count++; for (int j = i<<1; j<LIM; j+=i) b[j] = true;}
		int [] primes = new int[count];
		for (i = 2,count=0;i<LIM;++i) if (!b[i]) primes[count++] = i;
		return primes;
	}
	public static int[] numPrimeFactors(int LIM) {
		int i,count = 0;
		int [] b = new int [LIM];
		for (i = 2;i<LIM; ++i) if (b[i] == 0) {count++; for (int j = i; j<LIM; j+=i) b[j]++;}
		return b;
	}
}

/* Full Problem Text:

Given a positive integer m, we say that a sequence x_1, x_2, \dots, x_n of positive integers is m-cute if for every index i such that 2 < i < n it holds that x_i = x_{i - 1} + x_{i - 2} + \dots + x_1 + r_i for some positive integer r_i satisfying 1 < r_i < m.
You will be given q queries consisting of three positive integers a, b and m.
For each query you must determine whether or not there exists an m-cute sequence whose first term is a and whose last term is b.
If such a sequence exists, you must additionally find an example of it.

 */


import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //This code is not meant for understanding, you have been warned.
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        long a = nl(), b = nl(), m = nl();
        long[] contr = new long[51];
        contr[1] = 1;long sum = 1;
        for(int i = 2; i< 51; i++){
            contr[i] = sum;
            sum+=contr[i];
        }
        for(int i = 1; i<= 50; i++){
            if(b/a < contr[i])continue;
            long base = contr[i]*a;
            long diff = b-base-contr[i];
            if(diff<0)continue;
            long[] rem = new long[51];
            for(int j = i-1; j>=1; j--){
                long r = diff/contr[j];
                if(r>=m)r = m-1;
                diff-=contr[j]*r;
                rem[j] = 1+r;
            }
            if(diff==0){
                p(i+" "+a);
                long cur = a; sum = a;
                for(int j = 1; j< i; j++){
                    cur = sum+rem[i-j];
                    sum+=cur;
                    p(" "+cur);
                }
                pn("");return;
            }
        }
        pn(-1);
    }
    boolean fill(long[] contr, long[] rem, int ind, long diff, long m){
        if(ind==0)return diff==0;
        long r = diff/contr[ind];

    }

    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    long mod = (long)998244353, IINF = (long)1e18;
    final int INF = (int)1e9, MX = (int)5e5+1;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.141592653589793238462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = true, memory = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC)?ni():1;
        pre();for(int t = 1; t<= T; t++)solve(t);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}


import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //This code is not meant for understanding, you have been warned.
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        long a = nl(), b = nl(), m = nl();
        long[] contr = new long[51];
        contr[1] = 1;long sum = 1;
        for(int i = 2; i< 51; i++){
            contr[i] = sum;
            sum+=contr[i];
        }
        for(int i = 1; i<= 50; i++){
            if(b/a < contr[i])continue;
            long base = contr[i]*a;
            long diff = b-base-contr[i];
            if(diff<0)continue;
            long[] rem = new long[51];
            for(int j = i-1; j>=1; j--){
                long r = diff/contr[j];
                if(r>=m)r = m-1;
                diff-=contr[j]*r;
                rem[j] = 1+r;
            }
            if(diff==0){
                p(i+" "+a);
                long cur = a; sum = a;
                for(int j = 1; j< i; j++){
                    cur = sum+rem[i-j];
                    sum+=cur;
                    p(" "+cur);
                }
                pn("");return;
            }
        }
        pn(-1);
    }
    boolean fill(long[] contr, long[] rem, int ind, long diff, long m){
        if(ind==0)return diff==0;
        long r = diff/contr[ind];

    }

    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    long mod = (long)998244353, IINF = (long)1e18;
    final int INF = (int)1e9, MX = (int)5e5+1;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.14159265358979338462643383279502884197169399, eps = 1e-8;
    static boolean multipleTC = true, memory = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        //Solution Credits: Taranpreet Singh
        int T = (multipleTC)?ni():1;
        pre();for(int t = 1; t<= T; t++)solve(t);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str = "";
            try{
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }
            return str;
        }
    }
}


import java.util.*;
import java.io.*;
public class Solution{
    static Scanner sc;
    static PrintWriter pw;

    public static void main(String args[]){
        sc = new Scanner(System.in);
        pw = new PrintWriter(System.out);

        int t = sc.nextInt();
        while(t-->0)
            solve();

        pw.flush();
        pw.close();
    }
    public static void solve(){
        long a = sc.nextLong(), b = sc.nextLong(), m = sc.nextLong();

        if(a == b){
            pw.println(+1+" "+Long.toString(a));
            return;
        }

        for(int i=1; i<=60; i++){
            long low = (long)Math.pow(2, i-1)*(a+1), high = (long)Math.pow(2, i-1)*(a+m);

            if(low <= b && b<= high){

                if(i == 1){
                    System.out.println(+2+" "+a+" "+b);
                    return;
                }

                long k = b - (long)Math.pow(2, i-1)*(a+1);
                //System.out.println(+k+" "+i);

                long arr[] = new long[i+1], sum[] = new long[i+1], step[] = new long[i], fact[] = new long[i];
                arr[0] = a;

                fact[i-1] = 1;
                step[i-1] = 1;
                long q = 1;
                for(int j=i-2; j>=0; j--, q=q*2){
                    step[j] = 1;
                    fact[j] = q;
                }

                for(int j=0; j<i; j++){
                    long p = Math.min(k/fact[j], m-1);
                    step[j] += p;
                    k -= fact[j]*p;
                }

                sum[0] = arr[0];
                for(int j=1; j<=i; j++){
                    //System.out.println(+step[j-1]);
                    arr[j] = sum[j-1] + step[j-1];
                    sum[j] = sum[j-1] + arr[j];
                }

                pw.print(+(i+1)+" ");
                for(long q: arr)
                    pw.print(+q+" ");
                pw.println();
                return;
            }
            else if(low > b)
                break;
        }
        pw.println(-1);
    }
}