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

    	InputReader in 		= new InputReader(System.in);
        OutputWriter out	=	new OutputWriter(System.out);
        int n = in.readInt();
        String str = in.readString();

        int[][] pad = {
                {1, 2, 3},
                {4, 5, 6},
                {7, 8, 9},
                {-1, 0, -1}
        };

        int[][] pos = {
                {3, 1},
                {0, 0},
                {0, 1},
                {0, 2},
                {1, 0},
                {1, 1},
                {1, 2},
                {2, 0},
                {2, 1},
                {2, 2},
        };

        int prev =  Integer.parseInt(str.substring(0, 1));
        int[][] moves = new int[n-1][2];
        for(int i = 1; i < n; i++) {
            int cur = Integer.parseInt(str.substring(i, i+1));
            moves[i-1][0] = pos[cur][0] - pos[prev][0];
            moves[i-1][1] = pos[cur][1] - pos[prev][1];
            prev = cur;
        }

        for(int i = 0; i < pos.length; i++) {
            int[] prevPos = pos[i];
            if(pad[prevPos[0]][prevPos[1]] == Integer.parseInt(str.substring(0, 1))) {
                continue;
            }
            int j;
            for(j = 0; j < moves.length; j++) {
                int[] curPos = new int[2];
                curPos[0] = prevPos[0] + moves[j][0];
                curPos[1] = prevPos[1] + moves[j][1];
                if(!isValid(curPos)) {
                    break;
                }
                prevPos = curPos;
            }
            if(j == moves.length) {
                out.printLine("NO");
                out.flush();
                out.close();
                return;
            }
        }
        out.printLine("YES");

        out.flush();
        out.close();
    }

    private static boolean isValid(int[] curPos) {
        if(curPos[0] == 3 && curPos[1] == 1)
            return true;
        if(curPos[0] < 0 || curPos[0] > 2 || curPos[1] < 0 || curPos[1] > 2)
            return false;
        return true;
    }

}


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

     public class Solution {
         public static void main (String args[]){
             Scanner sc = new Scanner (System.in);
             int n = sc.nextInt();
             float []arr = new Flaot[n];
             float sum = 0;

             for (int i = 0; i < n; i++){
                 arr[i] = sc.nextFloat();
                 sum += arr[i];
             }
             Arrays.sort(arr);
             int i = 0;
             while (i < n && sum < 4.5 * n){
                 sum += 5 - arr[i];
                 i++;
             }
             System.out.println(i);

         }
         }


import java.util.*;
public class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		String s=sc.next();
		char a[]=new char[26];
		int iii=0;
		for(char al='A';al<='Z';al++){
		    a[iii]=al;
		    iii++;
		}
		int len=s.length();
		boolean f=true;
		int pos1=0,pos2=0,pos3=0;
		for(int i=0;i<len-2;i++){
		    int j=0,jj=0;
		    while(s.charAt(i)!=a[j]){
		        j++;
		    }
		    pos1=j
		   while(s.charAt(i+1)!=a[jj]){
		        jj++;
		    }
		    pos2=jj;
		    pos3=pos1+pos2;
		    pos3%=26;
		    if(a[pos3]!=s.charAt(i+2)){
		        f=false;
		    }
		}
		if(f){
		    System.out.println("YES");
		}
		else{
		    System.out.println("NO");
		}
	}

}


import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;

public class Solution {

    // Complete the maximizingXor function below.
    static long maximizingXor(long l, long r) {

        return (1L<<(Integer.toBinaryString(l^r).length()))-1;
    }

    private static final Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) throws IOException {
        BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));

        long l = scanner.nextLong();
        scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

        long r = scanner.nextLong();
        scanner.skip("(\r\n|[\n\r\u2028\u2029\u0085])?");

        long result = maximizingXor(l, r);

        bufferedWriter.write(String.valueOf(result));
        bufferedWriter.newLine();

        bufferedWriter.close();

        scanner.close();
    }
}


import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;
public class CF2{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		ArrayList<String> A = new ArrayList<String>();
		//C, C#, D, D#, E, F, F#, G, G#, A, B, H
		A.add("C");
		A.add("C#");
		A.add("D");
		A.add("D#");
		A.add("E");
		A.add("F");
		A.add("F#");
		A.add("G");
		A.add("G#");
		A.add("A");
		A.add("B");
		A.add("H");
		String X = sc.next();
		String Y = sc.next();
		String Z = sc.next();
		int n = Math.abs(A.indexOf(X)-A.indexOf(Y));
		int m = Math.abs(A.indexOf(Y)-A.indexOf(Z));
		int p = Math.abs(A.indexOf(X)-A.indexOf(Z));
		int x = Math.min(n, 12-n);
		int x1 = Math.max(n, 12-n);
		int y = Math.min(m, 12-m);
		int y1 = Math.max(m, 12-m);
		int z = Math.min(p, 12-p);
		int z1 = Math.max(p, 12-p);
		if(x==4 || x==3 || x1== 7){
		    if(x1==7){
		        if(z==4 && y==3){
		            System.out.println("major");
		        }
		        else if(z==3 && y==4){
		            System.out.println("minor");
		        }
		    }
		    else if(y1==7){
		        if(x==4 && z==3){
		            System.out.println("major");
		        }
		        else if(x==3 && z==4){
		            System.out.println("minor");
		        }
		    }
		    else if(z1==7){
		        if(x==4 && y==3){
		            System.out.println("major");
		        }
		        else if(x==3 && y==4){
		            System.out.println("minor");
		        }
		    }
		}
		else{
		    System.out.println("strange");
		}
	}
}


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

public class ProblemD {
    static class ProblemSolver {
        void solve(FastReader in, PrintWriter out) {
            long n = in.nextLong();
            long k = in.nextLong();
            int l = in.nextInt();
            int m = in.nextInt();
            int set_bits_num = Long.bitCount(k);
            long a = Fibonacci.getNumber(n + 1, m);
            long b = (FastExponention.ipow(2, n, m) - Fibonacci.getNumber(n + 1, m)) % m;
            long res = (FastExponention.ipow(a, l - set_bits_num, m) * FastExponention.ipow(b, set_bits_num, m)) % m;
            out.println(res);
        }
    }

    /* ========================================================== */

    public static void main(String[] args) {
        int testMode = 0;
        //String testInput = "3 3 2 10";
        /*-------------------------------------------------------------------------------------------------------*/
        FastReader in = new FastReader(testMode == 0 ? System.in : new ByteArrayInputStream(testInput.getBytes()));
        PrintWriter out = new PrintWriter(System.out);
        new ProblemSolver().solve(in, out);
        out.close();
    }

    static class FastReader extends BufferedReader {
        private StringTokenizer st;

        public FastReader(InputStream is) {
            super(new InputStreamReader(is));
        }

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

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

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

        public int[] nextArrayInt(int size) {
            int[] ret = new int[size];
            for (int i = 0; i < size; i++) {
                ret[i] = nextInt();
            }
            return ret;
        }
    }
}

class Matrix {
    final int n;
    final int m;
    long[][] elements;

    public Matrix(int n, int m) {
        this.n = n;
        this.m = m;
        elements = new long[n][m];
    }

    public Matrix(long[][] elements) {
        n = elements.length;
        m = elements[0].length;
        this.elements = new long[n][m];
        for (int i = 0; i < n; i++) for (int k = 0; k < m; k++) this.elements[i][k] = elements[i][k];
    }

    // return C = A * B
    public Matrix multiply(Matrix B) {
        Matrix A = this;
        Matrix C = new Matrix(A.n, B.m);
        for (int i = 0; i < A.n; i++)
            for (int k = 0; k < B.m; k++)
                for (int j = 0; j < A.m; j++) C.elements[i][k] += A.elements[i][j] * B.elements[j][k];
        return C;
    }

    // return B = A % m
    public Matrix modulo(int modulo) {
        Matrix A = this;
        Matrix B = new Matrix(A.elements);
        for (int i = 0; i < A.n; i++) for (int k = 0; k < A.m; k++) B.elements[i][k] = A.elements[i][k] % modulo;
        return B;
    }

    // return identity matrix
    public static Matrix identity(int n) {
        Matrix I = new Matrix(n, n);
        for (int i = 0; i < n; i++)
            I.elements[i][i] = 1;
        return I;
    }
}

class FastExponention {
    public static long ipow(long base, long exp, int modulo) {
        long res = 1;
        while (exp > 0) {
            if ((exp & 1) == 1) res = (res * base) % modulo;
            exp >>= 1;
            base = (base * base) % modulo;
        }
        return res;
    }

    public static Matrix ipow(Matrix base, long exp, int modulo) {
        Matrix res = Matrix.identity(2);
        while (exp > 0) {
            if ((exp & 1) == 1) res = (res.multiply(base)).modulo(modulo);
            exp >>= 1;
            base = (base.multiply(base)).modulo(modulo);
        }
        return res;
    }
}

class Fibonacci {
    public static long getNumber(long n, int modulo) {
        long res = n;
        if (n > 2) {
            Matrix A = new Matrix(new long[][]{{1, 1}, {1, 0}});
            Matrix B = FastExponention.ipow(A, n - 2, modulo);
            res = (2 * B.elements[0][0] + B.elements[0][1]) % modulo;
        }
        return res % modulo;
    }
}


import com.sun.org.apache.xml.internal.security.utils.HelperNodeList;

import java.io.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class B {
    static class FastWriter {
        private final BufferedWriter bw;

        public FastWriter() {
            this.bw = new BufferedWriter(new OutputStreamWriter(System.out));
        }

        public void print(Object object) throws IOException {
            bw.append("" + object);
        }

        public void println(Object object) throws IOException {
            print(object);
            bw.append("\n");
        }

        public void close() throws IOException {
            bw.close();
        }
    }

    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;
        }

        BigInteger nextBigInteger() {
            try {
                return new BigInteger(nextLine());
            } catch (NumberFormatException e) {
                throw new InputMismatchException();
            }
        }
    }

    public static void main(String[] args) {
        FastReader fr = new FastReader();
        FastWriter fw = new FastWriter();
        int n = fr.nextInt();
        int m = fr.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < m; i++) {
            int val = fr.nextInt();
            if (map.containsKey(val)) map.put(val, map.get(val) + 1);
            else map.put(val, 1);
        }
        ArrayList<Integer> list = new ArrayList<>(map.values());
        int ans = 0;
        int hi = 100;
        int lo = 1;
        while (lo <= hi) {
            int mid = (lo + hi) / 2;
            boolean flag = helper(list, n, mid);
            if (flag) {
                lo = mid + 1;
                ans = Math.max(ans, mid);
            } else {
                hi = mid - 1;
            }
        }
//        for (int i = 100; i > 0; i--) {
//            int k = 0;
//            for (int val : list) k += val / i;
//            if (k >= n) {
//                ans = i;
//                break;
//            }
//        }
        System.out.println(ans);
    }

    private static boolean helper(ArrayList<Integer> list, int n, int mid) {
        int k = 0;
        for (int val : list) k += val / mid;
        return k >= n;
    }
}


import java.util.Scanner;

public class A {
	public static void main(String[] args){
		Scanner sc= new Scanner(System.in);
		long n= sc.nextLong();
		long smax=0;
		long result=0;
		for (long i=1; i<=n;i++){
			long a=i;
			long l=0;
			long s=0;
			while(a>0){
				a=a/10;
				l=l+1;
			}
			l=1;
			for (long k=1; k<=l;k++){
				s=s+((i/l)%10);
				l=l*10;
			}
			if (s>=smax){
				smax=s;
				result=i;
			}

		}
		System.out.print(result);

	}

}


import java.util.Scanner;

public class Main {
public static void main(String... args) {

Scanner sc = new Scanner(System.in);
String l1 = sc.nextLine();
String l2 = sc.nextLine();

String[] s = l1.split("[|]");
if (l1.length==1){
  s = new String[]{"",""};
} else if (s.length == 1){
  s = new String[]{s[0],""};
}
//System.out.println(s[0]+"|"+s[1]);
for (char ch : l2.toCharArray()){
  if (s[0].length()<s[1].length()){
    s[0]+=ch;
  } else {
    s[1]+=ch;
  }
}
if (s[1].length()==s[0].length()){
System.out.println(s[0]+"|"+s[1]);
} else {
System.out.println("Impossible");
}

}
}


package codeforces;

import java.util.Scanner;

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

		int n = input.nextInt();
		if(n%2 == 0) System.out.println("white\n1 2");
		else
			System.out.println("black");
	}
}


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

import java.io.*;

public class GFG {
	public static void main (String[] args)throws IOException  {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		String p[]=br.readLine().split(" ");
		long a=Long.parseLong(p[0]);
		long b=Long.parseLong(p[1]);
	    if(a==2&&b==2)
	    {
	        System.out.println("No");
	        System.exit(0);
	    }
		for(long i=1;i<=k;i++)
		{
		    if(a%i<=i/2&&i!=2)
		    {
		        System.out.println("No");
		        System.exit(0);
		    }

		}System.out.println("Yes");
	}
}


import java.util.*;
public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);
		long N = s.nextLong();
		long M = s.nextLong();
		long K = s.nextLong();
		if (K<N) {
			System.out.println(K + 1 + " " + 1);
			return;
		}
		K -= N;
		M--;
		System.out.println(N - K / M + " " + (K / M % 2 == 0 ? K % M + 2 : M + 1 - K % M));
	}
}


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

public class C304A {
	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(reader.readLine());
		reader.close();

		int answer = 0;
		for (int a = 1; a <= n; a++) {
			for (int b = a; b <= n; b++) {
				for (int c = b; c <= n; c++ ) {}
					if ( (a * a + b * b) == c * c ) {
						answer += 1;
						break;
					}
				}
			}
		}

		System.out.println("" + answer);
	}
}


import java.io.*;

public class A {
public static void main (String [] args) {
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    String s = sc.next();
    char [] C = s.toCharArray();
    char [] D = new char[C.length];
    for (int i = 0; i < D.length; ++i)
       D[i] = C[C.length-1-i];
    String T = new String(D);
    while(T.length() > 1 && T.charAt(0) == '0')
       T = T.substring(0);
    System.out.println(x + Integer.parseInt(T));
}}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cf97;

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

public class CF97 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int a = in.nextInt();
        int c = in.nextInt();
        ArrayList<Integer> alist = inThree(a);
        ArrayList<Integer> clist = inThree(c);
        ArrayList<Integer> blist = subThree(alist, clist);
        System.out.println(dec(blist));
    }

    public static ArrayList<Integer> inThree(int a) {
        ArrayList<Integer> s = new ArrayList<Integer>();
        int i = 0;
        while (a / 3 > 0) {
            s.add(a % 3);
            a /= 3;
        }
        s.add(a % 3);
        return s;
    }

    public static ArrayList<Integer> subThree(ArrayList<Integer> a, ArrayList<Integer> b) {
        ArrayList<Integer> answer = new ArrayList<Integer>();
        if (a.size() > b.size()) {
            for (int i = 0; i < a.size() - b.size(); i++) {
                b.add(0);
            }
        } else if (a.size() < b.size()) {
            for (int i = 0; i < b.size() - a.size(); i++) {
                a.add(0);
            }
        }
        for (int i = 0; i < a.size(); i++) {
            int ans = b.get(i) - a.get(i);
            answer.add(ans > 0 ? ans :  (ans+3)%3);
        }
        return answer;
    }

    public static int dec(ArrayList<Integer> a) {
        int calc = 0;
        for(int i = 0; i<a.size(); i++) {
            calc += a.get(i) * Math.pow((double) 3, (double)i);
        }
        return calc;
    }
}


public class E {

	private final static boolean autoflush = false;

	long [][] A = {
			{ 1, 0, 0, 0, 0, 0 },
			{ 1, 1, 0, 0, 0, 0 },
			{ 2, 1, 2, 1, 1, 0 },
			{ 2, 1, 1, 2, 0, 1 },
			{ 2, 1, 1, 1, 1, 0 },
			{ 2, 1, 1, 1, 0, 1 }
	};

	public E () {
		int N = sc.nextInt();
		int X = sc.nextInt() - 1;
		int Y = sc.nextInt() - 1;
		int VX = sc.nextInt();
		int VY = sc.nextInt();
		long T = sc.nextInt();

		long [] V = { 1, 0, X, Y, VX, VY };
		long [] W = prod(pow(A, T, N), V, N);
		exit(W[2] + 1, W[3] + 1);
	}

	long [] prod(long [][] A, long [] V, long mod) {
		long [][] W = new long [V.length][1];
		for (int i : rep(V.length))
			W[i][0] = V[i];
		long [][] X = prod(A, W, mod);
		long [] res = new long [X.length];
		for (int i : rep(X.length))
			res[i] = X[i][0];
		return res;
	}

	long [][] sum (long [][] A, long [][] B, long mod) {
		int M = A.length, K = A[0].length, N = B[0].length;
		assert(K == B.length);
		long [][] res = new long [M][N];

		for (int i = 0; i < M; ++i)
			for (int j = 0; j < N; ++j)
				res[i][j] = mod(A[i][j] + B[i][j], mod);
		return res;
	}

	long [][] prod (long [][] A, long [][] B, long mod) {
		int M = A.length, K = A[0].length, N = B[0].length;
		assert(K == B.length);
		long [][] res = new long [M][N];

		for (int i = 0; i < M; ++i)
			for (int j = 0; j < N; ++j)
				for (int k = 0; k < K; ++k)
					res[i][j] = mod(res[i][j] + A[i][k] * B[k][j], mod);
		return res;
	}

	long [][] pow (long [][] A, long e, long mod) {
		long [][] res = id(A.length);
		if (e > 0) {
			int M = 1 + Long.numberOfTrailingZeros(Long.highestOneBit(e));
			long [][][] P = new long[M][][]; P[0] = A;
			for (int i : rep(1, M))
				P[i] = prod(P[i-1], P[i-1], mod);
			for (int i : rep(M))
				if ((e & (1 << i)) != 0)
					res = prod(res, P[i], mod);
		}
		return res;
	}

	long [][] id (int N) {
		long [][] res = new long [N][N];
		for (int i : rep(N))
			res[i][i] = 1;
		return res;
	}

	///////////////////////////////////////////////////////////////////////////
	private static int [] rep(int N) { return rep(0, N); }
	private static int [] rep(int S, int T) { if (T <= S) return new int [0]; int [] res = new int [T-S]; for (int i = S; i < T; ++i) res[i-S] = i; return res; }
	private static long mod(long x, long mod) { return ((x % mod) + mod) % mod; }
	////////////////////////////////////////////////////////////////////////////////////
	private final static MyScanner sc = new MyScanner();
	private static class MyScanner {
		public String next() { newLine(); return line[index++]; }
		public int nextInt() { return Integer.parseInt(next()); }
		//////////////////////////////////////////////
		private boolean eol() { return index == line.length; }
		private String readLine() {
			try {
				return r.readLine();
			} catch (Exception e) {
				throw new Error (e);
			}
		}
		private final java.io.BufferedReader r;
		private MyScanner () { this(new java.io.BufferedReader(new java.io.InputStreamReader(System.in))); }
		private MyScanner (java.io.BufferedReader r) {
			try {
				this.r = r;
				while (!r.ready())
					Thread.sleep(1);
				start();
			} catch (Exception e) {
				throw new Error(e);
			}
		}
		private String [] line;
		private int index;
		private void newLine() {
			if (line == null || eol()) {
				line = readLine().split(" ");
				index = 0;
			}
		}
	}
	private static void print (Object o, Object... a) { printDelim(" ", o, a); }
	private static void printDelim (String delim, Object o, Object... a) { pw.println(build(delim, o, a)); }
	private static void exit (Object o, Object... a) { print(o, a); exit(); }
	private static void exit() {
		pw.close();
		System.out.flush();
		System.err.println("------------------");
		System.err.println("Time: " + ((millis() - t) / 1000.0));
		System.exit(0);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static String build (String delim, Object o, Object... a) {
		StringBuilder b = new StringBuilder();
		append(b, o, delim);
		for (Object p : a)
			append(b, p, delim);
		return b.substring(delim.length());
	}
	private static void append(StringBuilder b, Object o, String delim) {
		if (o.getClass().isArray()) {
			int L = java.lang.reflect.Array.getLength(o);
			for (int i = 0; i < L; ++i)
				append(b, java.lang.reflect.Array.get(o, i), delim);
		} else if (o instanceof Iterable<?>)
			for (Object p : (Iterable<?>)o)
				append(b, p, delim);
		else
			b.append(delim).append(o);
	}
	////////////////////////////////////////////////////////////////////////////////////
	private static void start() { t = millis(); }
	private static java.io.PrintWriter pw = new java.io.PrintWriter(System.out, autoflush);
	private static long t;
	private static long millis() { return System.currentTimeMillis(); }
	public static void main (String[] args) { new E(); exit(); }
}


import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigDecimal;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;
static final int INF=Integer.MAX_VALUE;
static final long LINF=Long.MAX_VALUE;

static void solve(){
 long[] a=ir.nextLongArray(6);
 long ans=Math.pow(a[0]+a[1]+a[2],2);
 ans-=(a[0]*a[0]+a[2]*a[2]+a[4]*a[4]);
 outprintln(ans);
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}

 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}

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

 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}

 public boolean hasNext(){skip(); return hasNextByte();}

 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }

 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

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

 public BigInteger nextBigInteger(){return new BigInteger(next());}

 public BigDecimal nextBigDecimal(){return new BigDecimal(next());}

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

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

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


import java.util.Scanner;

public class F {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] prices = new int[n];
        for(int i = 0; i < n; i++) {
        	prices[i] = sc.nextInt();
        }
        sc.close();
        int[] mins = new int[n];
        for(int i = 0; i < n; i++) {
        	mins[i] = 10000;
        }

        for(int i = 0; i < n; i++) {
        	for(int x = 0; x < n; x++) {
        		if(prices[i] < mins[x]) {
        			for(int y = n-1; y > x; y--) {
        				mins[y] = mins[y-1];
        			}
        			mins[x] = prices[i];
        			break;
        		}
        	}
        }
        System.out.print(mins[0]);
        for(int x = 1; x < n; x++) {
        	System.out.print(" " + mins[x]);
        }
	}


import java.util.Scanner;

/**
 * @author Albert Hambardzumyan
 */
public class Problem_837A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int chars = in.nextInt();
        in.nextString();
        String input = in.nextString;

        String[] split = input.split(" ");
        int result = 0, count;
        String tmp;
        for (int i = 0; i < split.length; i++) {
            tmp = split[i];
            count = 0;
            for (int j = 0; j < tmp.length; j++) {
               char a = tmp.charAt(j);
                if((int) a >= 65 && a <=90) count++;
            }
            if(result < count) result = count;
        }

        System.out.print(result);
    }
}


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

public class test {

	public static int helper(int arr[], int n, int index) {
		int max=0;
		int color=arr[index];
		for(int i=index;i<n;i++) {
			if(arr[i]==color)
				continue;
			else {
				max=Math.max(max, i-index);
			}
		}
		return max;
	}

	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		Reader.init(System.in);
		int n=Reader.nextInt();
		int arr[]=new int[n];
		int msum=0;

		for(int i=0;i<n;i++) {
			arr[i]=Reader.nextInt();
			msum+=arr[i];
		}
		if(arr[0]>msum/2) {
			System.out.println(1);
			System.out.println(1);
			System.exit(0);

		}
		int accepted=arr[0]/2;

		Vector<Integer> v=new Vector<>();

		for(int i=0;i<n;i++) {
			if(arr[i]<=accepted)
				v.add(arr[i]);
		}
		if(v.size()<1) {
			System.out.println(0);
			System.exit(0);

		}
		Collections.sort(v);

		Map<Integer,Integer> v1=new HashMap<>();
		int k=0;
		int i=0;
		int sum=arr[0];
		while(true) {
			k++;
			i++;
			int l=v.size();
			sum+=v.get(l-i);
			int temp=v.get(l-i);
			if(v1.containsKey(temp)) {
				int val=v1.get(temp);
				v1.put(temp,++val);
			}
			else
				v1.put(temp, 1);
			if(sum>msum/2)
				break;
		}
		System.out.println(++k);

		StringBuilder sb=new StringBuilder();
		sb.append(1+" ");
		for(i=0;i<n;i++) {

			if(v1.containsKey(arr[i])&&v1.get(arr[i])>0) {
				sb.append((i+1)+" ");
				int val=v1.get(arr[i]);
				val--;
				v1.put(arr[i], val);
			}
		}
		System.out.println(sb);

}
}

class Reader {
    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());
    }
}


import java.util.Scanner;
public class ProblemA
{
	public static void main (String []args)
	{
		Scanner in = new Scanner (System.in);
		long n = in.nextLong();
		int i=1;
		for(i=1;n>=1;i++)
		{
			n-=i:
		}
		System.out.println(n+i-1);

	}
}


import java.util.*;

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

        System.out.println(in.nextInt()%2);
    }
}


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

import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

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

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

            while(isSpaceChar(c))
                c = read();

            int sgn = 1;

            if (c == '-') {
                sgn = -1;
                c = read();
            }

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

            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;

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

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }

        public String readString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            }
            while (!isSpaceChar(c));

            return res.toString();
        }

        public boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public String next() {
            return readString();
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }

    static void merge(int arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2){
            if (L[i] <= R[j]){
                arr[k] = L[i];
                i++;
            }
            else{
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1){
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sort(int arr[], int l, int r) {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }

    static void merge(long arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        long L[] = new long [n1];
        long R[] = new long [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2){
            if (L[i] <= R[j]){
                arr[k] = L[i];
                i++;
            }
            else{
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1){
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sort(long arr[], int l, int r) {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }

    public void run() {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int a=in.nextInt(),b=in.nextInt();
        if(a==0 && b==0)
            out.println("NO");


import java.util.Scanner;

public class Main {
    public static void main(String...args){
        Scanner entrada =new Scanner(System.in);
        ArrayList <Integer> lista = new ArrayList<>();
        ArrayList <Integer> divisores = new ArrayList<>();
        int x= Integer.parseInt(entrada.nextLine());
        String numero=""+x;
        int d=1;
        if(x==1){
            System.out.println("1");
            return;
        }
        if(x%2==0 && x%5==0){//si es 10,100,......1000000000
            d=2;
            for(int i=2; i<x; i*=2){
                if(x%i==0){
                    String cadena=""+i;

                    for(int j=0; j<cadena.length(); j++ ){
                       String m =""+cadena.charAt(j);
                       if(numero.indexOf(cadena)!=-1 || numero.indexOf(m)!=-1){
                         d++;
                         break;
                       }
                   }
                }
            }
            for(int i=5; i<x; i+=5){
                if(x%i==0){
                    String cadena=""+i;

                    for(int j=0; j<cadena.length(); j++ ){
                       String m =""+cadena.charAt(j);
                       if(numero.indexOf(cadena)!=-1 || numero.indexOf(m)!=-1){
                          d++;
                          break;
                       }
                    }
                 }
            }
            System.out.println(d);return;
        }

        for(int i=1; i<x; i++){
            if(x%i==0){
                String cadena=""+i;

                for(int j=0; j<cadena.length(); j++ ){
                    String m =""+cadena.charAt(j);
                    if(numero.indexOf(cadena)!=-1 || numero.indexOf(m)!=-1){
                       d++;
                       break;
                    }
                }
            }

        }

        System.out.println(d);
    }
}


import java.util.Scanner;
public class ahmed
{
    public static void main(String args[])
    {
        int Scanner scn = new Scanner(System.in);
        int a[] = new int[3];
        int b[] = new int[3];
        int c[] = new int[3];
        int i;
        for(i = 0;i < 3; ++i)
        {
            a[i] = scn.nextInt();
        }
        for(i = 0;i < 3; ++i)
        {
            b[i] = scn.nextInt();
        }
        for(i = 0;i < 3; ++i)
        {
            c[i] = scn.nextInt();
        }
        int a,b,c;
        b = a[2] - b[0];
        c = (a[1] + b[0]) / 2;
        a = (a[1] + b[0] - 2 * a[2]) / 2;
        a[0] = c - b;
        b[1] = c;
        c[2] = c + b;
        for(i = 0;i < 3; ++i)
        {
            System.out.print(a[i] + " ");
        }
        System.out.println();
        for(i = 0;i < 3; ++i)
        {
            System.out.print(b[i] + " ");
        }
        System.out.println();
        for(i = 0;i < 3; ++i)
        {
            System.out.print(c[i] + " ");
        }
    }
}


import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Random;

public class CFContest {
    public static void main(String[] args) throws Exception {
        boolean local = System.getProperty("ONLINE_JUDGE") == null;
        boolean async = false;

        Charset charset = Charset.forName("ascii");

        FastIO io = local ? new FastIO(new FileInputStream("D:\\DATABASE\\TESTCASE\\Code.in"), System.out, charset) : new FastIO(System.in, System.out, charset);
        Task task = new Task(io, new Debug(local));

        if (async) {
            Thread t = new Thread(null, task, "dalt", 1 << 27);
            t.setPriority(Thread.MAX_PRIORITY);
            t.start();
            t.join();
        } else {
            task.run();
        }

        if (local) {
            io.cache.append("\n\n--memory -- \n" + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) >> 20) + "M");
        }

        io.flush();
    }

    public static class Task implements Runnable {
        final FastIO io;
        final Debug debug;
        int inf = (int) 1e9 + 2;
        BitOperator bitOperator = new BitOperator();
        Modular modular = new Modular((int) 1e9 + 7);

        public Task(FastIO io, Debug debug) {
            this.io = io;
            this.debug = debug;
        }

        @Override
        public void run() {
            solve();
        }

        int n;
        int t;
        int[] songTimes;
        int[] songTypes;
        int mask;
        int[] cnts = new int[4];
        int[][][][] perm;
        int ct1 ;
        int ct2 ;
        int ct3 ;
        public void solve() {
            n = io.readInt();
            t = io.readInt();

            songTimes = new int[n + 1];
            songTypes = new int[n + 1];
            for (int i = 1; i <= n; i++) {
                songTimes[i] = io.readInt();
                songTypes[i] = io.readInt();
                cnts[songTypes[i]]++;
            }

            ct1 = cnts[1];
            ct2 = cnts[2];
            ct3 = cnts[3];

            int[][][][] fr = new int[ct1 + 1][ct2 + 1][ct3 + 1][t + 1];
            int[][][][] fw = new int[ct1 + 1][ct2 + 1][ct3 + 1][t + 1];
            fr[0][0][0][0] = 1;
            int[] abc = new int[4];
            for (int i = 1; i <= n; i++) {
                for (abc[1] = 0; abc[1] <= ct1; abc[1]++) {
                    for (abc[2] = 0; abc[2] <= ct2; abc[2]++) {
                        for (abc[3] = 0; abc[3] <= ct3; abc[3]++) {
                            int a = abc[1];
                            int b = abc[2];
                            int c = abc[3];
                            for (int d = 0; d <= t; d++) {
                                fw[a][b][c][d] = fr[a][b][c][d];
                                if (abc[songTypes[i]] > 0 && d >= songTimes[i]) {
                                    abc[songTypes[i]]--;
                                    fw[a][b][c][d] = modular.plus(fw[a][b][c][d],
                                            fr[abc[1]][abc[2]][abc[3]][d - songTimes[i]]);
                                    abc[songTypes[i]]++;
                                }
                            }
                        }
                    }
                }
                int[][][][] tmp = fr;
                fr = fw;
                fw = tmp;
            }

            perm = new int[ct1 + 1][ct2 + 1][ct3 + 1][4];
            for (int a = 0; a <= ct1; a++) {
                for (int b = 0; b <= ct2; b++) {
                    for (int c = 0; c <= ct3; c++) {
                        for (int d = 0; d < 4; d++) {
                            perm[a][b][c][d] = -1;
                        }
                    }
                }
            }
            perm[0][0][0][0] = 1;

            int ans = 0;
            for (int a = 0; a <= ct1; a++) {
                for (int b = 0; b <= ct2; b++) {
                    for (int c = 0; c <= ct3; c++) {
                        for (int d = 0; d < 4; d++) {
                            int p = modular.mul(fr[a][b][c][t], perm(a, b, c, d));
                            ans = modular.plus(ans, p);
                        }
                    }
                }
            }

            io.cache.append(ans);
        }

        int perm(int a, int b, int c, int d) {
            if (a < 0 || b < 0 || c < 0) {
                return 0;
            }
            if (perm[a][b][c][d] == -1) {
                perm[a][b][c][d] = 0;
                int aa = a;
                int bb = b;
                int cc = c;
                if (d == 0) {
                    return perm[a][b][c][d];
                }
                int mul = 1;
                if (d == 1) {
                    mul = a;
                    aa--;
                } else if (d == 2) {
                    mul = b;
                    bb--;
                } else if (d == 3) {
                    mul = c;
                    cc--;
                }

                for (int k = 0; k < 4; k++) {
                    if (k == d) {
                        continue;
                    }
                    perm[a][b][c][d] = modular.plus(perm[a][b][c][d],
                            perm(aa, bb, cc, k));
                }
                perm[a][b][c][d] = modular.mul(perm[a][b][c][d], mul);
            }

            return perm[a][b][c][d];
        }
    }

    /**
     * 模运算
     */
    public static class Modular {
        int m;

        public Modular(int m) {
            this.m = m;
        }

        public int valueOf(int x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return x;
        }

        public int valueOf(long x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return (int) x;
        }

        public int mul(int x, int y) {
            return valueOf((long) x * y);
        }

        public int plus(int x, int y) {
            return valueOf(x + y);
        }

        @Override
        public String toString() {
            return "mod " + m;
        }
    }

    public static class BitOperator {
        public int bitAt(int x, int i) {
            return (x >> i) & 1;
        }

        public int bitAt(long x, int i) {
            return (int) ((x >> i) & 1);
        }

        public int setBit(int x, int i, boolean v) {
            if (v) {
                x |= 1 << i;
            } else {
                x &= ~(1 << i);
            }
            return x;
        }

        public long setBit(long x, int i, boolean v) {
            if (v) {
                x |= 1L << i;
            } else {
                x &= ~(1L << i);
            }
            return x;
        }

        /**
         * Determine whether x is subset of y
         */
        public boolean subset(long x, long y) {
            return intersect(x, y) == x;
        }

        /**
         * Merge two set
         */
        public long merge(long x, long y) {
            return x | y;
        }

        public long intersect(long x, long y) {
            return x & y;
        }

        public long differ(long x, long y) {
            return x - intersect(x, y);
        }
    }

    public static class FastIO {
        public final StringBuilder cache = new StringBuilder();
        private final InputStream is;
        private final OutputStream os;
        private final Charset charset;
        private StringBuilder defaultStringBuf = new StringBuilder(1 << 8);
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastIO(InputStream is, OutputStream os, Charset charset) {
            this.is = is;
            this.os = os;
            this.charset = charset;
        }

        public FastIO(InputStream is, OutputStream os) {
            this(is, os, Charset.forName("ascii"));
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

        public long readLong() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            long val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

        public double readDouble() {
            boolean sign = true;
            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+';
                next = read();
            }

            long val = 0;
            while (next >= '0' && next <= '9') {
                val = val * 10 + next - '0';
                next = read();
            }
            if (next != '.') {
                return sign ? val : -val;
            }
            next = read();
            long radix = 1;
            long point = 0;
            while (next >= '0' && next <= '9') {
                point = point * 10 + next - '0';
                radix = radix * 10;
                next = read();
            }
            double result = val + (double) point / radix;
            return sign ? result : -result;
        }

        public String readString(StringBuilder builder) {
            skipBlank();

            while (next > 32) {
                builder.append((char) next);
                next = read();
            }

            return builder.toString();
        }

        public String readString() {
            defaultStringBuf.setLength(0);
            return readString(defaultStringBuf);
        }

        public int readLine(char[] data, int offset) {
            int originalOffset = offset;
            while (next != -1 && next != '\n') {
                data[offset++] = (char) next;
                next = read();
            }
            return offset - originalOffset;
        }

        public int readString(char[] data, int offset) {
            skipBlank();

            int originalOffset = offset;
            while (next > 32) {
                data[offset++] = (char) next;
                next = read();
            }

            return offset - originalOffset;
        }

        public int readString(byte[] data, int offset) {
            skipBlank();

            int originalOffset = offset;
            while (next > 32) {
                data[offset++] = (byte) next;
                next = read();
            }

            return offset - originalOffset;
        }

        public char readChar() {
            skipBlank();
            char c = (char) next;
            next = read();
            return c;
        }

        public void flush() {
            try {
                os.write(cache.toString().getBytes(charset));
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        public boolean hasMore() {
            skipBlank();
            return next != -1;
        }
    }

    public static class Debug {
        private boolean allowDebug;

        public Debug(boolean allowDebug) {
            this.allowDebug = allowDebug;
        }

        public void assertTrue(boolean flag) {
            if (!allowDebug) {
                return;
            }
            if (!flag) {
                fail();
            }
        }

        public void fail() {
            throw new RuntimeException();
        }

        public void assertFalse(boolean flag) {
            if (!allowDebug) {
                return;
            }
            if (flag) {
                fail();
            }
        }

        private void outputName(String name) {
            System.out.print(name + " = ");
        }

        public void debug(String name, int x) {
            if (!allowDebug) {
                return;
            }

            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, long x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, double x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, int[] x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.toString(x));
        }

        public void debug(String name, long[] x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.toString(x));
        }

        public void debug(String name, double[] x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.toString(x));
        }

        public void debug(String name, Object x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println("" + x);
        }

        public void debug(String name, Object... x) {
            if (!allowDebug) {
                return;
            }
            outputName(name);
            System.out.println(Arrays.deepToString(x));
        }
    }
}


public class PolygoneTriangulation {

    public static void main(String[] args) {
        BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
        List<String> lines = input.lines().collect(toList());
        Integer number = Integer.valueOf(lines.get(0));
        System.out.println(compute(number));
    }

    protected static int compute(Integer number) {
        int score = 0;
        for (int i = 3; i <= number; i++) {
            score += i * (i - 1);
        }
        return score;
    }
}


import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int[] a = new int[n];
        for(int i=0;i<n;i++){
            a[i] = s.nextInt();
        }
        boolean flag = false;
        for(int i=1;i<n;i++){
            if(a[i-1]-a[i]>=2){
                System.out.println("NO");
                flag = true;
                break
            }
            if(!flag){
                System.out.println("YES");
            }
        }
    }
}


package secondPackage;
/**
 * This is a program that returns the half
 * of the number that is declared in variable x.
 *
 *
 * @author	Hirai. Erika Mae C.
 * @version 1.00 2016/9/7
 */
public class CollectiveMindsetsMethod{//class declaration
	public static void main (String[] args) {//main method declaration
		long x = 17000000;//variable declaration and initialization
		System.out.println(collective(x));//prints the result
	}
	/**
	 *prints the result of the half of the number declared in x.
	 *
	 *
	 *@param x first long value
	 *@param n second long value
	 *
	 *@return returns long value of the initialized value of parameter x.
	 */
	 public static long collective(long n){//method
   		long result = 0;//variable declaration and initialization

   		while(n>0){//iterative: while condition
   			if(n==1){//selection statements
   			 	result=n;//prints the result of the condition
   			}else if(n%2==0){
   			 	result=n/2;
   			}else if(n%2==1){
   				result=n/2+1;
   			}else if (n<0){
   				result=0;
   			}else if (n==0)
   				result=0;
   					break;//break
		}
		return result;//returns the result of x
	}//end of method
}//end of class declaration


public class PlayingWithDice{

     public static void main(String[] args){

     BufferedReader bufferRead = new BufferedReader(new  InputStreamReader(System.in));
	    StringTokenizer st = new StringTokenizer(bufferRead.readLine(), " ");
 int a = Integer.parseInt(st.nextToken());
 int b = Integer.parseInt(st.nextToken());
 int cnta = 0;
 int cntd = 0;
  int cntb = 0;
 for (int i=1; i<=6; i++){
      if (Math.abs(a-i) > Math.abs(b-i)){
      cntb++;
}
     if (Math.abs(a-i) == Math.abs(b-i))
     cntd++;

     if (Math.abs(a-i) < Math.abs(b-i))
     cnta++;

}

   System.out.print(cnta,cntd,cntb);

}
}


import java.util.*;
import java.io.*;
//import java.math.*;
//https://www.hackerrank.com/goc-cdc-series-1
 public class Task{
//  ..............code begins here..............

static long mod=(long)1e9+7,mod1=998244353l,inf=(long)1e18+5;

static void solve() throws  IOException{
    int[] z=int_arr();
    int n=z[0],k=z[1];

    if(n%2==1){
        long c=Modpow(2l,n-1,mod);
        c=Modpow((1l+c),k,mod);
        out.write(c+"\n");
    }
    else{
        long c=1;
        if(k==1){
            int rk=k-i,left=1;
            long tmp=Modpow(2l,n-1,mod);
            tmp=Modpow(tmp,left,mod);
            out.write((t+tmp)%mod+"\n");
            return;
        }
        for(int i=1;i<=k;i++){
            int rk=k-i,left=i-1;
            long tmp=Modpow(2l,n-1,mod);
            tmp=Modpow(tmp,left,mod);
            //tmp--;
            //tmp=(tmp+mod)%mod;
            //tmp=Math.max(tmp,1l);
            c+=tmp*Modpow(2l,(long)n*rk,mod)%mod;
            c%=mod;
        }
        out.write(c%mod+"\n");
    }
}

public static void main(String[] args) throws  IOException{
    assign();
    int t=int_v(read()),cn=1;
    while(t--!=0){
        //out.write("Case #"+cn+": ");
        solve();
        //cn++;
    }
    out.flush();
}

// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static void sort(int[] a){List<Integer> l=new ArrayList<>();for(int x:a){l.add(x);}Collections.sort(l);for(int i=0;i<a.length;i++){a[i]=l.get(i);}}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
//static String setpreciosion(double d,int k){BigDecimal d1 = new BigDecimal(Double.toString(d));return d1.setScale(k,RoundingMode.HALF_UP).toString();}//UP DOWN HALF_UP
static int add(int a,int b){int z=a+b;if(z>=mod)z-=mod;return z;}
static long gcd(long a,long b){if(b==0){return a;}return gcd(b,a%b);}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res%m;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
//static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
//static long[] f;
}


import java.io.*;
import java.util.*;
public class D1118_CoffeeAndCourseWork {

	public static void main(String[] args) {
		InputReader in = new InputReader();
		int n = in.nextInt();
		int m = in.nextInt();

		int[] arr = new int[n];
		for (int i=0; i<n; i++)
			arr[i] = in.nextInt();

		Arrays.sort(arr);
		arr = reverseOrder(arr);

		int[] sums = new int[n];
		sums[0] = arr[0];
		for (int i=1; i<n; i++)
			sums[i] = sums[i-1] + arr[i];

		if (m > sums[n-1])
			System.out.println(-1);
		else
			System.out.println(binarySearch(arr, sums, m));
	}

	public static int binarySearch(int[] arr, int[] sums, int m) {
		int l = 1; int r = arr.length;
		while (l != r) {
			if (l+1 == r)
				return isPossible(l, arr, sums, m) ? l : r;
			int mid = (l + r)/2;
			if (isPossible(mid, arr, sums, m))
				r = mid;
			else
				l = mid+1;
		}
		return l;
	}

	public static boolean isPossible(int day, int[] arr, int[] sums, int val) {
		int tot = sums[day-1], numUsed = day, sub = 1, prevUsed = 0;
		while (numUsed < arr.length) {
			prevUsed = numUsed;
			numUsed = Math.min(numUsed + day, arr.length);
			int pos = binarySearch(sub, arr);
			if (pos >= numUsed)
				tot += sums[numUsed-1] - sums[prevUsed-1] - (numUsed-prevUsed)*sub;
			else if (pos > prevUsed) {
				int index = prevUsed + (day - (numUsed - pos) - 1);
				tot += (sums[index] - sums[prevUsed-1]) - (day - (numUsed - pos))*sub;
			}
			++sub;
		}
		return tot >= val;
	}

	public static int binarySearch(int T, int[] arr) {
		int l = 0, r = arr.length;
		while (l != r) {
			int mid = (l + r)/2;
			if (arr[mid] <= T)
				r = mid;
			else
				l = mid+1;
		}
		return l;
	}

	public static int[] reverseOrder(int[] arr) {
		int[] newArr = new int[arr.length];
		for (int i=0; i<arr.length; i++)
			newArr[i] = arr[arr.length-1-i];
		return newArr;
	}

	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;

		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}

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

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


import java.util.*;
public class Main
{
    public static void main (String[] args)
    {
        Scanner a=new Scanner(System.in);
        char[][] b=new char[3][3];
        while(a.hasNextLine())
        {
            for(int i=0;i<3;i++)
            {
                b[i]=a.nextLine().toCharArray();
                if(isyes(lock))
                {
                    System.out.println("YES");
                }
                else{
                    System.out.println("NO");
                }
            }
        }
    }
    boolean isyes(char[][] a)
    {
        return (lock[0][0]==lock[2][2]) && (lock[0][1]==lock[2][1]) && (lock[0][2]==lock[2][0]) && (lock[1][0]==lock[1][2]);
    }
}


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

import static java.lang.Math.*;

public class solver implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }

    String readString() {
        try {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return tok.nextToken();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Thread(null, new solver(), "", 256 * (1L << 20)).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            // time();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    int cntm(int[] a, int x) {
        int l = 0;
        int r = a.length - 1;
        int ans = -1;
        while (l <= r) {
            int mid = (l + r) / 2;
            if (a[mid] > x) {
                r = mid - 1;
            } else {
                ans = mid;
                l = mid + 1;
            }
        }
        return ans + 1;
    }

    void no() {
        out.println("NO");
        out.close();
        System.exit(0);
    }

    void yes() {
        out.println("YES");
        out.close();
        System.exit(0);
    }

    void solve() {
        int n = readInt();
        int R = readInt();
        int r = readInt();

        if (R < r) no();
        if (n == 1) {if (R < r) no(); else yes();}
        double sector = Math.asin((double)r / (R - r)) * 2;
        double all = n * sector;
        if (all - 1e-10 < 2 * Math.PI)
            yes();
        else
            no();
    }
}import java.awt.Point;
import java.io.*;
import java.math.BigInteger;
import java.util.*;

import static java.lang.Math.*;

public class solver implements Runnable {

    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    void init() throws FileNotFoundException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
    }

    String readString() {
        try {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine());
                } catch (Exception e) {
                    return null;
                }
            }
            return tok.nextToken();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    int readInt() {
        return Integer.parseInt(readString());
    }

    long readLong() {
        return Long.parseLong(readString());
    }

    double readDouble() {
        return Double.parseDouble(readString());
    }

    public static void main(String[] args) {
        new Thread(null, new solver(), "", 256 * (1L << 20)).start();
    }

    long timeBegin, timeEnd;

    void time() {
        timeEnd = System.currentTimeMillis();
        System.err.println("Time = " + (timeEnd - timeBegin));
    }

    public void run() {
        try {
            timeBegin = System.currentTimeMillis();
            init();
            solve();
            out.close();
            // time();
        } catch (Exception e) {
            e.printStackTrace(System.err);
            System.exit(-1);
        }
    }

    int cntm(int[] a, int x) {
        int l = 0;
        int r = a.length - 1;
        int ans = -1;
        while (l <= r) {
            int mid = (l + r) / 2;
            if (a[mid] > x) {
                r = mid - 1;
            } else {
                ans = mid;
                l = mid + 1;
            }
        }
        return ans + 1;
    }

    void no() {
        out.println("NO");
        out.close();
        System.exit(0);
    }

    void yes() {
        out.println("YES");
        out.close();
        System.exit(0);
    }

    void solve() {
        int n = readInt();
        int R = readInt();
        int r = readInt();

        if (R < r) no();
        if (n == 1) {if (R >= r) no(); else yes();}
        double sector = Math.asin((double)r / (R - r)) * 2;
        double all = n * sector;
        if (all - 1e-10 < 2 * Math.PI)
            yes();
        else
            no();
    }
}


import java.util.*;
public class x
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int a[] = new int[3];

        for(i=0;i<3;i++)
        {
            a[i] = sc.nextInt();
        }

        Arrays.sort(a);

        int max = a[2];
        int min = a[0];
        int t = a[1];

        System.out.println((max-t)+(t-min));
    }
}


import java.util.Scanner;
public class B {
public static void main (String []args ){
Scanner in =new Scanner (System.in);
int b= in.nextInt();
boolean s=true;
for(int i=0 ;i<10 ; i++)
{
  if(Math.Pow(2,i)==b){
System.out.Println("YES");break;s=false;}
}
if(s)
System.out.Println("NO");

}
}


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

import static java.lang.Math.*;

public class Main {
    static ArrayList<Integer>[] gr, g;
    static TreeMap<Integer, Integer> way;
    static int[] types, dist;
    static boolean[] used;
    static int INF = (int) 1e9;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        int n = sc.nextInt();
        int m = sc.nextInt();
        gr = new ArrayList[n];
        g = new ArrayList[n];
        for (int i = 0; i < n; i++) {
            gr[i] = new ArrayList<>();
            g[i] = new ArrayList<>();
        }
        for (int i = 0; i < m; i++) {
            int from = sc.nextInt() - 1;
            int to = sc.nextInt() - 1;
            gr[from].add(to);
            g[to].add(from);
        }
        int k = sc.nextInt();
        int[] p = new int[k];
        for (int i = 0; i < k; i++)
            p[i] = sc.nextInt() - 1;
        way = new TreeMap<>();
        for (int i = 0; i < k - 1; i++)
            way.put(p[i], p[i + 1]);
        types = new int[n];
        //0 - none
        //1 - +
        //2 - -
        //3 - +-
        used = new boolean[n];
        dist = new int[n];
        Arrays.fill(dist, INF);
        dist[p[k - 1]] = 0;
        dfs(p[k - 1], -1);
        int cntMin = 0;
        int cntMax = 0;
        for (int i = 0; i < k - 1; i++) {
            if(types[p[i]] == 2) {
                cntMin++;
                cntMax++;
            }
            if(types[p[i]] == 3)
                cntMax++;
        }
        pw.print(cntMin + " " + cntMax);
        pw.close();
    }

    public static void dfs(int v, int p) {
        used[v] = true;
        for (int to : g[v]) {
            if (dist[to] > dist[v] + 1) {
                dist[to] = dist[v] + 1;
                if (way.containsKey(to) && way.get(to) == v)
                    types[to] = 1;
                else
                    types[to] = 2;
            } else if (dist[to] == dist[v] + 1) {
                if (way.containsKey(to) && way.get(to) == v)
                    types[to]++;
                else {
                    if (types[to] < 2)
                        types[to] += 2;
                }
            }
            if (!used[to])
                dfs(to, v);
        }
    }

    public static boolean isVowel(char a) {
        return a == 'a' || a == 'e' || a == 'u' || a == 'o' || a == 'y';
    }

    public static long binPow(long a, int n) {
        long p = a;
        long res = 1;
        while (n > 0) {
            if (n % 2 == 1)
                res *= p;
            p *= p;
            n /= 2;
        }
        return res;
    }

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

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

class chr {
    char a;
    int index;

    public chr(char a, int index) {
        this.a = a;
        this.index = index;
    }
}

class chrComp implements Comparator<chr> {
    public int compare(chr o1, chr o2) {
        return Character.compare(o1.a, o2.a);
    }
}

class FastScanner {
    static BufferedReader br;
    static StringTokenizer st = new StringTokenizer("");

    public FastScanner(InputStream inputStream) {
        br = new BufferedReader(new InputStreamReader(inputStream));
    }

    public FastScanner(String fileName) throws FileNotFoundException {
        br = new BufferedReader(new FileReader(fileName));
    }

    public boolean hasNext() {
        try {
            while (!st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return true;
        } catch (Exception e) {
            return false;
        }
    }

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

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

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

    public String next() {
        hasNext();
        return st.nextToken();
    }
}


/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

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

/**
 *
 * @author user
 */
public class NewMain3 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
       Scanner sc = new Scanner (System.in);
       int n = sc.nextInt();
       int b = sc.nextInt();
       int s[] = new int[n];
       for(int i = 0 ; i < n ; i++) {
           s[i] = sc.nextInt();
       }

       int even = 0 , odd = 0 ;
       Vector v = new Vector<>();

       for(int i = 0 ; i < n ; i++)
       {
          if(odd==even && i!=0){
          v.add(Math.abs(s[i] - s[i-1]));
          }
          if(s[i]%2==0)even++;
          else odd++;

       }

       int w []  = new int[v.size()];
       for(int i = 0 ; i < v.size() ; i++)
       {
           w[i] = (int)(v.get(i)) ;
       }

       Arrays.sort(w);
       int  counter =0 ;
       for(int i = 0 ; i < w.length ; i++)
       {
             if(w[i] =< b){b-=w[i]; counter++;}
             else{break;}
       }
        System.out.println(counter);
    }

}


public class HelloWorld{

     public static void main(String []args){
        Scanner sc = new Scanner(System.in);
		int t = sc.nextInt();
		while(t-->0){
		    int x = sc.nextInt();
		    int y = x%10;
		    int z = x;
		    int a = 0;
		    while(z > 0){
		        a++;
		        z=z/10;
		    }
		    int res;
		    for (int i = 1;i<y;i++)
		    {
		         res+=10;
		    }
		    if (a==1)
		    res+=1;
		    if(a==2)
		    res+=3;
		    if(a==3)
		    res+=6;
		    if(a==4)
		    res+=10;

		    System.out.println(res);
		}
     }
}


import Group1_ProblemSolving.agrinet.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner k = new Scanner(System.in);
		int x = k.nextInt();
		int count = 0;
		while (x != 0) {
			x = check(x);
			count++;
		}
		System.out.println(count);
	}

	private static int check(int x) {
		if (x >= 100) {
			x -= 100;
			return x;
		} else if (x >= 50) {
			x -= 50;
		} else if (x >= 20) {
			x -= 20;
		} else if (x >= 10) {
			x -= 10;
		} else if (x >= 5) {
			x -= 5;
		} else {
			x--;
		}
		return x;
	}

}


import java.util.Scanner;

public class A {

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int n = sc.nextInt();
        int remain = 0;

        if (n < a || n < b || n < c) {
            System.out.println("-1");
        } else {
            if (c > 0) {
                a = a - c;
                b = b - c;
                remain = n - a - b - c;
                if (remain < 0) {
                    System.out.println("-1");
                } else {
                    System.out.println(remain);
                }
            } else if (c == 0) {
                if (a + b >= n) {
                    System.out.println("-1");
                } else if (a + b < n) {
                    System.out.println(n - a - b);
                }
            }
        }
    }
}
close


/* package codechef; // don't place package name! */

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

public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		BigInteger bi = new BigInteger(""+n);
		BigInteger bi2 = new BigInteger(""+(n-2));

		if(n == 9) System.out.println(2);
	    else if(bi.isProbablePrime(1)) {
	        System.out.println(1);
	    }else {
	        if(n % 2 == 0) System.out.println(2);
	        else{
	            if(bi2.isProbablePrime(1)) {
	                System.out.println(2);
	            }else {
	                System.out.println(3);
	            }
	        }
	    }


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

public class TEMP_programs {

	public 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 scn = new FastReader();

		long l = scn.nextLong(), r = scn.nextLong(), x = scn.nextLong(), y = scn.nextLong(), k = scn.nextLong();

		for(long i = x; i <= y; i++) {
			if(i * k < l || i * k > r) {
				continue;
			}
			map.add(i * k);
		}

		boolean ans = false;
		for(long i = l; i <= r; i++) {
			if(map.contains(i)) {
				ans = true;
				break;
			}
		}

		if(ans) {
			System.out.println("YES");
		} else {
			System.out.println("NO");
		}

	}

}


import java.util.HashSet;
import java.util.Objects;
import java.util.Scanner;

public class Main {

    private static String[] cards;
    private static boolean flag = false;
    private static HashSet <Dyn> dyn;
    private static int n;

    private static class Dyn {
        int n;
        String s1,s2,s3;
        Dyn (int n, String s1, String s2, String s3) {
            this.n = n;
            this.s1 = s1;
            this.s2 = s2;
            this.s3 = s3;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            final Dyn other = (Dyn) obj;
            if (this.n != other.n) {
                return false;
            }
            if (!Objects.equals(this.s1, other.s1)) {
                return false;
            }
            if (!Objects.equals(this.s2, other.s2)) {
                return false;
            }
            if (!Objects.equals(this.s3, other.s3)) {
                return false;
            }
            return true;
        }

        @Override
        public int hashCode() {
            int hash = 7;
            hash = 83 * hash + this.n;
            hash = 83 * hash + Objects.hashCode(this.s1);
            hash = 83 * hash + Objects.hashCode(this.s2);
            hash = 83 * hash + Objects.hashCode(this.s3);
            return hash;
        }

    }

    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        n = sc.nextInt();
        dyn = new HashSet <Dyn>();

        cards = new String[n];
        for (int i = 0; i < n; ++i)
            cards[i] = sc.next();

        dfs(n-1, cards);

        System.out.print(flag == true ? "YES":"NO");
    }

    private static void dfs(int a, String[] cards) {

        if (a==0)
        {
            flag = true;
            return;
        }

        Dyn temp2 = new Dyn (a,cards[a], a>0 ? cards[a-1] : null, a>1 ? cards[a-2] : null);
        if (!dyn.contains(temp2))
        {
            dyn.add(temp2);

            if (cards[a].charAt(0) == cards[a-1].charAt(0) || cards[a].charAt(1) == cards[a-1].charAt(1))
            {
                String[] temp = cards.clone();
                temp[a-1] = temp[a];
                dfs(a-1, temp);
            }

            if (a > 2)
                if (cards[a].charAt(0) == cards[a-3].charAt(0) || cards[a].charAt(1) == cards[a-3].charAt(1))
                {
                    String[] temp = cards.clone();
                    temp[a-3] = temp[a];
                    dfs(a-1, temp);
                }
        }
    }
}


import java.util.*;
public class A
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        if(Integer.parseInt(s.charAt(6)%2==0))
            System.out.println("0");
        else
            System.out.println("1")

    }

}


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

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

class TaskD {
    public void solve(int testNumber, Reader in, OutputWriter out) {
        long n = in.nextLong();
        ArrayList<Integer> lengths = new ArrayList<Integer>();
        long ones = n;
        boolean[] used = new boolean[101010];
        for(int i = 2; i * i <= n; ++i){
            if (used[i])
                continue;
            long j = i;
            int len = 0;
            while(j <= n) {
                if(j < 101010)
                    used[j] = true;
                ++len;
                j *= i;
            }

            lengths.add(len);
            ones -= len;
        }

        long gandy = 0;

        if(ones % 2 != 0)
            gandy ^= gandy(1);
        long[] dp = new long[30];
        for(int i = 0; i < 30; ++i) {
            dp[i] = gandy(i);
        }
        for (Integer length : lengths) {
            gandy ^= dp[length];
        }

        out.println(gandy == 0 ? "Petya" : "Vasya");
    }

    private long gandy(int length) {
        if (length == 0) return 0;
        if (length == 1) return 1;
        if (length == 2) return 2;
        if (length == 3) return 1;
        if (length == 4) return 4;
        if (length == 5) return 3;
        if (length == 6) return 2;
        if (length == 7) return 1;
        if (length == 8) return 5;
        if (length == 9) return 6;
        if (length == 10) return 2;
        if (length == 11) return 1;
        if (length == 12) return 8;
        if (length == 13) return 7;
        if (length == 14) return 5;
        if (length == 15) return 9;
        if (length == 16) return 8;
        if (length == 17) return 7;
        if (length == 18) return 3;
        if (length == 19) return 4;
        if (length == 20) return 7;
        if (length == 21) return 4;
        if (length == 22) return 2;
        if (length == 23) return 1;
        if (length == 24) return 10;
        if (length == 25) return 9;
        if (length == 26) return 3;
        if (length == 27) return 6;
        if (length == 28) return 11;
        if (length == 29) return 12;
        throw new AssertionError();
    }
}

class Reader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

    public Reader(BufferedReader reader) {
        this.reader = reader;
    }

    public Reader(InputStream stream) {
        this(new BufferedReader(new InputStreamReader(stream)));
    }

    public String nextString() {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            tokenizer = new StringTokenizer(readLine());
        }
        return tokenizer.nextToken();
    }

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

    private String readLine() {
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}

class OutputWriter extends PrintWriter {

	public OutputWriter(OutputStream out) {
		super(out);
	}

	public OutputWriter(java.io.Writer writer){
		super(writer);
	}

	}


public class pr {
    public static void main(String [] args)
    {
    Scanner sc=new Scanner(System.in);
    double x1,x2,y1,y2,z1,z2;
    x1=sc.nextDouble();
    y1=sc.nextDouble();
    z1=sc.nextDouble();
    x2=sc.nextDouble();
    y2=sc.nextDouble();
    z2=sc.nextDouble();
    double a=x1-x2;
    double b=y1-y2;
    double c=z1-z2;
    double ans=Math.sqrt(a*a+b*b+c*c);
    if(ans>1)System.out.print("NO");
    else System.out.print("YES");

    }

}


import java.io.InputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.math.BigInteger;

public class Main{

static PrintWriter out;
static InputReader ir;

static void solve(){
 int n=ir.nextInt();
 int[][] a=new int[3][];
 int mi=0;
 for(int i=0;i<3;i++){
  a[i]=ir.nextIntArray(2);
  mi+=a[i][0];
 }
 for(int i=0;i<3;i++){
  int a=a[i][0]+Math.min(a[i][1]-a[i][0],n-mi);
  n-=a;
  mi-=a[i][0];
  out.print(a+((i==2)?"\n":" "));
 }
}

public static void main(String[] args) throws Exception{
 ir=new InputReader(System.in);
 out=new PrintWriter(System.out);
 solve();
 out.flush();
}

static class InputReader {
 private InputStream in;
 private byte[] buffer=new byte[1024];
 private int curbuf;
 private int lenbuf;

 public InputReader(InputStream in) {this.in=in; this.curbuf=this.lenbuf=0;}

 public boolean hasNextByte() {
  if(curbuf>=lenbuf){
   curbuf= 0;
   try{
    lenbuf=in.read(buffer);
   }catch(IOException e) {
    throw new InputMismatchException();
   }
   if(lenbuf<=0) return false;
  }
  return true;
 }

 private int readByte(){if(hasNextByte()) return buffer[curbuf++]; else return -1;}

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

 private void skip(){while(hasNextByte()&&isSpaceChar(buffer[curbuf])) curbuf++;}

 public boolean hasNext(){skip(); return hasNextByte();}

 public String next(){
  if(!hasNext()) throw new NoSuchElementException();
  StringBuilder sb=new StringBuilder();
  int b=readByte();
  while(!isSpaceChar(b)){
   sb.appendCodePoint(b);
   b=readByte();
  }
  return sb.toString();
 }

 public int nextInt() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  int res=0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

 public long nextLong() {
  if(!hasNext()) throw new NoSuchElementException();
  int c=readByte();
  while (isSpaceChar(c)) c=readByte();
  boolean minus=false;
  if (c=='-') {
   minus=true;
   c=readByte();
  }
  long res = 0;
  do{
   if(c<'0'||c>'9') throw new InputMismatchException();
   res=res*10+c-'0';
   c=readByte();
  }while(!isSpaceChar(c));
  return (minus)?-res:res;
 }

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

 public BigInteger nextBigInteger(){return new BigInteger(next());}

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

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

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


public class Base {
	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String s1 = br.readLine();
		Set<String> set = new HashSet<String>();
		int l = s1.length();
		for(int i = 0; i < l; i++) {
			String s2 = s1.substring(l - 1, l);
			s1 = s1.substring(0, l-1);
			s1 = s2.concat(s1);
			set.add(s1);
		}
		System.out.println(set.size());
	}
}


mport java.io.OutputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Round226Div2A {
    private static PrintStream debug = null;
    private static boolean DEBUG = true;
    static {

        try {
            if(System.getProperty("user.dir").toString().equals("/media/share/Workspace/Codeforces") && DEBUG) {
                debug = System.err;
            }
        } catch(Exception e) {
        }

        if (debug == null) {
            debug = new PrintStream(new OutputStream() {
                @Override
                public void write(int b) {
                }
            });
        }
    }

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int c = sc.nextInt();
        int[] x = new int[n];
        for (int i=0; i<n; i++) {
            x[i] = sc.nextInt();
        }

        debug.println("hello");

        int max = 0;
        for (int i=1; i<n; i++) {
            max = Math.max(max, x[i-1] - x[i]);
        }

        System.out.println(Math.max(0, max-c));
    }

}


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

public class Solution{
    public static void main(String args[]){
        Scanner s = new Scanner(System.in);
        long k = s.nextInt();
        int r = k % 5;
        int count = k / 5;
        if(r != 0)
            count +=1
        System.out.println(count);
    }
}


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

public class Subset {

    static MyScanner in = new MyScanner();
    static   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static StringTokenizer st;
    static long H,W;
    static BitSet bs;
    static long mod = 1000000007;
    static int ans =0;
    static long bound =0;
    static HashSet<Long> set = new HashSet<>(100000000);

    public static void main(String args[]) throws IOException {
        long n =in.nextLong();
        char []arr = new char[9];
       // System.out.println(arr);
        subset(arr,0);
        int cnt=0;
        for(long p:set){
            if(p<=n){
                cnt++;
            }
        }
        out.println(cnt);
        out.flush();
    }
    static void subset(char [] arr,int k){
        if(k==9){
            set.add(convertcharToStringToLong(arr,k));
        }else if(k<9){
            arr[k] = '1';
            set.add(convertcharToStringToLong(arr,k));
            subset(arr, k+1);
            arr[k] = '0';
            set.add(convertcharToStringToLong(arr,k));
            subset(arr, k+1);
        }
    }

    private static long convertcharToStringToLong(char[] arr, int k)  {
        long  t  = 0;
        for(int i=0;i<k;i++){
         //   out.println(Math.pow(10, i)*(arr[i]-'0'));
                t+= Math.pow(10, i)*(arr[i]-'0');
        }
        return  t ;
    }

    private static long convertNumber(char[] arr) {
        String temp = "";
        for(int i=0;i<arr.length;i++){
          //  if(arr[i]!=null){
                temp+=arr[i];
            }

        return 8;
    }

    private static void findSubsets(int array[]) {
        int numOfSubsets = 1 << array.length;

        for (int i = 0; i < numOfSubsets; i++) {
            int pos = array.length - 1;
            int bitmask = i;
            String n = "";
         //   System.out.print("{");
            while (bitmask > 0) {
                if ((bitmask & 1) == 1){
                 //   System.out.print(array[pos] + ",");
                    n+=array[pos];
                }
                bitmask >>= 1;
                pos--;
            }
            if(n.length()>=1){
            long k = Long.parseLong(n);
            if(k<=bound&&!set.contains(k)){
                ans++;
                set.add(k);
            }
        }
            //out.println(n+" ");
          //  System.out.print("}");
        }
    }

    private static boolean hasZero(long k) {
        while(k!=0){
            long p = k%10;
            if(p==0){
                return true;
            }
            k/=10;
        }
        return false;
    }

    static boolean isVowel(char c) {
        if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='y'){
            return true;
        }
        return false ;
    }
    static class IP implements Comparable<IP>{
        public int first,second;
        IP(int first, int second){
            this.first = first;
            this.second = second;
        }
        public int compareTo(IP ip){
            if(first==ip.first)
                return second-ip.second;
            return first-ip.first;
        }

    }

       static long gcd(long a, long b){
        return b!=0?gcd(b, a%b):a;
    }

        static boolean isEven(long a) {
            return (a&1)==0;
        }

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

     }
}


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

public class candies {
    public static boolean test(long k, long num) {
        long sum = 0;
        long current = num;
        while(current > 0) {
            long temp = Math.min(current, k);
            sum += temp;
            current -= temp;
            current -= (current/10);
        }
        return sum*2 >= n;
    }

    public static void main(String[] args) throws IOException {
        BufferedReader input  = new BufferedReader(new InputStreamReader(System.in));
		long n = Long.parseLong(input.readLine());
		long start = 1;
		long end = n;
		long sol = n;
		while(start <= end) {
		    long mid = (start + end)/2;
		    if(test(mid,n)) {
		        sol = mid;
		        end = mid-1;
		    }
		    else {
		        start = mid+1;
		    }
		}
		System.out.println(sol);
    }
}


import java.util.*;

public class Test {

    int a, b, h, w, n, N = 1234567;
    int[] A;

    Scanner sca = new Scanner(System.in);

    void start() {

        a = sca.nextInt();
        b = sca.nextInt();
        h = sca.nextInt();
        w = sca.nextInt();
        n = sca.nextInt();

        A = new int[n];
        for (int i = 0; i < n; i++) A[i] = sca.nextInt();

        solve();
    }

    void solve() {
        Arrays.sort(A);
        int x = (a - 1)/h + 1, y = (b - 1)/w + 1;

        if (x == 1 && y == 1) {
            System.out.println(0);
            return;
        }

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

        System.out.println(solv(n - 1, x, y, 1, 1));
    }

    int solv(int i, int x, int y, int cx, int cy) {
        if (cx >= x && cy >= y) return 0;
        if (i == -1) {
            return -1;
        }

        if (A[i] == 1) return solv(i - 1, x, y, cx, cy);
        if (cx >= x) {
            int z = cy;
            for (int j = i; j >= 0; j--) {
                z *= A[j];
                if (z >= y) return i - j + 1;
            }
            return -1;
        }

        if (cy >= y) {
            int z = cx;
            for (int j = i; j >= 0; j--) {
                z *= A[j];
                if (z >= x) return i - j + 1;
            }
            return -1;
        }

        int a = solv(i - 1, x, y, cx*A[i], cy);
        int b = solv(i - 1, x, y, cx, cy*A[i]);
        if (a == -1 && b == -1) return -1;
        if (a == -1) return b + 1;
        if (b == -1) return a + 1;
        return Math.min(a, b) + 1;
    }

    public static void main(String[] args) {
        new Test().start();
    }
}


public class Solution {
	public static void main( String[] args ) {
		Scanner in = new Scanner(System.in);
		String s = "";
		try {
			s = in.nextLine();
		}
		catch (Exception e){
			e.printStackTrace();
		}
		in.close();

		System.out.println(get(s));
	}

	public static int get( String s ) {
		int ret = 0;
		int count = 1;
		for( int i = 0; i < s.length(); i++ ) {
			while( i + 1 < s.length() && s.charAt(i) == s.charAt(i+1) ) {
				count++;
				i++;
			}
			if( count % 2 == 0 ) {
				ret++;
			}
			count = 1;
		}
		return ret;
	}
}