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

public class test {

	static int INF = 1000000007;

	public static void main(String[] args) {
//		int test = fs.nextInt();
		int test = 1;
		for (int cases = 0; cases < test; cases++) {
			int x1 = fs.nextInt();
			int x2 = fs.nextInt();
			int x3 = fs.nextInt();
			int y1 = fs.nextInt();
			int y2 = fs.nextInt();
			int y3 = fs.nextInt();
			int n = fs.nextInt();
			int z = x1 + x2 + x3;
			int q = y1 + y2 + y3;
			int a = (int) Math.ceil((double) z / 5);
			int b = (int) Math.ceil((double)q / 10);
			if (a + b <= n) {
				System.out.println("YES");
			} else {
				System.out.println("NO");
			}
		}
	}

	static class CPair {
		char x;
		int y;

		CPair(char x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	static class LongPair {
		long first;
		long second;

		LongPair(long a, long b) {
			this.first = a;
			this.second = b;
		}

	}

	static long power(long x, long y, long p) {
		long res = 1;
		x = x % p;
		while (y > 0) {
			if (y % 2 == 1)
				res = (res * x) % p;
			y = y >> 1;
			x = (x * x) % p;
		}
		return res;
	}

	static long modInverse(long n, long p) {
		return power(n, p - 2, p);
	}

	static long nCrModPFermat(long n, long r, long p) {
		long ans1 = 1;
		long i = n;
		long k = r;
		while (k > 0) {
			ans1 = mul(ans1, i, p);
			i--;
			k--;
		}
		long ans2 = 1;
		while (r > 0) {
			ans2 = mul(ans2, r, p);
			r--;
		}
		r = modInverse(ans2, p);
		ans1 = mul(ans1, r, p);
		return ans1;
	}

	static long facCalc(long total) {
		long ans = 1;
		for (long i = 2; i <= total; i++) {
			ans = mul(ans, i, INF);
		}
		return ans;
	}

	static long mul(long a, long b, long p) {
		return ((a % p) * (b % p)) % p;
	}

	static void sieve() {
		boolean prime[] = new boolean[101];
		Arrays.fill(prime, true);
		prime[1] = false;
		for (int i = 2; i * i <= prime.length - 1; i++) {
			for (int j = i * i; j <= prime.length - 1; j += i) {
				prime[j] = false;
			}
		}
	}

	public static int[] radixSort(int[] f) {
		return radixSort(f, f.length);
	}

	public static int[] radixSort(int[] f, int n) {
		int[] to = new int[n];
		{
			int[] b = new int[65537];
			for (int i = 0; i < n; i++)
				b[1 + (f[i] & 0xffff)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < n; i++)
				to[b[f[i] & 0xffff]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		{
			int[] b = new int[65537];
			for (int i = 0; i < n; i++)
				b[1 + (f[i] >>> 16)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < n; i++)
				to[b[f[i] >>> 16]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		return f;
	}

	static void printArray(int ar[]) {
		System.out.println(Arrays.toString(ar));
	}

	static class Pair {
		int first, second;

		public Pair(int first, int second) {
			this.first = first;
			this.second = second;
		}

	}

	static class Pair2 {
		int first;
		Pair second;

		public Pair2(int first, Pair second) {
			this.first = first;
			this.second = second;
		}

	}

	static long expmodulo(long a, long b, long c) {
		long x = 1;
		long y = a;
		while (b > 0) {
			if (b % 2 == 1) {
				x = (x * y) % c;
			}
			y = (y * y) % c; // squaring the base
			b /= 2;
		}
		return (long) x % c;
	}

	// static int modInverse(int a, int m) {
	// int m0 = m;
	// int y = 0, x = 1;
	//
	// if (m == 1)
	// return 0;
	//
	// while (a > 1) {
	// int q = a / m;
	// int t = m;
	// m = a % m;
	// a = t;
	// t = y;
	// y = x - q * y;
	// x = t;
	// }
	// if (x < 0)
	// x += m0;
	// return x;
	// }

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

	static void sortMyMapusingValues(HashMap<Integer, Integer> hm) {

		List<Map.Entry<Integer, Integer>> capitalList = new LinkedList<>(hm.entrySet());

		Collections.sort(capitalList, new Comparator<Map.Entry<Integer, Integer>>() {
			public int compare(Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) {
				return (o1.getValue()).compareTo(o2.getValue());
			}
		});
		HashMap<Integer, Integer> result = new HashMap<>();
		for (Map.Entry<Integer, Integer> entry : capitalList) {
			result.put(entry.getKey(), entry.getValue());
		}
	}

	static boolean ispowerof2(long num) {
		if ((num & (num - 1)) == 0)
			return true;
		return false;
	}

	static void primeFactors(int n) {
		while (n % 2 == 0) {
			System.out.print(2 + " ");
			n /= 2;
		}
		for (int i = 3; i <= Math.sqrt(n); i += 2) {
			while (n % i == 0) {
				System.out.print(i + " ");
				n /= i;
			}
		}
		if (n > 2)
			System.out.print(n);
	}

	static boolean isPrime(long n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;
		if (n % 2 == 0 || n % 3 == 0)
			return false;

		long sq = (long) Math.sqrt(n);
		for (int i = 5; i <= sq; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;

		return true;
	}

	static class Graph {
		HashMap<Integer, LinkedList<Integer>> hm = new HashMap<Integer, LinkedList<Integer>>();

		private void addVertex(int vertex) {
			hm.put(vertex, new LinkedList<>());
		}

		private void addEdge(int source, int dest, boolean bi) {
			if (!hm.containsKey(source))
				addVertex(source);
			if (!hm.containsKey(dest))
				addVertex(dest);
			hm.get(source).add(dest);
			if (bi) {
				hm.get(dest).add(source);
			}
		}

		private boolean uniCycle(int i, HashSet<Integer> visited, int parent) {
			visited.add(i);
			LinkedList<Integer> list = hm.get(i);
			Iterator<Integer> it = list.iterator();
			while (it.hasNext()) {
				Integer integer = (Integer) it.next();
				if (!visited.contains(integer)) {
					if (uniCycle(integer, visited, i))
						return true;
				} else if (integer != parent) {
					return true;
				}
			}
			return false;
		}

		private boolean uniCyclic() {
			HashSet<Integer> visited = new HashSet<Integer>();
			Set<Integer> set = hm.keySet();
			for (Integer integer : set) {
				if (!visited.contains(integer)) {
					if (uniCycle(integer, visited, -1)) {
						return true;
					}
				}
			}
			return false;
		}

		private boolean isbiCycle(int i, HashSet<Integer> visited, HashSet<Integer> countered) {
			if (countered.contains(i))
				return true;
			if (visited.contains(i))
				return false;
			visited.add(i);
			countered.add(i);
			LinkedList<Integer> list = hm.get(i);
			Iterator<Integer> it = list.iterator();
			while (it.hasNext()) {
				Integer integer = (Integer) it.next();
				if (isbiCycle(integer, visited, countered)) {
					return true;
				}
			}
			countered.remove(i);
			return false;
		}

		Boolean isReachable(int s, int d, int k) {
			if (hm.isEmpty()) {
				return false;
			}
			LinkedList<Integer> temp;
			boolean visited[] = new boolean[k];
			LinkedList<Integer> queue = new LinkedList<Integer>();
			visited[s] = true;
			queue.add(s);
			Iterator<Integer> i;
			while (queue.size() != 0) {
				s = queue.poll();
				int n;
				i = hm.get(s).listIterator();

				// Get all adjacent vertices of the dequeued vertex s
				// If a adjacent has not been visited, then mark it
				// visited and enqueue it
				while (i.hasNext()) {
					n = i.next();

					// If this adjacent node is the destination node,
					// then return true
					if (n == d)
						return true;

					// Else, continue to do BFS
					if (!visited[n]) {
						visited[n] = true;
						queue.add(n);
					}
				}
			}

			// If BFS is complete without visited d
			return false;
		}

		private boolean isbiCyclic() {
			HashSet<Integer> visited = new HashSet<Integer>();
			HashSet<Integer> countered = new HashSet<Integer>();
			Set<Integer> set = hm.keySet();
			for (Integer integer : set) {
				if (isbiCycle(integer, visited, countered)) {
					return true;
				}
			}
			return false;
		}
	}

	static class Node {
		Node left, right;
		int data;

		public Node(int data) {
			this.data = data;
		}

		public void insert(int val) {
			if (val <= data) {
				if (left == null) {
					left = new Node(val);
				} else {
					left.insert(val);
				}
			} else {
				if (right == null) {
					right = new Node(val);
				} else {
					right.insert(val);
				}
			}
		}

		public boolean contains(int val) {
			if (data == val) {
				return true;
			} else if (val < data) {
				if (left == null) {
					return false;
				} else {
					return left.contains(val);
				}
			} else {
				if (right == null) {
					return false;
				} else {
					return right.contains(val);
				}
			}
		}

		public void inorder() {
			if (left != null) {
				left.inorder();
			}
			System.out.print(data + " ");
			if (right != null) {
				right.inorder();
			}
		}

		public int maxDepth() {
			if (left == null)
				return 0;
			if (right == null)
				return 0;
			else {
				int ll = left.maxDepth();
				int rr = right.maxDepth();
				if (ll > rr)
					return (ll + 1);
				else
					return (rr + 1);
			}
		}

		public int countNodes() {
			if (left == null)
				return 1;
			if (right == null)
				return 1;
			else {
				return left.countNodes() + right.countNodes() + 1;
			}
		}

		public void preorder() {
			System.out.print(data + " ");
			if (left != null) {
				left.inorder();
			}

			if (right != null) {
				right.inorder();
			}

		}

		public void postorder() {
			if (left != null) {
				left.inorder();
			}

			if (right != null) {
				right.inorder();
			}
			System.out.print(data + " ");

		}

		public void levelorder(Node node) {
			LinkedList<Node> ll = new LinkedList<Node>();
			ll.add(node);
			getorder(ll);

		}

		public void getorder(LinkedList<Node> ll) {
			while (!ll.isEmpty()) {
				Node node = ll.poll();
				System.out.print(node.data + " ");
				if (node.left != null)
					ll.add(node.left);
				if (node.right != null)
					ll.add(node.right);
			}
		}
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			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;
		}
	}

	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 printLine(Object... objects) {
			print(objects);
			writer.println();
		}

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

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

	}

	private static final FastReader fs = new FastReader();
	private static final OutputWriter op = new OutputWriter(System.out);
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanner = new Scanner(System.in);
		int inputNum = scanner.nextInt();
		int[] givenTemps = new int[inputNum];
		for(int i = 0; i < inputNum; i++) {
			givenTemps[i] = scanner.nextInt();
		}
		int numBetween = givenTemps[1] - givenTemps[0];
		for(int j = 0; j < inputNum - 1; j++) {
			if(givenTemps[j+1] - givenTemps[j] != numBetween) {
				System.out.println(givenTemps[inputNum - 1]);
				return;
			}
		}
		System.out.println(givenTemps[inputNum - 1] + numBetween);
		return;

	}

}


import java.util.*;
public class LuckyNumber
{
public static void main(String args[])
{
 int n;
 Scanner in=new Scanner(System.in);
 n=in.nextInt();
 if((n%4==0)||(n%7==0)||(n%47==0)||(n%744==0)||(n%47==7))
   System.out.println("YES");
 else
   System.out.println("NO");
}
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author sheep
 */
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);
		TaskE solver = new TaskE();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskE {

    final int MOD = 1000000007;

    private int addMod(int x, int y) {
        int ret = x + y;
        if (ret < 0) ret += MOD;
        if (ret >= MOD) ret -= MOD;

        return ret;
    }

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int choose[][] = new int[200][200];
        for (int i = 0; i < choose.length; ++i) {
            choose[i][0] = choose[i][i] = 1;
            for (int j = 1; j < i; ++j) {
                choose[i][j] = choose[i - 1][j] + choose[i - 1][j - 1];
            }
        }

        int n = in.nextInt();
        int m = in.nextInt();
        int upper = in.nextInt();

        int dp[][][][] = new int[2][n + 1][upper + 1][upper + 1];
        for (int i = 1; i + i <= n; ++i) {
            dp[0][2 * i][1][i] = 1;
        }

        int ans = 0;

        for (int i = 0; i < m - 1; ++i) {
            int now = i & 1, next = now ^ 1;

            for (int j = 0; j <= n; ++j) {
                for (int k = 1; k <= upper; ++k) {
                    for (int r = 1; r <= upper; ++r) {
                        dp[next][j][k][r] = 0;
                    }
                }
            }

            for (int j = 1; j * 2 <= n; ++j) {
                dp[next][2 * j][1][j] = 1;
            }

            for (int j = 0; j <= n; ++j) {
                for (int k = 1; k <= upper; ++k) {
                    for (int r = 1; r <= upper; ++r) {
                        if (0 == dp[now][j][k][r]) continue;
                        if (j > 1) {
                            ans = addMod(ans, dp[now][j][k][r]);
                        }
                        for (int delta = 1; j + 2 * delta <= n && delta <= upper; ++delta) {
                            int nextPlan = k * choose[delta + r - 1][r - 1];
                            if (nextPlan > upper) break;
                            dp[next][j + 2 * delta][nextPlan][delta] = addMod(dp[next][j + 2 * delta][nextPlan][delta], dp[now][j][k][r]);
                        }
                    }
                }
            }
        }

        out.println(ans);
    }
}

class InputReader {
    BufferedReader reader;
    StringTokenizer tokenizer;

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

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

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

    }


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.*;

public class Minimise {
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            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;
        }
    }

    public static void main(String[] args) {
        FastReader in = new FastReader();
        String[] s = in.nextLine().split(" ");
        int p = Math.min(Integer.parseInt(s[0]),Integer.parseInt(s[1]));
        BigInteger bigInteger = new BigInteger(String.valueOf(p));
        BigInteger fact = BigInteger.ONE;
        while (p>1){
            fact = BigInteger.valueOf(p).multiply(fact);
            p--;
        }
        System.out.println(fact);
    }
}


import java.util.Scanner;
public class many
{

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

		int c = input.nextInt();
		input.nextLine();
		String s = input.nextLine();
		int arr[] = new int[10000];
        int	intIndex = 0;
        String arrS[] = new String[10000];
        int stringIndex = 0;
		int max = 0;

		for(int i =0; i< (s.length()-1) ; i++)
		{
			String s2 = Character.toString(s.charAt(i)) + Character.toString(s.charAt(i+1));
			arrS[stringIndex] = s2;
			stringIndex++;
		}

		for(int i=0; i<stringIndex;i++)
		{
			int count =1;
			for(int j=i+1; j<stringIndex;j++)
			{
				if(arrS[i] != null){
				    if(arrS[i].equals(arrS[j])){
						count++;
					    arrS[j] = null;
					}
				}
			}
			arr[intIndex] = count;
			if(arr[intIndex] > arr[max])max = intIndex;
			intIndex++;

		}
		 System.out.println(arrS[max]);

	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main1 {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
    static class Task {
        static char[] s;
        static int fun(char a,char b,String str){
            s=str.toCharArray();
            boolean m1,m2;
            m1=m2=false;
            int res=0;
            for(int i=s.length-1;i>=0;i--){
                if(s[i]==b){
                    m1=true;
                    for(int j=i;j<s.length-1;j++){
                        swap(j,j+1);
                        res++;
                    }
                    break;
                }
            }
            for(int i=s.length-2;i>=0;i--){
                if(s[i]==a){
                    m2=true;
                    for(int j=i;j<s.length-2;j++){
                        swap(j,j+1);
                        res++;
                    }
                    break;
                }
            }
            if(!m1||!m2) return Integer.MAX_VALUE;
            if(s[0]=='0'){
                for(int i=1;i<s.length-2;i++){
                    if(s[i]!='0'){
                        res+=i;
                        break;
                    }
                }
            }
            return res;
        }
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            String str = in.next();
            int min = Integer.MAX_VALUE;
            min = Math.min(min, fun('2', '5', str));
            min = Math.min(min, fun('5', '0', str));
            min = Math.min(min, fun('7', '5', str));
            min = Math.min(min, fun('0', '0', str));
            out.println((min==Integer.MAX_VALUE)?"-1":min);
        }
        static void swap(int i, int j) {
            try {
                if (i != j) {
                    char tmp = s[i];
                    s[i] = s[j];
                    s[j] = tmp;
                }
            } catch (ArrayIndexOutOfBoundsException e) {
                System.out.println(e.fillInStackTrace());
            }
        }
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream is) {
            br = new BufferedReader(new
                    InputStreamReader(is));
        }

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

        public String nextLine() throws IOException {
            return br.readLine();
        }

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

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

    }
}


import java.io.InputStreamReader;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author Anirudh Rayabharam (anirudhrb@yandex.com)
 */
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);
		TaskC solver = new TaskC();
		solver.solve(1, in, out);
		out.close();
	}
}

class TaskC {
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        long x = in.nextLong();

        long minHeight = 3 - x % 3;
        long sq = (long) Math.floor(Math.sqrt(1.0 + 24.0 * x));
        long maxHeight = (sq - 1) / 6;

        long ans = (maxHeight - minHeight + 3) / 3;
        out.println(ans);
    }
}

class InputReader {
    public BufferedReader reader;
    private int tokenCount, nextTokenIndex;
    private String[] tokens;

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

    public String next() {
        String nextLine;
        if (nextTokenIndex == tokenCount) {
            try {
                nextLine = reader.readLine();
                nextTokenIndex = 0;
                tokens = nextLine.split("\\s");
                tokenCount = tokens.length;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokens[nextTokenIndex++];
    }

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

}


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

public class Main {
	FastReader scn;
	PrintWriter out;
	String INPUT = "";

	void solve() {
		int n = scn.nextInt();
		long[] arr = new long[n + 1];
		for(int i = 1; i <= n; i++) {
			arr[i] = scn.nextInt() + arr[i - 1];
		}
		int x = scn.nextInt(), y = scn.nextInt(), ans = 0;

		for(int i = 1; i <= n; i++) {
			long a = arr[i], b = arr[n] - arr[i];
			if(Math.min(a, b) >= x && Math.max(a, b) <= y) {
				ans = i + 1;
			}
		}

		out.println(ans);
	}

	void run() throws Exception {
		long time = System.currentTimeMillis();
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		out = new PrintWriter(System.out);
		scn = new FastReader(oj);
		solve();
		out.flush();
		if (!oj) {
			System.out.println(Arrays.deepToString(new Object[] { System.currentTimeMillis() - time + " ms" }));
		}
	}

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

	class FastReader {
		InputStream is;

		public FastReader(boolean onlineJudge) {
			is = onlineJudge ? System.in : new ByteArrayInputStream(INPUT.getBytes());
		}

		byte[] inbuf = new byte[1024];
		public int lenbuf = 0, ptrbuf = 0;

		int readByte() {
			if (lenbuf == -1)
				throw new InputMismatchException();
			if (ptrbuf >= lenbuf) {
				ptrbuf = 0;
				try {
					lenbuf = is.read(inbuf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return -1;
			}
			return inbuf[ptrbuf++];
		}

		boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

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

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

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

		String next() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while (!(isSpaceChar(b))) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		String nextLine() {
			int b = skip();
			StringBuilder sb = new StringBuilder();
			while ((!isSpaceChar(b) || b == ' ')) { // when nextLine, (isSpaceChar(b) && b != ' ')
				sb.appendCodePoint(b);
				b = readByte();
			}
			return sb.toString();
		}

		char[] next(int n) {
			char[] buf = new char[n];
			int b = skip(), p = 0;
			while (p < n && !(isSpaceChar(b))) {
				buf[p++] = (char) b;
				b = readByte();
			}
			return n == p ? buf : Arrays.copyOf(buf, p);
		}

		int nextInt() {
			int num = 0, b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		long nextLong() {
			long num = 0;
			int b;
			boolean minus = false;
			while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'))
				;
			if (b == '-') {
				minus = true;
				b = readByte();
			}

			while (true) {
				if (b >= '0' && b <= '9') {
					num = num * 10 + (b - '0');
				} else {
					return minus ? -num : num;
				}
				b = readByte();
			}
		}

		char[][] nextMatrix(int n, int m) {
			char[][] map = new char[n][];
			for (int i = 0; i < n; i++)
				map[i] = next(m);
			return map;
		}

		int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++)
				a[i] = nextInt();
			return a;
		}

		long[] nextLongArray(int n) {
			long[] a = new long[n];
			for (int i = 0; i < n; i++)
				a[i] = nextLong();
			return a;
		}

		int[][] next2DInt(int n, int m) {
			int[][] arr = new int[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextIntArray(m);
			}
			return arr;
		}

		long[][] next2DLong(int n, int m) {
			long[][] arr = new long[n][];
			for (int i = 0; i < n; i++) {
				arr[i] = nextLongArray(m);
			}
			return arr;
		}

		int[] shuffle(int[] arr) {
			Random r = new Random();
			for (int i = 1, j; i < arr.length; i++) {
				j = r.nextInt(i);
				arr[i] = arr[i] ^ arr[j];
				arr[j] = arr[i] ^ arr[j];
				arr[i] = arr[i] ^ arr[j];
			}
			return arr;
		}
	}
}


import java.util.Scanner;

public class Test {
    public static void main(String[] args) {

        Scanner in=new Scanner(System.in);
        Integer i=Integer.parseInt(in.nextLine());
        String str=in.nextLine();
        String []s=str.split(" ");
        int max= 0;
        for (String x:s){
            int vol=0;
            for(int a=0;a<x.length();a++){
                int b=(int)x.charAt(a);
                if(b>=65 && b<=90) vol++;
//                System.out.println((int)x.charAt(a)); //65 - 90
            }
            max = Math.max(vol, max);
        }
        System.out.println(max);
    }
}


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

public class Duplicateelement {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        long y = input.nextLong(), b = input.nextLong();
        long y1 = input.nextLong(), g = input.nextLong(), b1 = input.nextLong(), g1 = 0, g2 = 0;

        y = y - y1 * 2;
        b = b - b1 * 3;

        g1 = g - y;
        g2 = g - b;
        if (g1 >= 0 || g2 >= 0) {
            if (g1 >= 0 && g2 >= 0) {
                System.out.println(g1 + g2);
            } else if (g1 > 0 && g2 < 0) {
                System.out.println(g1);
            } else if (g1 < 0 && g2 > 0) {
                System.out.println(g2);
            }else{
                  System.out.println("0");
            }
        }else{
            System.out.println("0");
        }

    }
}


import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.IOException;
import java.util.Arrays;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Map;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.util.Set;

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

class TaskG {

    long INF= (long) 1e17;
    public void solve(int testNumber, MyScanner in, MyPrintWriter out) {
        long s = in.nextLong();
        out.println(solve(s));
    }
    public long solve(long s){
        long res = 0;
        for (int l = 0; l <= 55; l++)
            for (int r = 0; r <= 55; r++) {
                long L=0,R=INF;
                while(R-L>1){
long min=0;
                    long max=0;
                    long m = (R+L)/2;

                    min += m;
                    long v=m*2;
                    for(int i=0;i<l;i++){
                        min = Math.min(min + v, INF);
                        v = Math.min(v * 2, INF);
                    }
                    v=m*2+1;
                    for(int i=0;i<r;i++){
                        min = Math.min(min + v, INF);
                        v = Math.min(v * 2, INF);
                    }

                    max += m;
                    v=m*2;
                    for(int i=0;i<l;i++){
                        max = Math.min(max + v, INF);
                        v = Math.min(v * 2 + 1, INF);
                    }
                    v=m*2+1;
                    for(int i=0;i<r;i++){
                        max = Math.min(max + v, INF);
                        v = Math.min(v * 2 + 1, INF);
                    }
                    if (s < min) {
                        R = m;
                    } else if (s > max) {
                        L = m;
                    } else {
                        res += solve(s - min,l,r);
                        break;
                    }
                }
            }
        return res;
    }

    Map<Long, Long> cur = new HashMap<>();
    Map<Long, Long> nxt = new HashMap<>();
    private long solve(long s, int l, int r) {
l = Math.max(l-1, 0);
        r = Math.max(r-1, 0);
        long[] cand = new long[l + r];
        for(int i=0;i<l;i++)cand[i] = (1L << i+1) - 1;
        for(int i=0;i<r;i++)cand[l + i] = (1L << i+1) - 1;
        Arrays.sort(cand);

        long rest = 0;
        for(int i=0;i<cand.length;i++)rest += cand[i];
        cur.clear();
        cur.put(0L, 1L);
        for(int i=cand.length-1;i>=0;i--) {
            nxt.clear();
            long c = cand[i];
            rest -= c;
            for(Map.Entry<Long, Long> e : cur.entrySet()) {
                long val = e.getKey();
                if (val + c <= s) {
                    if(!nxt.containsKey(val+c)){
                        nxt.put(val+c, e.getValue());
                    } else{
                        nxt.put(val+c, nxt.get(val+c) + e.getValue());
                    }
                }
                if (val + rest >= s) {
                    if(!nxt.containsKey(val)){
                        nxt.put(val, e.getValue());
                    } else{
                        nxt.put(val, nxt.get(val) + e.getValue());
                    }
                }
            }
            Map<Long, Long> tmp=cur;cur=nxt;nxt=tmp;
        }
        return cur.containsKey(s) ? cur.get(s) : 0;
    }

}

class MyScanner {
    private final InputStream in;

    public MyScanner(InputStream in) {
        this.in = in;
    }

    private static final int BUFSIZE = 65536;
    int bufLen;
    int bufPtr;
    byte[] buf = new byte[BUFSIZE];

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

    public long nextLong() {
        int c = read();
        if (c == -1) throw new NoSuchElementException();
        while (c != '-' && (c < '0' || '9' < c)) {
            c = read();
            if (c == -1) throw new NoSuchElementException();
        }
        if (c == '-') return -nextLong();
        long res = 0;
        do {
            res *= 10;
            res += c - '0';
            c = read();
        } while ('0' <= c && c <= '9');
        return res;
    }

}

class MyPrintWriter {
    PrintWriter out;

    public MyPrintWriter(OutputStream outputStream) {
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
    }

    public void println(Object... os) {
        if (os.length == 0) {
            out.println();
            return;
        }
        for (int i = 0; i < os.length - 1; i++) {
            out.print(os[i]);
            out.print(' ');
        }
        out.println(os[os.length - 1]);
    }

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

}


import java.util.*;

public class aafef {
	public static void main(String[] args) {
		Scanner scanny = new Scanner(System.in);
		int x = scanny.nextInt();
		int y = scanny.nextInt();
		if(x>=y) System.out.println(1);
		else if(y%x==0) System.out.println(y/x);
		else System.out.println((y/x)+1);
	}
}


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

public class B
{
    static void find_divisors(int n, ArrayList<Integer> li){

        for(int i = 1; i <= Math.sqrt(n); i++){
            if(n % i != 0)
                continue;
            li.add(i);

            if(n/i != i)
                li.add(n/i);
        }

        Collections.sort(li);
    }

    public static void process(int test_number)throws IOException
    {
        int n = ni(), k = ni();
        long dp[][] = new long[k + 1][n + 1];
        dp[0][0] = 1l;
        dp[0][1] = 1l;

        ArrayList<Integer> l[] = new ArrayList[n + 1];
        for(int i = 0; i <= n; i++)
            l[i] = new ArrayList<Integer>();

        for(int i = 1; i <= n; i++){
            find_divisors(i, l[i]);
            //trace(i, l[i]);
        }

        for(int i = 1; i <= k; i++){
            for(int j = 1; j <= n; j++){

                for(int div : l[j]){ //trace(l[j]);
                    dp[i][j] += dp[i - 1][div];
                    dp[i][j] %= mod;
                }
            }
        }

        long res = 0l;
        for(int i = 1; i <= n; i++){
            res = (res + dp[k][i]) % mod; //trace(i, dp[k][i]);
        }

        pn(res);
    }

    static final long mod = (long)1e9+7l;

    static FastReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        out = new PrintWriter(System.out);
        sc = new FastReader();

        long s = System.currentTimeMillis();
        int t = 1;
        //t = ni();
        for(int i = 1; i <= t; i++)
            process(i);

        out.flush();
        System.err.println(System.currentTimeMillis()-s+"ms");
    }

    static void trace(Object... o){ System.err.println(Arrays.deepToString(o)); };
    static void pn(Object o){ out.println(o); }
    static void p(Object o){ out.print(o); }
    static int ni()throws IOException{ return Integer.parseInt(sc.next()); }
    static long nl()throws IOException{ return Long.parseLong(sc.next()); }
    static double nd()throws IOException{ return Double.parseDouble(sc.next()); }
    static String nln()throws IOException{ return sc.nextLine(); }
    static long gcd(long a, long b)throws IOException{ return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{ return (b==0)?a:gcd(b,a%b); }
    static int bit(long n)throws IOException{ return (n==0)?0:(1+bit(n&(n-1))); }

    static class FastReader{
        BufferedReader br;
        StringTokenizer st;

        public FastReader(){
            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();
        }

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


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

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

	private String next() throws Exception{
		while (str == null || !str.hasMoreElements())
			str = new StringTokenizer(in.readLine());
		return str.nextToken();
	}

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

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

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

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		int h1 = nextInt(), h2 = nextInt();
		int a = nextInt(), b = nextInt();

		if (h1 + a * 8 >= h2) {
			out.println(0);
			out.close();
			return;
		}
		int progress = 12 * (a - b);
		if (progress <= 0) {
			out.println(-1);
			out.close();
			return;
		}

		out.println((h2 - h1 - a * 8 + progress - 1) / progress);
		out.close();
	}

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


import java.util.Scanner;
public class b146 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        for(int i=a+1;i<=177777;i++)
            if(ans(i)==b)
            {
                System.out.println(i);
                break;
            }
        }
private static int ans(int a)
{
    String b1="0";
    String s=Integer.toString(a);
    for(int i=0;i<s.length();i++)
        if(s.charAt(i)=='4' || s.charAt(i)=='7')
            b1+=s.charAt(i);
    int c=Integer.parseInt(b1);
    return c;
}
}


import java.util.Scanner;

public class SoldierAndBananas {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		//costFactor = cost for 1st banana
		int costFactor = scanner.nextInt();
		int initialMoney = scanner.nextInt();
		int numBananas = scanner.nextInt();
		//sum is 1 + 2 + 3 + ... + numBananas, the formula for general sequence is n(a1 + an) / 2.
		int sum = numBananas * (1 + numBananas) / 2 ;
		//calculate the total cost and print the money he needs (total cost of bananas - money he already has)
		int totalCost = sum * costFactor;
		int moneyNeeded = totalCost - initialMoney;
		//accounting for negative money (if he has more than enough he needs to borrow 0)
		if (moneyNeeded < 0) {
			moneyNeeded = 0;
		}
		System.out.println(moneyNeeded);
	}
}


//import java.util.Scanner;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.PriorityQueue;

import java.util.StringTokenizer;
import java.util.TreeSet;

public class Main {

	public static void main(String[] args) throws IOException
	{
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
	    int arr[]=new int[n];
	    for(int i=0;i<n;i++)
	    	arr[i]=sc.nextInt();
	    int j=0,l=0;
	    int count=0;
	    int flag=0;
	    for(int i=0;i<n;i++)
	    {
	    	if(arr[i]<=k) {
	    		count++;

	    	}
	    	else
	    	{
	    		flag=1;
	    		break;
	    	}
	    }
	    for(int i=n-1;i>0&&flag==1;i--)
	    {
	    	if(arr[i]<=k) {
	    		count++;
	    	}
	    	else
	    	{
	    		break;
	    	}
	    }

			System.out.print(count);
}
}
	class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens()) {//lma ykon fe next token mesh hyd5ol fe while bs yrg3li l token elii wrah
				st = new StringTokenizer(br.readLine());
			//System.out.println(br.readLine());
				}
			return st.nextToken();
		}

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

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

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public boolean ready() throws IOException {
			return br.ready() || st.hasMoreTokens();//an br ready y3ni fe line tany w st 3ndha tokens (y3ni rg3ly next token bs mtd5olesh fe while)

		}}


// package CF;

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

public class F {
	static char [] num;
	static long [][][] memo;
	static int n;
	static long dp(int idx, int prev, int df){
		if(idx == n)
			return df == 1?1:0;
		if(memo[idx][prev][df] != -1)
			return memo[idx][prev][df];
		long ans = 0;
		int dig = (prev + num[idx] - '0')/2;
		ans += dp(idx+1, dig, df | (num[idx]-'0'==dig?0:1));
		int dig_c = (prev + num[idx] - '0' + 1)/2;
		if(dig_c != dig)
			ans += dp(idx+1, dig_c, df | (num[idx]-'0'==dig_c?0:1));
		return memo[idx][prev][df] = ans;
	}
	public static void main(String[] args) throws Exception
	{
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		num = sc.next().toCharArray();
		n = num.length;
		memo = new long[n+1][10][2];
		for(long [][]i:memo)
			for(long[]j:i)
			Arrays.fill(j, -1);
		long ans = 0;
		for (int i = 0; i < 10; i++) {
			ans += dp(1, i, num[0]-'0'==i?0:1);
		}
		out.println(ans);
		out.flush();
		out.close();
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s)
		{
			br = new BufferedReader(new InputStreamReader(s));
		}

		public Scanner(FileReader fileReader)
		{
			br = new BufferedReader(fileReader);
		}

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

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

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

		public String nextLine() throws IOException
		{
			return br.readLine();
		}

		public boolean ready() throws IOException
		{
			return br.ready();
		}
	}
}


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

public class Grep{
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        List<Integer> nums = new ArrayList<>();
        String[] str = reader.readLine().split(" ");

        for(String i : str){
            nums.add(Integer.parseInt(i));
        }

        List<Integer> list = new ArrayList<>();
        list.add(1);
        list.add(2);
        list.add(3);

        for(int i = 0; i < list.size(); i++){
            if(!nums.contains(list.get(i))){
                System.out.println(list.get(i));
            }
        }
	}
}


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;

public class A {

	// -- DEBUG switch --
	static final boolean DBG = true;
	static StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
	static PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

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

	public static void main(String[] args) throws IOException {
		long ab = l(), ac = l(), bc = l();
		long abc = (long)Math.sqrt(ab * ac * bc);

		pw.println(4*(abc/ab + abc/ac + abc/bc));
		pw.close();
	}

	static int i() throws IOException{
		st.nextToken();
		return (int)st.nval;
	}

	static long l() throws IOException {
		st.nextToken();
		return (long)st.nval;
	}

	static double d() throws IOException {
		st.nextToken();
		return st.nval;
	}
	static String s() throws IOException{
		st.nextToken();
		return st.sval;
	}
}


import java.util.Scanner;

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

        int n = sc.nextInt();
        int prev=0, cur=0, time=0;

        for(int i=0; i<n+1; i++) {
            if(i!=n) cur=sc.nextInt();
            else cur=90;
            if(cur-prev <= 15) {
                time+=cur-prev;
            }
            else {
                time+=15;
                break;
            }
            prev=cur;
        }

        System.out.println(time);
    }
}


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

public class M
{
    static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[1024]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }

		public String next() throws IOException
		{
			return readLine();
		}
    }

	static int root(int arr[] , int x)
	{
		while(arr[x] != x)
		{
			arr[x] = arr[arr[x]];
			x  = arr[x];
		}
		return x;
	}

	static void union_find(int arr[] , int size[] , int x , int y)
	{
		int root_x = root(arr , x);
		int root_y = root(arr , y);

		if(root_x != root_y)
		{
			if(size[root_x] > size[root_y])
			{
				arr[root_y] = arr[root_x];
				size[root_x] += size[root_y];
			}
			else
			{
				arr[root_x] = arr[root_y];
				size[root_y] += size[root_x];
			}
		}
	}

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

		int a = In.nextInt();
		int b = In.nextInt();
		int c = In.nextInt();

		int ans = 0;

		if(b < a && c < a)
			System.out.println("-1");
		else
		{
			/*int max = Math.max(b,c);

			while(max >= a)
			{
				if(b == max)
				{
					b -= a;
				}
				else if(c == max)
				{
					c -= a;
				}
				max = Math.max(b,c);
				ans++;
			}*/

			if(b%a <= (c/a)*(a-1) && c%a <= (b/a)*(a-1))
				System.out.println(b/a + c/a);
			else
			System.out.println("-1");

		}
    }
}


import java.io.*;
import java.util.*;
import java.util.function.Consumer;

public class Solution {

    static MyScanner sc;
    private static PrintWriter out;
    static long M2 = 1_000_000_000L + 7;

    public static void main(String[] s) throws Exception {
        StringBuilder stringBuilder = new StringBuilder();

        if (stringBuilder.length() == 0) {
            sc = new MyScanner(System.in);
        } else {
            sc = new MyScanner(new BufferedReader(new StringReader(stringBuilder.toString())));
        }

        out = new PrintWriter(new OutputStreamWriter(System.out));

        initData();
        solve();
        out.flush();
    }

    private static void initData() {

    }

    private static void solve() throws IOException {
        int[] zz = sc.na(24);

        int[][] mm1 = new int[][]{
                {5, 6, 17, 18, 21, 22, 13, 14},
                {2, 4, 6, 8, 10, 12, 23, 21},
                {3, 4, 17, 19, 10, 9, 16, 14}
        };

        for (int[] ll : mm1) {
            if (v(Arrays.copyOf(zz, 24), ll, 2) || v(Arrays.copyOf(zz, 24), ll, -2)) {
                out.println("yes");
                return;
            }
        }

        out.println("no");
    }

    private static boolean v(int[] ints, int[] ll, int k) {
        int[] rr = new int[8];
        for (int r = 0; r <  8; r++) {
            rr[r] = ints[ll[r] - 1];
        }
        for (int r = 0; r < 8; r++) {
            int ind = (r + k) % 8;
            if (ind < 0) ind += 8;
            ints[ll[ind] - 1] = rr[r];
        }

        return s(ints);
    }

    private static boolean s(int[] ints) {
        for (int r = 0; r < 6; r++) {
            if (Arrays.stream(Arrays.copyOfRange(ints, r * 4, r * 4 + 4)).distinct().count() != 1) {
                return false;
            }
        }
        return true;
    }

    private static boolean vv(int[] zz, int[] zz1, int[] zz2, int[] zz3) {
        return v1(zz, zz1, zz2, zz3) || v1(zz3, zz2, zz1, zz);
    }

    private static boolean v1(int[] zz, int[] zz1, int[] zz2, int[] zz3) {
        return false;
    }

    private static void xx(int[] zz, int[] zz1, int[] zz2, boolean[] res) {
        for (int t : zz)
            for (int k : zz1)
                for (int k1 : zz2) {
                    res[t * 100 + k * 10 + k1] = true;
                }
    }

    private static void xx(int[] z1, int[] z2, boolean[] res) {
        for (int t1 : z1)
            for (int t2 : z2) {
                res[t1 * 10 + t2] = true;
                res[t2 * 10 + t1] = true;
            }
    }

    private static final class LogTreePar {

        private final int[] levels;
        private final int[][] parents;

        public LogTreePar(int n) {
            levels = new int[n];
            parents = new int[n][19];
            Arrays.fill(levels, -1);
            for (int[] x : parents) {
                Arrays.fill(x, -1);
            }
        }

        public boolean ispar(int f, int l) {
            if (levels[f] >= levels[l]) return false;
            int diff = levels[l] - levels[f];
            return up(l, diff) == f;
        }

        private int up(int item, int diff) {
            int r = 0;
            while (diff > 0 && item >= 0) {
                if (isset(diff, r)) {
                    diff ^= 1 << r;
                    item = parents[item][r];
                }
                r++;
            }
            return item;
        }

        public void add(int item, int parent) {
            parents[item][0] = parent;
            clt(item);
        }

        protected void clt(int item) {
            levels[item] = levels[parents[item][0]] + 1;
            for (int l = 1; l < 19; l++) {
                if (parents[item][l - 1] == -1) break;
                parents[item][l] = parents[parents[item][l - 1]][l - 1];
            }
        }

        public int lca(int f, int l) {
            if (levels[f] > levels[l]) {
                return lca(l, f);
            }
            return lca1(f, up(l, levels[l] - levels[f]));
        }

        private int lca1(int f1, int f2) {
            for (int r = 18; r >= 0 && f1 != f2; r--) {
                if (parents[f1][r] != parents[f2][r]) {
                    f1 = parents[f1][r];
                    f2 = parents[f2][r];
                }
            }
            return f1 == f2 ? f1 : parents[f1][0];
        }
    }

    private static class P {
        private boolean b;
        private final int ind;
        private final int parent;

        public P(int i, boolean b, int par) {
            this.ind = i;
            this.b = b;
            this.parent = par;

        }
    }

    private static void dfs(int start, int[][] neig, Consumer<int[]> onAdd, Consumer<int[]> onRemove) {
        ArrayList<P> toVisit = new ArrayList<P>(3000);
        toVisit.add(new P(start, true, -1));
        boolean[] vis = new boolean[neig.length];
        vis[start] = true;
        int[] level = new int[neig.length];
        while (toVisit.size() > 0) {
            P ppr = toVisit.remove(toVisit.size() - 1);
            if (!ppr.b) {
                onRemove.accept(new int[]{ppr.ind, level[ppr.ind], ppr.parent});
                continue;
            }
            ppr.b = false;
            int i = ppr.ind;
            toVisit.add(ppr);
            onAdd.accept(new int[]{ppr.ind, level[ppr.ind], ppr.parent});
            for (int kk : neig[i]) {
                if (!vis[kk]) {
                    vis[kk] = true;
                    level[kk] = level[i] + 1;
                    toVisit.add(new P(kk, true, i));
                }
            }
        }

    }

    private static int[][] tr(int n) {
        int[][] x = new int[2][n - 1];
        for (int i = 0; i < n - 1; i++) {
            x[0][i] = sc.nextInt() - 1;
            x[1][i] = sc.nextInt() - 1;
        }
        return pn(x, n);
    }

    private static int[][] pn(int[][] x, int n) {
        int[] ct = new int[n];
        int[][] res = new int[n][];
        for (int v : x[0]) {
            ct[v]++;
        }
        for (int v : x[1]) {
            ct[v]++;
        }
        for (int l = 0; l < n; l++) {
            res[l] = new int[ct[l]];
        }
        for (int i = 0; i < x[0].length; i++) {
            res[x[0][i]][--ct[x[0][i]]] = x[1][i];
            res[x[1][i]][--ct[x[1][i]]] = x[0][i];
        }
        return res;
    }

    private static boolean isset(long i, int k) {
        return (i & (1 << k)) > 0;
    }

    private static void solveT() throws IOException {
        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
    }

    private static long gcd(long l, long l1) {
        if (l > l1) return gcd(l1, l);
        if (l == 0) return l1;
        return gcd(l1 % l, l);
    }

    private static long pow(long a, long b, long m) {
        if (b == 0) return 1;
        if (b == 1) return a;
        long pp = pow(a, b / 2, m);
        pp *= pp;
        pp %= m;
        return (pp * (b % 2 == 0 ? 1 : a)) % m;
    }

    static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        MyScanner(BufferedReader br) {
            this.br = br;
        }

        public MyScanner(InputStream in) {
            this(new BufferedReader(new InputStreamReader(in)));
        }

        void findToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        String next() {
            findToken();
            return st.nextToken();
        }

        Integer[] nab(int n) {
            Integer[] k = new Integer[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.fi();
            }
            return k;
        }

        int[] na(int n) {
            int[] k = new int[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.fi();
            }
            return k;
        }

        long[] nl(int n) {
            long[] k = new long[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.nextLong();
            }
            return k;
        }

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

        int fi() {
            String t = next();
            int cur = 0;
            boolean n = t.charAt(0) == '-';
            for (int a = n ? 1 : 0; a < t.length(); a++) {
                cur = cur * 10 + t.charAt(a) - '0';
            }
            return n ? -cur : cur;
        }

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

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

}


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

public class tmp{
	BufferedReader reader;
	StringTokenizer tokenizer;
	PrintWriter writer;

	void run(){
		try{
			reader=new BufferedReader(new InputStreamReader(System.in));
			tokenizer=null;
			writer=new PrintWriter(System.out);
			solve();
			reader.close();
			writer.close();
		}catch(Exception e){
			e.printStackTrace();
			System.exit(1);
		}
	}

	String nextToken() throws IOException{
		while(tokenizer==null || !tokenizer.hasMoreTokens()){
			tokenizer=new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}

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

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

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

	void solve() throws IOException{
		int n=nextInt(),m=nextInt(),k=nextInt();
		String lines[]=new String[n];
		int nR=0,nG=0;
		for(int i=0;i<n;i++){
			lines[i]=nextToken();
			for(char c:lines[i].toCharArray()){
				if(c=='R') ++nR;
				if(c=='G') ++nG;
			}
		}
		if(nG==0 || m==1){
			System.out.println("Second");
			return;
		}
		boolean cantDieR=false,cantDieG=false;
		int xor[]=new int[10];
		for(String line:lines){
			boolean hasR=(0<=line.indexOf('R'));
			boolean hasG=(0<=line.indexOf('G'));
			if(!hasR && !hasG) continue;
			if(hasR && hasG){
				if(0<=line.indexOf("RG") || 0<=line.indexOf("GR")) continue;
				int a=line.indexOf('R');
				int b=line.indexOf('G');
				int num=Math.abs(a-b)-1;
				for(int i=0;i<10;i++){
					xor[i]=(xor[i]+num%2)%(k+1);
					num/=2;
				}
				continue;
			}
			if(hasR && !line.equals("RR")) cantDieR=true;
			if(hasG && !line.equals("GG")) cantDieG=true;
		}
		if(cantDieR && cantDieG){
			System.out.println("Draw");
			return;
		}
		if(cantDieG){
			System.out.println("First");
			return;
		}
		if(cantDieR){
			System.out.println("Second");
			return;
		}
		for(int i:xor){
			if(i!=0){
				System.out.println("First");
				return;
			}
		}
		System.out.println("Second");
	}

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


import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Game {

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

	        ArrayList<Integer>[] c = new ArrayList[3];
	        for(int i = 0; i < 3; ++i)  c[i] = new ArrayList<Integer>();
	        for(int i = 0; i < n; ++i)  c[sc.nextInt() - 1].add(i);

	        Set<Integer>[] before = new Set[n];
	        for(int i = 0; i < n; ++i)  before[i] = new TreeSet<Integer>();
	        for(int i = 0; i < n; ++i) {
	            int k = sc.nextInt();
	            for(int j = 0; j < k; ++j)  before[i].add(sc.nextInt() - 1);
	        }

	        int ans = Integer.MAX_VALUE;
	        for(int i = 0; i < 3; ++i) {
	            int[] need = new int[n];
	            boolean[] executed = new boolean[n];
	            Arrays.fill(executed, false);
	            for(int j = 0; j < n; ++j)  need[j] = before[j].size();

	            int cur = i, cnt = 0, localans = 0;
	            while(cnt < 3) {
	                int task = -1;
	                for(int j = 0; j < c[cur].size(); ++j)  {
	                    if(executed[c[cur].get(j)] || need[c[cur].get(j)] != 0)  continue;
	                    task = c[cur].get(j);
	                    break;
	                }
	                if(task == -1) {
	                    ++cnt; ++localans;
	                    cur = cur == 2 ? 0 : cur + 1;
	                    continue;
	                }
	                cnt = 0; ++localans;
	                executed[task] = true;
	                for(int j = 0; j < n; ++j)  if(before[j].contains(task))    --need[j];
	            }
	            ans = Math.min(ans, localans - 3);
	        }
	        System.out.println(ans);
	    }
	}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.util.Collections;
import java.io.InputStreamReader;
import java.util.ArrayList;
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);
        Task1108B solver = new Task1108B();
        solver.solve(1, in, out);
        out.close();
    }

    static class Task1108B {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            ArrayList<Integer> list = new ArrayList<>();
            for (int i = 0; i < n; i++) {
                list.add(in.nextInt());
            }
            Collections.sort(list);
            int max = list.get(list.size() - 1);
            int x = max;
            ArrayList<Integer> ll = divisor(x);
            int j = 0;
//        out.println(list);
//        out.println(ll);
            for (int i = 0; i < list.size(); i++) {
                if (ll.contains(list.get(i))) {
                    list.remove(i);
                    i--;
                    ll.remove(j);
//                j++;
                }
            }
//        out.println(ll);
            out.println(max + " " + list.get(list.size() - 1));
        }

        public ArrayList<Integer> divisor(int n) {
            ArrayList<Integer> list = new ArrayList<>();
            for (int i = 1; i <= n; i++) {
                if (n % i == 0) {
                    list.add(i);
                }
            }
            Collections.sort(list);
            return list;
        }

    }

    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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.StringTokenizer;
/*
3 3 5
0 1 1 0 7
1 1 1 0 10
1 1 1 1 2
1 1 1 2 2
0 1 1 2 3

500 500 2
0 1 1 0 4
0 1 1 1 2

500 500 8
100 100 5 5 1
100 101 5 5 2
101 100 5 5 3
101 101 5 5 4
100 100 6 5 5
100 101 6 5 6
101 100 6 5 7
101 101 6 5 8

6 7 6
0 2 2 2 100
0 3 3 3 100
0 2 2 1 201
0 3 3 2 5
1 2 1 3 1000
1 2 1 2 1000
200

6 7 6
0 2 2 2 100
0 3 3 3 100
0 2 2 1 194
0 3 3 2 5
1 2 1 3 1000
1 2 1 2 1000
199

6 7 6
1 2 2 3 100
1 3 3 4 100
1 2 2 2 194
1 3 3 3 5
2 2 1 4 1000
2 2 1 3 1000
0
 */
public class C {

	static long[][] costOf;
	static BonusAtSquare[][] hBonuses, vBonuses;
	static int maxX, maxY;
	static long[][][][] dp;

	public static void main(String[] args) {
		FastScanner fs=new FastScanner();
		maxX=fs.nextInt();
		maxY=fs.nextInt();
		int nRobots=fs.nextInt();
		costOf=new long[maxX][maxY];
		hBonuses=new BonusAtSquare[maxX][maxY];
		vBonuses=new BonusAtSquare[maxX][maxY];
		for (int x=0; x<maxX; x++)
			for (int y=0; y<maxY; y++) {
				hBonuses[x][y]=new BonusAtSquare();
				vBonuses[x][y]=new BonusAtSquare();
			}

		for (int i=0; i<nRobots; i++) {
			int x=fs.nextInt(), y=fs.nextInt(), d=fs.nextInt(), t=fs.nextInt();
			long killCost=fs.nextInt();
			processTransformer(x, y, d, t, killCost);
		}
		long startTime=System.currentTimeMillis();
		dp=new long[2][2][maxY+1][511];
		for (int i=0; i<dp.length; i++)
			for (int j=0; j<dp[i].length; j++)
				for (int k=0; k<dp[i][j].length; k++)
					Arrays.fill(dp[i][j][k], -1);
		for (int xAt=maxX-1; xAt>=0; xAt--) {
			for (int j=0; j<dp[0].length; j++)
				for (int k=0; k<dp[0][j].length; k++)
					Arrays.fill(dp[(xAt&1)][j][k], -1);

			for (int yAt=maxY-1; yAt>=0; yAt--) {
				for (int goingH=0; goingH<2; goingH++) {
					for (int timesGoingStraight=0; timesGoingStraight<=(goingH==0?xAt:yAt); timesGoingStraight++) {
						go(xAt, yAt, timesGoingStraight, goingH);
					}
				}
			}
		}
		long ans=go(0, 0, 0, 0);
		System.out.println(ans);
		System.err.println(System.currentTimeMillis()-startTime);
	}

	static long go(int x, int y, int timesGoingStraight, int goingH) {
		if (x==maxX-1&&y==maxY-1) {
			return 0;
		}
		if (dp[(x&1)][goingH][y][timesGoingStraight]!=-1) return dp[(x&1)][goingH][y][timesGoingStraight];
		long curCost=costOf[x][y];
		if (goingH==1)
			curCost-=hBonuses[x][y].getBonus(timesGoingStraight);
		else
			curCost-=vBonuses[x][y].getBonus(timesGoingStraight);
//		System.out.println("Cur cost "+x+" "+y+" is "+curCost);
		long best;
		if (goingH==1) {
			long goH=y+1<maxY?go(x, y+1, timesGoingStraight+1, 1):Long.MAX_VALUE;
			long goV=x+1<maxX?go(x+1, y, 1, 0):Long.MAX_VALUE;
			best=min(goH, goV)+curCost;
		}
		else {
			long goH=y+1<maxY?go(x, y+1, 1, 1):Long.MAX_VALUE;
			long goV=x+1<maxX?go(x+1, y, timesGoingStraight+1, 0):Long.MAX_VALUE;
			best=min(goH, goV)+curCost;
		}
//		System.out.println(x+" "+y+" "+timesGoingStraight+" "+goingH);
		return dp[(x&1)][goingH][y][timesGoingStraight]=best;
	}
	static long min(long a, long b) { return a < b ? a : b;}

	//have to process these in increasing straight distance
	static class BonusAtSquare {
		PriorityQueue<Bonus> pq=new PriorityQueue<>();
		public long bonusAdded=0;

		public void addBonus(int goingStraightFor, long bonus) {
			pq.add(new Bonus(goingStraightFor, bonus));
		}

		public long getBonus(int goingStraightFor) {
			while (!pq.isEmpty()&&goingStraightFor>=pq.peek().goingStraightFor) {
				Bonus next=pq.remove();
				bonusAdded+=next.points;
			}
			return bonusAdded;
		}
	}

	static class Bonus implements Comparable<Bonus> {
		int goingStraightFor;
		long points;
		public Bonus(int goingStraightFor, long points) {
			this.goingStraightFor=goingStraightFor;
			this.points=points;
		}

		public int compareTo(Bonus o) {
			return Integer.compare(goingStraightFor, o.goingStraightFor);
		}
	}

	static void processTransformer(int x, int y, int d, int t, long fightCost) {
//		System.out.println("Processing transformer ("+x+", "+y+") d: "+d+" startTime: "+t+" fightCost: "+fightCost);
		int[] xs=new int[4];
		int[] ys=new int[4];
		int[] firstTime=new int[4];
		xs[0]=x;
		ys[0]=y;
		firstTime[0]=t;
		xs[1]=x+d;
		ys[1]=y-d;
		firstTime[1]=t+1;
		xs[2]=x+d;
		ys[2]=y;
		firstTime[2]=t+2;
		xs[3]=x;
		ys[3]=y+d;
		firstTime[3]=t+3;

		ArrayList<Integer> xMatters=new ArrayList<>();
		ArrayList<Integer> yMatters=new ArrayList<>();
		for (int i=0; i<4; i++) {
			if (matters(xs[i], ys[i], firstTime[i])) {
				xMatters.add(xs[i]);
				yMatters.add(ys[i]);
			}
		}
//		System.out.println("\t"+xMatters+" "+yMatters);
		if (xMatters.size()>2) throw null;
		if (xMatters.size()==0) return;
		if (xMatters.size()==1) {
			costOf[xMatters.get(0)][yMatters.get(0)]+=fightCost;
		}
		else {
			costOf[xMatters.get(0)][yMatters.get(0)]+=fightCost;
			costOf[xMatters.get(1)][yMatters.get(1)]+=fightCost;
			if (xMatters.get(0)==(int)xMatters.get(1)) {
				hBonuses[xMatters.get(1)][yMatters.get(1)].addBonus(d, fightCost);
			}
			else {
				if (yMatters.get(0)==(int)yMatters.get(1)) {
					vBonuses[xMatters.get(1)][yMatters.get(1)].addBonus(d, fightCost);
				}
			}
		}
	}

	static boolean matters(int x, int y, int t) {
		if (x+y<t) return false;
		if ((t-x-y)%4!=0) return false;
		return true;
	}

	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		public String next() {
			while (!st.hasMoreElements())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			return st.nextToken();
		}

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

}


//coderadi
import java.io.*;
import java.util.*;
public class A {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] ar = sc.next().toCharArray();
		int[] ar2 = new int[ar.length];
		int max = 0;
		for(int i=0; i<ar.length; i++){
			ar2[i] = ar[i] - '0';
			max = Math.max(max, ar2[i]);
		}

		System.out.println(max);
		boolean flag = true;
		while(flag == true){
			flag = false;
			StringBuilder sb = new StringBuilder();
			for(int i=0; i<ar2.length; i++){
				if(ar2[i] > 0){
					sb.append("1");
					ar2[i]--;
					flag = true;
				}
				else if(ar2[i] <= 0 && flag){
					sb.append("0");
				}
			}
			if(flag)
			System.out.print(sb + " ");
		}
		System.out.println();
	}
}


import java.util.*;
import java.math.*;
public class MyClass {

    public static void main(String args[]) {

      int n,k,i,j,t,m=0;
      double a;

      Scanner x=new Scanner(System.in);
      n=x.nextInt();
       if(n%2!=0)
       {
       System.out.println(0);

       }
       else
       {
      k=n/2;
      a=Math.pow(2,k);
      j=(int)a;

        System.out.println(j);
       }

    }
}


import java.util.Scanner;

/**
 * Contest: Educational Codeforces Round 52
 *
 * @author Arturs Licis
 */
public class ProblemB {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong();
		long m = sc.nextLong();

		if (n == 1) {
			System.out.println("1 1");
			return;
		}

		if (n == 2) {
			if (m == 0) System.out.println("2 2");
			else if (m == 1) System.out.println("0 0");
			return;
		}

		if (m == 0) {
			System.out.println(n + " " + n);
			return;
		}

		// calc min
		long edgesForMin = n / 2l + n % 2l;
		long min = (m >= edgesForMin) ? 0 : n - m * 2;

		// calc max
		long nn = 2;
		while ((nn * (nn - 1l)) / 2l < m) nn++;
		long max = n - nn;
		System.out.println(min + " " + max);

		System.out.flush();
	}
}


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

public class Counterexample {
	static Scanner sc;
	static PrintWriter out;
	public static void main(String[] args) throws Exception{
		sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		long l=sc.nextLong(),r=sc.nextLong();
		if(r-l < 2 || (r-l==2&&l%2==1))
		{
			out.println(-1);
		}
		else
		{
			int rem = (int)(l%2);
			out.println((l+rem)+" "+(l+1+rem)+" "+(l+2+rem));
		}
		out.flush();
		out.close();
	}

	static class Scanner{
		StringTokenizer st;
		BufferedReader br;
		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
		public Scanner(FileReader file) {
			br = new BufferedReader(file);
		}
		public String next() throws IOException {
			while(st == null || !st.hasMoreTokens())
			{
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
		public int nextInt()throws IOException{
			return Integer.parseInt(next());
		}
		public double nextDouble()throws IOException{
			return Double.parseDouble(next());
		}
		public char nextChar()throws IOException{
			return next().charAt(0);
		}
		public long nextLong()throws IOException{
			return Long.parseLong(next());
		}
		public boolean ready() throws IOException {
			return br.ready();
		}
		public void waitForInput() throws InterruptedException {
			Thread.sleep(5000);
		}
	}
}


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

public class enc
{
    public static void main(String[] args) throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        int n=Integer.parseInt(br.readLine());
		//System.out.println("\n");
        String s=br.readLine();
        int k=1;
        int i=0;
        String str="";
        while(k<n+1)
        {
            String ss="";
            if(i<s.length()){
            ss=Character.toString(s.charAt(i));}
            str+=ss;
            i+=k;
            k++;
        }
		String se=str.trim();
        System.out.println(se);
    }
}


import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;

public class Main {

	static class pair{
		long x;
		long y;

		pair(long a,long b){
			x = a;
			y = b;
		}
	}

	static long solve(pair p1,long xx,long yy,long t,long a1,long a2,long b1,long b2,long xt,long yt) {
		long ans1 = 0;
		long x = p1.x;
		long y = p1.y;

		//System.out.println(x+" "+y);

		long d = Math.abs(x-xt)+Math.abs(y-yt);
		if(t>=d) {
			t-=d;
			ans1++;
		}
		else
			return ans1;

		//System.out.println(x+" "+y);

		while(x>xx&&y>yy) {
			long nx = (x-b1)/a1;
			long ny = (y-b2)/a2;
			long dist = Math.abs(nx-x)+Math.abs(ny-y);
			if(dist<=t) {
				ans1++;
				t-=dist;
			}
			else {
				break;
			}
			x = nx;
			y = ny;

			//System.out.println(x+" "+y);
		}

		d = Math.abs(x-p1.x)+Math.abs(y-p1.y);
		if(d<=t) {
			t-=d;
		}
		else{
		    return ans1;
		}

		//System.out.println(x+" "+y);

		x = p1.x;
		y = p1.y;
		while(t>0) {
			long nx = a1*x+b1;
			long ny = a2*y+b2;
			long dist = Math.abs(nx-x)+Math.abs(ny-y);
			if(dist<=t) {
				ans1++;
			}
			t-=dist;
			x = nx;
			y = ny;

			//System.out.println(x+" "+y);
		}

		return ans1;
	}

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		long xx = input.nextLong();
		long yy = input.nextLong();

		long a1 = input.nextLong();
		long a2 = input.nextLong();
		long b1 = input.nextLong();
		long b2 = input.nextLong();

		long xt = input.nextLong();
		long yt = input.nextLong();
		long t = input.nextLong();

		ArrayList<pair> ar = new ArrayList<pair>();
		long sx = xx;
		long sy = yy;
		ar.add(new pair(sx,sy));

		while(sx<xt||sy<yt) {
			sx = a1*sx+b1;
			sy = a2*sy+b2;
			ar.add(new pair(sx,sy));
		}

		long ans1 = 0;
		long ans2 = 0;

// 		pair p1 = ar.get(ar.size()-1);
// 		//System.out.println(p1.x+" "+p1.y);
// 		ans1 = solve(p1,xx,yy,t,a1,a2,b1,b2,xt,yt);
//		long x = p1.x;
//		long y = p1.y;
//
//		while(x>xx&&y>yy) {
//			long nx = (x-b1)/a1;
//			long ny = (y-b2)/a2;
//			long dist = Math.abs(nx-x)+Math.abs(ny-y);
//			if(dist<=t) {
//				ans1++;
//				t-=dist;
//			}
//			else {
//				break;
//			}
//			x = nx;
//			y = ny;
//		}
//
//		long d = Math.abs(x-p1.x)+Math.abs(y-p1.y);
//		if(d>=t) {
//			t-=d;
//		}
//
//		x = p1.x;
//		y = p1.y;
//		while(t>0) {
//			long nx = a1*x+b1;
//			long ny = a2*y+b2;
//			long dist = Math.abs(nx-x)+Math.abs(ny-y);
//			if(d>=t) {
//				ans1++;
//			}
//			t-=d;
//		}

// 		if(ar.size()>=2) {
// 			p1 = ar.get(ar.size()-2);
// 			//System.out.println(p1.x+" "+p1.y);
// 			ans2 = solve(p1,xx,yy,t,a1,a2,b1,b2,xt,yt);
// 		}

		long ans = 0;
		for(pair p:ar){
		    ans = Math.max(ans,solve(p,xx,yy,t,a1,a2,b1,b2,xt,yt));
		}
		System.out.println(ans);
	}

}


import java.util.Scanner;
public class Main {
	static int x1,y1,x2,y2,x3,y3;
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		x1=input.nextInt();
		y1=input.nextInt();
		x2=input.nextInt();
		y2=input.nextInt();
		x3=input.nextInt();
		y3=input.nextInt();
		if(is_triangle(x1,y1,x2,y2,x3,y3)) {
			System.out.println("RIGHT");
		}
		else if(is_triangle(x1-1,y1,x2,y2,x3,y3)||is_triangle(x1+1,y1,x2,y2,x3,y3)) {
			System.out.println("ALMOST");
		}
		else if(is_triangle(x1,y1-1,x2,y2,x3,y3)||is_triangle(x1,y1+1,x2,y2,x3,y3)) {
			System.out.println("ALMOST");
		}
		else if(is_triangle(x1,y1,x2-1,y2,x3,y3)||is_triangle(x1,y1,x2+1,y2,x3,y3)) {
			System.out.println("ALMOST");
		}
		else if(is_triangle(x1,y1,x2,y2-1,x3,y3)||is_triangle(x1,y1,x2,y2+1,x3,y3)) {
			System.out.println("ALMOST");
		}
		else if(is_triangle(x1,y1,x2,y2,x3-1,y3)||is_triangle(x1,y1,x2,y2,x3+1,y3)) {
			System.out.println("ALMOST");
		}
		else if(is_triangle(x1,y1,x2,y2,x3,y3-1)||is_triangle(x1,y1,x2,y2,x3,y3+1)) {
			System.out.println("ALMOST");
		}
		else {
			System.out.println("NEITHER");
		}
	}
	public static boolean is_triangle(int x1,int y1,int x2,int y2,int x3,int y3) {
		int a=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
		int b=(x1-x3)*(x1-x3)+(y1-y3)*(y1-y3);
		int c=(x2-x3)*(x2-x3)+(y2-y3)*(y2-y3);
		if(a==0||b==0||c==0) {
			return false;
		}
		else if(a+b==c||a+c==b||b+c==a) {
			return true;
		}
		else {
			return false;
		}
	}
}


//package arbuz;

import java.util.Scanner;

public class Arbuz {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double ax, ay, bx, by, cx, cy, k, offset = 0;
        ax = sc.nextInt();
        ay = sc.nextInt();
        bx = sc.nextInt();
        by = sc.nextInt();
        cx = sc.nextInt();
        cy = sc.nextInt();
        if (bx == ax) {
            k = Integer.MAX_VALUE;
        } else {
            k = (by - ay) / (bx - ax);
            offset = ay - k * ax;
        }
        if (k == Integer.MAX_VALUE) {
            if (ax == cx) {
                System.out.print("TOWARDS");
            } else {
                if ((by > ay && cx > ax) || (by < ay && cx < ax)) {
                    System.out.println("RIGHT");
                } else {
                    System.out.println("LEFT");
                }
            }
        } else {
            if (Math.abs(cy - k * cx - offset) < 0.0005) {
                System.out.println("TOWARDS");
            } else {
                if ((cy > k * cx + offset && ax > bx) || (cy < k * cx + offset && ax < bx)) {
                    System.out.println("RIGHT");
                } else {
                    System.out.println("LEFT");
                }
            }
        }
    }
}


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

public class E {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	static final int MOD = 1_000_000_007;

	boolean test(int mask, int i) {
		return ((mask >> i) & 1) == 1;
	}

	void solve() throws IOException {
		int n = nextInt();
		int k = nextInt();

		int[] fact = new int[n + 1];
		fact[0] = 1;
		for (int i = 1; i <= n; i++) {
			fact[i] = (int) ((long) fact[i - 1] * i % MOD);
		}

		int[] invFact = new int[n + 1];
		for (int i = 0; i <= n; i++)
			invFact[i] = pow(fact[i], MOD - 2);

		int[][] dp = new int[n + 1][4];
		dp[0][0] = 1;

		for (int pos = 0; pos < n; pos++) {
			int[][] next = new int[n + 1][4];
			for (int good = 0; good < n; good++) {
				for (int mask = 0; mask < 4; mask++) {
					if (dp[good][mask] != 0) {
						// put pos - 1
						if (pos != 0 && !test(mask, 0)) {
							next[good + 1][mask >> 1] += dp[good][mask];
							if (next[good + 1][mask >> 1] >= MOD)
								next[good + 1][mask >> 1] -= MOD;
						}
						// put pos + 1
						if (pos != n - 1) {
							next[good + 1][(mask >> 1) | 2] += dp[good][mask];
							if (next[good + 1][(mask >> 1) | 2] >= MOD)
								next[good + 1][(mask >> 1) | 2] -= MOD;
						}
						// put nothing
						next[good][mask >> 1] += dp[good][mask];
						if (next[good][mask >> 1] >= MOD)
							next[good][mask >> 1] -= MOD;
					}
				}
			}
			dp = next;
		}

		int[] val = new int[n + 1];
		for (int i = 0; i <= n; i++) {
			for (int j = 0; j < 4; j++) {
				val[i] += dp[i][j];
				if (val[i] >= MOD)
					val[i] -= MOD;
			}
			val[i] = (int) ((long) val[i] * fact[n - i] % MOD);
		}

		//System.err.println(Arrays.toString(val));

		for (int i = n; i >= 0; i--)
			for (int j = i + 1; j <= n; j++) {

				int coef = (int) ((long) fact[j] * invFact[i] % MOD
						* invFact[j - i] % MOD);

				val[i] -= (int) ((long) val[j] * coef % MOD);
				if (val[i] < 0)
					val[i] += MOD;
			}

		out.println(val[k]);
	}

	int pow(int a, int b) {
		int res = 1;
		while (b != 0) {
			if ((b & 1) == 1)
				res = (int)((long)res * a % MOD);
			a = (int)((long)a * a % MOD);
			b >>= 1;
		}
		return res;
	}

	E() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

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

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

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

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

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

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


import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created by Hossein.A on 7/17/2017.
 */
public class codeforces1 {
    public static void main(String[] args) {
        ArrayList list = new ArrayList<>();
        Scanner input = new Scanner(System.in);
        int num = input.nextInt();
        for (int i = 0; i < num; i++) {
            list.add(input.nextInt());
        }
        int c1 = 0 , c2 = 0, c3 = 0;
        for (int i = 0; i < list.size()-1; i++) {
            if (Integer.valueOf((Integer) list.get(i)) < Integer.valueOf((Integer) list.get(i+1))){
                c1 = 1;
                if (c2 == 1 || c3 == 1){
                    System.out.println("No");
                    return;
                }
            }
            else if (Integer.valueOf((Integer) list.get(i)) > Integer.valueOf((Integer) list.get(i+1))){
                c2 = 1;
            }
            else {
                c3 = 1;
                if (c2 == 1){
                    System.out.println("No");
                    return;
                }
            }
        }
        System.out.println("Yes");
    }
}


import java.io.*;
public class Solution {

	public static void main(String[] args)throws IOException {
		InputStreamReader read=new InputStreamReader(System.in);
		BufferedReader in=new BufferedReader(read);
		String str=in.readLine();
		String line[]=str.trim().split(" ");
		int w=Integer.parseInt(line[0]);
		int h=Integer.parseInt(line[1]);
		int check=w+h;
		int ans=(int)pow(2,check,998244353);
		System.out.println(ans);

	}
static long pow(long a,int b,int p)
{
	long res=1;
	a=a%p;
	while(b>0)
	{
		if((b&1)==1)
		{
			res=(res*a)%p;
		}
		b=b>>1;
		a=((a%p)*(a%p))%p;
	}
	return res;
}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;
import java.util.StringTokenizer;

public class A implements Runnable {
	static String Y = "YES", N = "NO";
	static long inf = (long) 1e18;

	public static void main(String[] args) {
		new Thread(null, new A(), "Solver", 1L << 26).start();
	}

	private FastScanner scan;
	private PrintWriter out;

	public A() {
		scan = new FastScanner(System.in);
		out = new PrintWriter(System.out);
	}

	public void run() {
		try {
			solve();
			out.close();
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println(1 / 0);
		}
	}

	static long ceilDiv(long n, long d) {
		if (n < 0 != d < 0) {
			return (n / d) - (n % d == 0 ? 0 : 1);
		}
		return (n / d) + (n % d == 0 ? 0 : 1);
	}

	void solve() throws IOException {
		int n = scan.nextInt();
		String str = scan.next();
		int sumLeft = 0;
		int sumRight = 0;
		boolean bad = false;
		for(int i=0;i<str.length();i++) {
			if(str.charAt(i) != '4' && str.charAt(i) != '7')
				bad = true;
			if(i < str.length()/2) {
				sumLeft+=str.charAt(i)-'0';
			} else {
				sumRight += str.charAt(i)-'0';
			}
		}
		bad |= sumLeft != sumRight;
		if(bad) {
			out.println("NO");
		} else {
			out.println("YES");
		}

	}
	void print(int[] arr) {
		for(int i=0;i<arr.length;i++) {
			out.print(arr[i]);
			if(i == arr.length-1) out.println();
			else out.print(" ");
		}

	}

	static class Pair implements Comparable<Pair> {
		long a, b;

		public Pair(long a, long b) {
			this.a = a;
			this.b = b;
		}

		@Override
		public int compareTo(Pair o) {
			if (a == o.a)
				return Long.compare(b, o.b);
			return Long.compare(a, o.a);
		}
	}

	static long max(long... ls) {
		long max = ls[0];
		for (long l : ls) {
			if (l > max)
				max = l;
		}
		return max;
	}

	static int max(int... ls) {
		int max = ls[0];
		for (int l : ls) {
			if (l > max)
				max = l;
		}
		return max;
	}

	static double max(double... ls) {
		double max = ls[0];
		for (double l : ls) {
			if (l > max)
				max = l;
		}
		return max;
	}

	static long min(long... ls) {
		long min = ls[0];
		for (long l : ls) {
			if (l < min)
				min = l;
		}
		return min;
	}

	static double min(double... ls) {
		double min = ls[0];
		for (double l : ls) {
			if (l < min)
				min = l;
		}
		return min;
	}

	static int min(int... ls) {
		int min = ls[0];
		for (int l : ls) {
			if (l < min)
				min = l;
		}
		return min;
	}

	static void yes(boolean a) {
		System.out.println(a ? Y : N);
	}

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

	static class FastScanner {
		BufferedReader br;
		StringTokenizer st;

		public FastScanner(InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
			st = new StringTokenizer("");
		}

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

		public String next() throws IOException {
			while (!st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		}
	}

	class BPM {
		private Dinics d;
		private int leftCount;
		private int rightCount;

		public BPM(int leftCount, int rightCount) {
			this.leftCount = leftCount;
			this.rightCount = rightCount;
			this.d = new Dinics(leftCount + rightCount + 2, 0, leftCount + rightCount + 1);
			for (int i = 1; i <= leftCount; i++) {
				d.addEdge(d.s, i, 1);
			}
			for (int i = leftCount + 1; i <= leftCount + rightCount; i++) {
				d.addEdge(i, d.t, 1);
			}
		}

		public void addMatching(int left, int right) {
			d.addEdge(1 + left, 1 + leftCount + right, 1);
		}

		public int[] getMatchings() {
			this.d.calculateFlow();
			int[] answer = new int[leftCount];
			Arrays.fill(answer, -1);
			for (edge e : this.d.e) {
				if (e.a == d.s || e.b == d.t)
					continue;
				if (e.flow != 1)
					continue;
				answer[e.a - 1] = e.b - (leftCount + 1);
			}
			return answer;
		}
	}

	class Dinics {
		public static final int INF = 1000000000;

		public Dinics(int n, int s, int t) {
			this.n = n;
			this.g = new ArrayList[n];
			this.s = s;
			this.t = t;
			this.q = new int[n];
			this.d = new int[n];
			this.ptr = new int[n];
			this.intd = new int[n];
			for (int i = 0; i < n; i++)
				g[i] = new ArrayList<Integer>();
		}

		int n, s, t;
		int[] intd;
		int[] ptr;
		int[] d;
		int[] q;
		ArrayList<edge> e = new ArrayList<edge>();
		ArrayList<Integer>[] g;

		void addEdge(int a, int b, int cap) {
			edge e1 = new edge(a, b, cap, 0);
			edge e2 = new edge(b, a, 0, 0);
			g[a].add((int) e.size());
			e.add(e1);
			g[b].add((int) e.size());
			e.add(e2);
		}

		boolean bfs() {
			int qh = 0, qt = 0;
			q[qt++] = s;
			Arrays.fill(d, -1);
			d[s] = 0;
			while (qh < qt && d[t] == -1) {
				int v = q[qh++];
				for (int i = 0; i < g[v].size(); ++i) {
					int id = g[v].get(i), to = e.get(id).b;
					if (d[to] == -1 && e.get(id).flow < e.get(id).cap) {
						q[qt++] = to;
						d[to] = d[v] + 1;
					}
				}
			}
			return d[t] != -1;
		}

		int dfs(int v, int flow) {
			if (flow == 0)
				return 0;
			if (v == t)
				return flow;
			for (; ptr[v] < (int) g[v].size(); ++ptr[v]) {
				int id = g[v].get(ptr[v]), to = e.get(id).b;
				if (d[to] != d[v] + 1)
					continue;
				int pushed = dfs(to, Math.min(flow, e.get(id).cap - e.get(id).flow));
				if (pushed != 0) {
					e.get(id).flow += pushed;
					e.get(id ^ 1).flow -= pushed;
					return pushed;
				}
			}
			return 0;
		}

		public int calculateFlow() {
			int flow = 0;
			for (;;) {
				if (!bfs())
					break;
				Arrays.fill(ptr, 0);
				int pushed;
				while ((pushed = dfs(s, INF)) != 0)
					flow += pushed;
			}
			return flow;
		}

	}
	static class edge {
		int a, b, cap, flow;

		public edge(int a, int b, int cap, int flow) {
			this.a = a;
			this.b = b;
			this.cap = cap;
			this.flow = flow;
		}
	}
}


import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class A {

	static BufferedReader in;
	static PrintWriter out;
	static StringTokenizer tok;

	static void solve() throws Exception {
		long sum = nextLong();
		long xor = nextLong();
		if (sum < xor || ((sum ^ xor) & 1) != 0 || (((sum - xor) >> 1) & xor) != 0) {
			out.print(0);
			return;
		}
		long ans = 1L << Long.bitCount(xor);
		if (sum == xor) {
			ans -= 2;
		}
		out.print(ans);
	}

	static int nextInt() throws IOException {
		return parseInt(next());
	}

	static long nextLong() throws IOException {
		return parseLong(next());
	}

	static double nextDouble() throws IOException {
		return parseDouble(next());
	}

	static String next() throws IOException {
		while (tok == null || !tok.hasMoreTokens()) {
			tok = new StringTokenizer(in.readLine());
		}
		return tok.nextToken();
	}

	public static void main(String[] args) {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
			solve();
			in.close();
			out.close();
		} catch (Throwable e) {
			e.printStackTrace();
			exit(1);
		}
	}
}


//package goodbye2016;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class F3 {
	Scanner in;
	PrintWriter out;
	String INPUT = "";

	int[][] g = new int[128][];
	int access = 0;

	int[] get(int x)
	{
		if(g[x] != null)return g[x];
		if(++access == 17){
			out.println("! " + (x+1));
			out.flush();
			throw new RuntimeException();
		}
		out.println("? " + (x+1));
		out.flush();
		int n = ni();
		int[] ret = new int[n];
		for(int i = 0;i < n;i++){
			ret[i] = ni()-1;
		}
		if(ret.length == 2){
			out.println("! " + (x+1));
			out.flush();
			throw new RuntimeException();
		}
		return g[x] = ret;
	}

	int[] fall(int cur, int pre, int lim)
	{
		int step = 0;
		while(true){
			int[] ne = get(cur);
			step++;
			if(ne.length == 1)return new int[]{-1, step};
			if(--lim <= 0)return new int[]{-2, step};
			for(int x : ne){
				if(x != pre){
					pre = cur;
					cur = x;
					break;
				}
			}
		}
	}

	void solve()
	{
		for(int T = ni();T > 0;T--){
			g = new int[128][];
			access = 0;

			try{
				int h = ni();
				int[] f = get(0);
				int pre = -1, cur = -1, d = 0;
				if(f.length == 1){
					pre = 0;
					cur = f[0];
					d = 1;
				}else{
					int[] s0 = fall(f[0], 0, 99);
					int[] s1 = fall(f[1], 0, 99);
					d = Math.min(s0[1], s1[1]);
					pre = 0;
					if(s0[1] == d && s1[1] == d){
						cur = f[2];
					}else if(s0[1] == d){
						cur = f[1];
					}else{
						cur = f[0];
					}
					d++;
//					tr(cur, f, s0, s1);
				}

				int ste = 0;
				while(true){
//					tr("cur", cur);
					if(++ste == 20)throw new RuntimeException();
					int[] ne = get(cur);
					boolean ok = false;
					if(d < (h+1)/2){
						for(int x : ne){
							if(x != pre){
								if(ok){
									pre = cur;
									cur = x;
									d++;
//									tr("endd", cur, x);
									break;
								}else{
									int[] res = fall(x, cur, d);
//									tr(res, cur, x);
									if(res[0] == -1){
										ok = true;
									}else{
										pre = cur;
										cur = x;
										d++;
//										tr("end", res, cur, x);
										break;
									}
								}
							}
						}
					}else{
						// BFS
						int[] q = new int[128];
						int p = 0;
						q[p++] = cur;
						int[] ds = new int[128];
						Arrays.fill(ds, 99999);
						ds[cur] = d;
						for(int r = 0;r < p;r++){
							int[] nex = get(q[r]);
							if(ds[q[r]] <= h-1){
								for(int e : nex){
									if(e == pre)continue;
									if(ds[e] > ds[q[r]] + 1){
										ds[e] = ds[q[r]] + 1;
										q[p++] = e;
									}
								}
							}
						}
					}
				}
			}catch(Exception e){
//				e.printStackTrace();
			}
		}
	}

	void run() throws Exception
	{
		in = oj ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);

		long s = System.currentTimeMillis();
		solve();
		out.flush();
		tr(System.currentTimeMillis()-s+"ms");
	}

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

	int ni() { return Integer.parseInt(in.next()); }
	long nl() { return Long.parseLong(in.next()); }
	double nd() { return Double.parseDouble(in.next()); }
	boolean oj = true;//System.getProperty("ONLINE_JUDGE") != null;
	void tr(Object... o) { if(!oj)System.out.println(Arrays.deepToString(o)); }
//	void tr(Object... o) { System.out.println(Arrays.deepToString(o)); }
}


import java.util.Scanner;

public class LinkAndPearls {

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

		/*int pearl = 0;
		int link = 0;
		for(int i=0;i<s.length();i++){
			if(s.charAt(i)=='o') pearl++;
			else link++;
		}*/

		long pearl = s.chars().filter(ch -> ch=='o').count();
		long link = s.chars().filter(ch -> ch=='-').count();
		System.out.println(pearl==0||link%pearl==0?"YES":"NO");
		scn.close();
	}

}


import java.util.*;
import java.io.*;
public class a {
public static void main(String[] args) throws IOException
{
    PrintWriter out = new PrintWriter(System.out);
    input.init(System.in);

    int n = input.nextInt();
    int height = n;
    int res = 0;
    for(int i = 1; i<=n; i++)
    {
        int y = (int)Math.sqrt((long)n*n - (long)i*i);
        if(y == height) res++;
        else res += (height - y);
        height = y;
    }
    if(n == 0) out.println(1);
    else out.println(4*res);

    out.close();
}
public static class input {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    /** call this method to initialize reader for InputStream */
    static void init(InputStream input) {
        reader = new BufferedReader(
                     new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }

    /** get next word */
    static String next() throws IOException {
        while ( ! tokenizer.hasMoreTokens() ) {
            //TODO add check for eof if necessary
            tokenizer = new StringTokenizer(
                   reader.readLine() );
        }
        return tokenizer.nextToken();
    }

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

    static double nextDouble() throws IOException {
        return Double.parseDouble( next() );
    }
    static long nextLong() throws IOException {
        return Long.parseLong( next() );
    }
}
}