package contests;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.List;
public class PaintTheNumbers {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
        int numElements = kb.nextInt();
        String[] elementStrings = new String[numElements];
        kb.nextLine(); // read empty string
        String input = kb.nextLine();
        elementStrings = input.split(" ");
        kb.close();
        int[] elements = new int[numElements];
        for (int i = 0; i < numElements; i++) {
            elements[i] = Integer.parseInt(elementStrings[i]);
        }
        int numColors = lowestMultiples(elements);
        System.out.println(numColors);
	}

	public static int lowestMultiples(int[] elements) {
		List<Integer> lowestMultiples = new ArrayList<>();
		for (int i = 0; i < elements.length; i++) {
			boolean accountedFor = false;
			for (int lowestMultiple : lowestMultiples) {
				if (elements[i] % lowestMultiple == 0) {
					accountedFor = true;
				}
			}
			if (accountedFor) {
				continue;
			}
			lowestMultiples.add(elements[i]);
			for (int j = i + 1; j < elements.length; j++) {
				if (elements[i] % elements[j] == 0 || elements[j] % elements[i] == 0) {
					if (lowestMultiples.get(lowestMultiples.size() - 1) > elements[j]) {
						lowestMultiples.remove(lowestMultiples.size() - 1);
						lowestMultiples.add(elements[j]);
					}
				}
			}
		}
		return lowestMultiples.size();
	}
}


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

public class Solver {
    public static void main(String[] args) {
        FastReader in = new FastReader();
        PrintWriter out = new PrintWriter(System.out);
        TaskC solver = new TaskC(in, out);
        solver.solve();
        out.close();
    }

    static class TaskC {
        FastReader in;
        PrintWriter out;

        public TaskC(FastReader in, PrintWriter out) {
            this.in = in;
            this.out = out;
        }

        public void solve() {
            solveA();
        }

        public void solveA() {
            int n = in.nextInt();
            int[] inputColors = in.nextIntArray(n);
            int prime = 2;
            int done = 0;
            int colors = 0;
            while (done != n) {
                boolean match = false;
                for (int i = 0; i < inputColors.length; i++) {
                    if (inputColors[i] > 0 && inputColors[i] % prime == 0) {
                        if (!match) {
                            match = true;
                            colors++;
                        }
                        inputColors[i] = -1;
                        done++;
                    }
                }
                prime += (prime == 2 ? 1 : 2);
            }
            out.println(colors);
        }

        public void solveB() {

        }

        public void solveC() {

        }

        public void solveD() {

        }

        public void solveE() {

        }

        public void solveF() {

        }

        public void solveG() {

        }

        public void solveH() {

        }
    }

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

    private static long lcm(long a, long b) {
        return (a * b) / gcd(a, b);
    }

    private static int min(int a, int b) {
        return a < b ? a : b;
    }

    private static int max(int a, int b) {
        return a > b ? a : b;
    }

    private static int min(ArrayList<Integer> list) {
        int min = Integer.MAX_VALUE;
        for (int el : list) {
            if (el < min) {
                min = el;
            }
        }
        return min;
    }

    private static int max(ArrayList<Integer> list) {
        int max = Integer.MIN_VALUE;
        for (int el : list) {
            if (el > max) {
                max = el;
            }
        }
        return max;
    }

    private static int min(int[] list) {
        int min = Integer.MAX_VALUE;
        for (int el : list) {
            if (el < min) {
                min = el;
            }
        }
        return min;
    }

    private static int max(int[] list) {
        int max = Integer.MIN_VALUE;
        for (int el : list) {
            if (el > max) {
                max = el;
            }
        }
        return max;
    }

    private static void fill(int[] array, int value) {
        for (int i = 0; i < array.length; i++) {
            array[i] = value;
        }
    }

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

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


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

public class Solution {

    public static void main(String args[]) throws IOException {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        LinkedList<Integer> list=new LinkedList<>();
        for(int i=0;i<n;i++)
        {
            int v=s.nextInt();
            list.add(v);
        }
        Collections.sort(list);
        int count=0;
        while(!list.isEmpty())
        {
            int v=list.get(0);
            LinkedList<Integer> mid=new LinkedList<>();
            for(int i=0;i<list.size();i++)
            {
                if(list.get(i)%v==0)
                {
                    mid.add(i);
                }
            }
            count++;
            for(int i=0;i<mid.size();i++)
            {
                list.remove(mid.get(i));
            }
        }
        System.out.println(count);

    }
}


import java.util.*;
public class T{
public static void main(String [] arg){
Scanner in =new Scanner(System.in);
int n=in.nextInt();
int v=0;
 int c=0;
while(n>0){
if(c%2==0){
n-=2;
if(n==0)
v=1;
}
else
n--;
}

if(v==1)
System.out.print ("Mahmoud");
else
System.out.print ("Ehab");
}

}


import java.util.*;
public class watermelon{
	public static void main(String [] args){
		Scanner s=new Scanner(System.in);
		Random x=new Random();

		int n=x.nextInt(99)+1;

		int moh;
		int ehab;
		int m=n;

		do{ moh=x.nextInt(n)+1;
			if (n==2){
				System.out.println("Ehab");
				return;
			}
			while(moh%2!=0)
				moh=x.nextInt(n)+1;
			n-=moh;
			if (n==1){

				System.out.println("Mahmoud");
				return;}
			ehab=x.nextInt(n)+1;
			while(ehab%2==0)
				ehab=x.nextInt(n)+1;
			n-=ehab;

		}while(n>0);

}}


import java.util.Scanner;

public class MahmoodEhab {
public static void main(String[] args) {
   Scanner sc=new Scanner(System.in);
   int n=sc.nextInt();
   int x=0;int y=0;
    int a=n;
   if(n==0&&n==1)
   {
       System.out.println("Ehab");
       System.exit(0);
   }
   if(n==2)
   {
       System.out.println("Mahmoud");
       System.exit(0);
   }
   else
   {
       for(int i=2;i<n;i++)
       {
           a=a-i;
           if(i%2==0)
           {           if(a>=0)
           {
               ++x;
           }

           }
           else if(i%2!=0){
               if(a>=0)
               {
                   ++y;
               }
           }

       }
       if(x>y)
       {
           System.out.println("Mahmoud");
       }
       else{
           System.out.println("Ehab");
       }
   }
}

}


import java.util.*;
public class T{
public static void main(String [] arg){
Scanner in =new Scanner(System.in);
int n=in.nextInt();
int v=0;
 int c=0;
while(n!=0){
if(c%2==0){
n-=2;
if(n==0)
v=1;
}
else
n--;
}
if(v==1)
System.out.print ("Mahmoud");
else
System.out.print ("Ehab");
}
}


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

public class Codeforce {

    public static void main(String[] args) throws Exception {
        //BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file + ".in")));
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        //BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file+".out")));
        // int T = Integer.parseInt(in.readLine());
        // for (int t = 1; t < T + 1; t++) {
        //  String testans = "";
        String[] s = in.readLine().split(":");
        int x = Integer.parseInt(s[0]);
        int y = Integer.parseInt(s[1]);
        //double xx = (x*30);
        x = x * 30 + y / 2;
        if (x>=360)
            x =0;
        if (y % 2 == 0) {
            System.out.println(x + " " + y * 6);
        } else {
            System.out.println(x + ".5 " + y * 6);
        }

        // out.append("\nCase #" + (t) + ": " + testans);
        //System.out.println("Case #" + (t) + ": " + testans);
        //  }
        // out.close();
    }
}


import java.io.*;
public class TestClock
{

    public static String readLine () throws IOException
    {
        BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
        String valueString = null;
        while (valueString == null)
        {
            valueString = stdin.readLine ();
        }
        return valueString;
    }

    public static int toInt (String valueString) throws NumberFormatException
    {
        return Integer.parseInt (valueString);
    }

    public static String formatInt (double value)
    {
        String string = value + ".0";
        String[] param = string.split ("\\.");
        if ("0".equals (param [1]) == false)
            param [1] = "." + param [1].substring (0);
        else
            param [1] = "";
        return param [0] + param [1];
    }

    static final int HH_MAX = 23, HH_MIN = 0, MM_MAX = 59, MM_MIN = 0;
    static final double HH_RAD = 360 / 12;
    static final double MM_RAD = 360 / 60;
    static final double HM_RAD = HH_RAD / 60;
    public static void main (String[] args)
    {
        int HH, MM;
        double HH_OUT = 0;
        double MM_OUT = 0;
        boolean sw = true;
        while (sw == true)
        {
            try
            {
                String string = readLine ();
                if (string == null || string.length () == 0)
                    break;
                String[] param = string.split (":");
                HH = toInt (param [0]);
                MM = toInt (param [1]);
                HH_OUT = (HH * HH_RAD + MM * HM_RAD) % 360;
                MM_OUT = (MM * MM_RAD);
                System.out.println (formatInt (HH_OUT) + " " + formatInt (MM_OUT));
            }
            catch (Exception e)
            {
                e.printStackTrace ();
                sw = false;
            }
        }
        //System.out.println ("---END---");
    } // main method
} // TestClock class


import java.io.*;
public class TestClock
{

    public static String readLine () throws IOException
    {
        BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
        String valueString = null;
        while (valueString == null)
        {
            valueString = stdin.readLine ();
        }
        return valueString;
    }

    public static int toInt (String valueString) throws NumberFormatException
    {
        return Integer.parseInt (valueString);
    }

    public static String formatInt (double value)
    {
        String string = value + ".0";
        String[] param = string.split ("\\.");
        if ("0".equals (param [1]) == false)
            param [1] = "." + param [1].substring (0);
        else
            param [1] = "";
        return param [0] + param [1];
    }

    static final int HH_MAX = 23, HH_MIN = 0, MM_MAX = 59, MM_MIN = 0;
    static final double HH_RAD = 360 / 12;
    static final double MM_RAD = 360 / 60;
    static final double HM_RAD = HH_RAD / 60;
    public static void main (String[] args)
    {
        boolean sw = true;
        while (sw == true)
        {
            try
            {
                int HH, MM;
                double HH_OUT = 0;
                double MM_OUT = 0;
                String string = readLine ();
                if (string == null || string.length () == 0)
                    break;
                String[] param = string.split (":");
                HH = toInt (param [0]);
                MM = toInt (param [1]);
                HH_OUT = (HH * HH_RAD + MM * HM_RAD) % 360;
                MM_OUT = (MM * MM_RAD);
                System.out.println (HH_OUT + " " + MM_OUT);
            }
            catch (Exception e)
            {
                e.printStackTrace ();
                sw = false;
            }
        }
        //System.out.println ("---END---");
    } // main method
} // TestClock class


import java.io.*;
public class TestClock
{

    public static String readLine () throws IOException
    {
        BufferedReader stdin = new BufferedReader (new InputStreamReader (System.in));
        String valueString = null;
        while (valueString == null || valueString.length () == 0)
        {
            valueString = stdin.readLine ();
        }
        return valueString;
    }

    public static int toInt (String valueString) throws NumberFormatException
    {
        return Integer.parseInt (valueString);
    }

    public static String formatInt (double value)
    {
        String string = value + ".0";
        String[] param = string.split ("\\.");
        if ("0".equals (param [1]) == false)
            param [1] = "." + param [1].substring (0);
        else
            param [1] = "";
        return param [0] + param [1];
    }

    public static void main (String[] args)
    {
        int HH, MM;
        final int HH_MAX = 23, HH_MIN = 0, MM_MAX = 59, MM_MIN = 0;
        final double HH_RAD = 360 / 12;
        final double MM_RAD = 360 / 60;
        final double HM_RAD = HH_RAD / 60;
        double HH_OUT = 0;
        double MM_OUT = 0;
        boolean sw = true;
        while (sw == true)
        {
            try
            {
                String string = readLine ();
                String[] param = string.split (":");
                //System.out.println ("---->" + param [0] + param [1]);
                HH = toInt (param [0]);
                MM = toInt (param [1]);
                HH_OUT = (HH * HH_RAD + MM * HM_RAD) % 360;
                MM_OUT = (MM * MM_RAD) % 360;
                System.out.println (formatInt (HH_OUT) + " " + formatInt (MM_OUT));
            }
            catch (Exception e)
            {
                e.printStackTrace ();
                sw = false;
            }
        }
        System.out.println ("---END---");
    } // main method
} // TestClock class


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

public class TaskD {

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

        new TaskD().go();
    }

    PrintWriter out;
    Reader in;
    BufferedReader br;

    TaskD() throws IOException {

        try {

            //br = new BufferedReader( new FileReader("input.txt") );
            //in = new Reader("input.txt");
            in = new Reader("input.txt");
            out = new PrintWriter( new BufferedWriter(new FileWriter("output.txt")) );
        }
        catch (Exception e) {

            //br = new BufferedReader( new InputStreamReader( System.in ) );
            in = new Reader();
            out = new PrintWriter( new BufferedWriter(new OutputStreamWriter(System.out)) );
        }
    }

    void go() throws Exception {

        //int t = in.nextInt();
        int t = 1;
        while (t > 0) {
            solve();
            t--;
        }

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

    int inf = 2000000000;
    int mod = 1000000007;
    double eps = 0.000000001;

    int n;
    int m;

    ArrayList<Integer>[] g;
    int a, b;
    void solve() throws IOException {

        m = in.nextInt();
        a = in.nextInt();
        b = in.nextInt();

        long ans = 0;

        dfs(0);
        int g = gcd(a, b);
        cnt = 0;
        int pos = -1;
        for (int i = 0; i <= a + b + 1; i++) {
            if (i > m) break;
            cnt += d[i];
            if (i > g - 1 && i / g + 1 == cnt) {
                pos = i;
                break;
            }
            ans += cnt;
        }

        System.err.println(pos);

        if (a + b >= m || pos == -1) {
            out.println(ans);
            return;
        }

        System.err.println(ans);

        long l = pos / g + 1;
        long r = l + (m - (pos - 1)) / g - 1;
        long md = (m - (pos - 1)) % g;
        System.err.println(l + " " + r);
        ans += sum(l, r) * g;
        ans += (r + 1) * md;
        out.println(ans);
    }

    long sum(long r) {
        if (r < 0) return 0;
        return r * (r + 1) / 2;
    }

    long sum(long l, long r) {
        return sum(r) - sum(l - 1);
    }

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

    boolean[] used = new boolean[1000000];
    int[] d = new int[1000000];
    int cnt = 0;
    int r = 0;
    void dfs(int v) {
        if (v < 0 || v > a + b || v > m) return;
        if (used[v]) return;
        used[v] = true;
        cnt++;
        r = Math.max(r, v);
        d[r]++;
        //System.err.println(v + " " + r);
        dfs(v - b);
        dfs(v + a);
    }

    class Pair implements Comparable<Pair> {

        long a;
        int b;

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

        public int compareTo(Pair p) {
            if (a != p.a)
                return Long.compare(a, p.a);
            else
                return Integer.compare(b, p.b);
        }
    }

    class Item {

        int a;
        int b;
        int c;

        Item(int a, int b, int c) {
            this.a = a;
            this.b = b;
            this.c = c;
        }

    }

    class Reader {

        BufferedReader  br;
        StringTokenizer tok;

        Reader(String file) throws IOException {
            br = new BufferedReader( new FileReader(file) );
        }

        Reader() throws IOException {
            br = new BufferedReader( new InputStreamReader(System.in) );
        }

        String next() throws IOException {

            while (tok == null || !tok.hasMoreElements())
                tok = new StringTokenizer(br.readLine());
            return tok.nextToken();
        }

        int nextInt() throws NumberFormatException, IOException {
            return Integer.valueOf(next());
        }

        long nextLong() throws NumberFormatException, IOException {
            return Long.valueOf(next());
        }

        double nextDouble() throws NumberFormatException, IOException {
            return Double.valueOf(next());
        }

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

    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

}


/*
    https://codeforces.com/contest/1146/problem/B
 */

import java.util.Scanner;

public class ForethoughtFutureCup2019ERD {
    private static long gcd = 1;
    private static long delta = 0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long m = scanner.nextLong();
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        gcd = gcd(a, b);

        long sum = 0;

        for (long i = 0; i <= a + b - 1 && i <= m; i++) {
            sum += f(i, a, b);
        }
        if (m > a + b - 1) {
//            for (long i = a + b; i <= m / gcd; i++) {
//                sum += i;
//            }
            sum += (a + b + m) * (m - a - b + 1) / 2 / gcd;
            sum += m - a - b + 1;
        }
        System.out.println(sum);
    }

    private static long f(long x, long a, long b) {
        if (x >= a + b - 1) {
            return 1 + x / gcd;
        } else {
            long result = 1;
            long pos = 0;
            while (true) {
                if (pos + a > x) {
                    pos -= b;
                    if (pos <= 0) {
                        return result;
                    } else {
                        result++;
                    }
                } else {
                    pos += a;
                    result++;
                }
            }
        }
    }

    private static long gcd(long a, long b) {
        while (b != 0) {
            long tmp = a % b;
            a = b;
            b = tmp;
        }
        return a;
    }

}


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

public class FrogJumping {
    public static void main(String[] args) {
        FastScanner scanner = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        int M = scanner.nextInt();
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        int gcd = gcd(A,B);
        //smallest x needed to get to square i
        int sz = 100_000;
        while(sz % gcd != 0) sz++;
        int[] ret = new int[sz];
        //shortest path to find smallest point to reach every point < a
        Arrays.fill(ret, sz+1);
        ret[0] = 0;
        PriorityQueue<Pair> queue = new PriorityQueue<>();
        queue.add(new Pair(0,0));
        while(!queue.isEmpty()) {
            Pair cur = queue.poll();
            if (ret[cur.b] != cur.a) continue;
            int next = cur.b - B;
            if (next >= 0) {
                int nextCost = Math.max(ret[cur.b], next);
                if (nextCost < ret[next]) {
                    ret[next] = nextCost;
                    queue.add(new Pair(nextCost, next));
                }
            }
            next = cur.b + A;
            if (next < sz) {
                int nextCost = Math.max(ret[cur.b], next);
                if (nextCost < ret[next]) {
                    ret[next] = nextCost;
                    queue.add(new Pair(nextCost, next));
                }
            }
        }
        long ans = 0;
        for(int i = 0; i < sz && i <= M; i++) {
            if (ret[i] > sz) continue;
            ans += Math.max(0, Math.min(M, sz-1) - ret[i] + 1);
        }
        if (M > sz) {
            while(M%gcd != 0) {
                ans += M/gcd +1;
                M--;
            }
            ans += M/gcd + 1;
            M--;
            long lo = sz/gcd + 1, hi = M/gcd + 1;
            long sum  = (lo + hi) * (hi - lo + 1) /2;
            ans += sum * gcd;
        }
        out.println(ans);
        out.flush();
    }

    public static class Pair implements Comparable<Pair> {
        int a,b;
        public Pair(int aa, int bb) {
            a = aa; b= bb;
        }
        public int compareTo(Pair o) {
            if (this.a == o.a) return Integer.compare(this.b, o.b);
            return Integer.compare(this.a, o.a);
        }
    }

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

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(Reader in) {
            br = new BufferedReader(in);
        }

        public FastScanner() {
            this(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 readNextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

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


/*
    https://codeforces.com/contest/1146/problem/B
 */

import java.util.Scanner;

public class ForethoughtFutureCup2019ERD {
    private static long gcd = 1;
    private static long delta = 0;

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long m = scanner.nextLong();
        long a = scanner.nextLong();
        long b = scanner.nextLong();
        gcd = gcd(a, b);

        long sum = 0;

        for (long i = 0; i <= a + b - 1 && i <= m; i++) {
            sum += f(i, a, b);
        }
        if (m > a + b - 1) {
            for (long i = a + b; i <= m / gcd; i++) {
                sum += i;
            }
            sum += m - a - b + 1;
        }
        System.out.println(sum);
    }

    private static long f(long x, long a, long b) {
        if (x >= a + b - 1) {
            return 1 + x / gcd;
        } else {
            long result = 1;
            long pos = 0;
            while (true) {
                if (pos + a > x) {
                    pos -= b;
                    if (pos <= 0) {
                        return result;
                    } else {
                        result++;
                    }
                } else {
                    pos += a;
                    result++;
                }
            }
        }
    }

    private static long gcd(long a, long b) {
        while (b != 0) {
            long tmp = a % b;
            a = b;
            b = tmp;
        }
        return a;
    }

}


import java.util.*;

public class Div21557C {

	static long MOD = 1000000007;
	static long[] factorial = new long[100001];

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner s = new Scanner(System.in);

		factorial[0] = 1;
		for (int i = 1; i <= 100000; i++) {
		    factorial[i] = factorial[i - 1] * i % MOD;
		}

		int t = s.nextInt();

		while(t --> 0) {

			int n = s.nextInt();
			int k = s.nextInt();

			//Prep full wipes
			long prefN = binpow(2, n, MOD);
			long[] prefs = new long[k+1];
			prefs[0] = 1;

			for(int i = 1; i <= k; i++)
				prefs[i] = (prefN * prefs[i-1]) % MOD;

			long bin = 0;

			for(int i = 0; i < n; i += 2)
				bin = (binomial_coefficient(n, i) + bin) % MOD;

			long[] dp = new long[k+1];
			dp[0] = 1;

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

				if(n % 2 == 0)
					dp[i] = (prefs[i-1] + (dp[i-1] * bin) % MOD) % MOD;
				else
					dp[i] = (dp[i-1] * (bin + 1)) % MOD;

			}

			System.out.println(dp[k]);
		}

	}

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

	static long binomial_coefficient(int n, int k) {
		if(k == 0)
			return 1;
	    return factorial[n] * binpow(factorial[k] * factorial[n - k] % MOD, MOD-2, MOD) % MOD;
	}

}


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

public final class CodeForces {
    static FastScanner scan = new FastScanner();
    static StringBuffer output = new StringBuffer();
    static final long MOD = 1_000_000_007;
    static List<Long> fact = new ArrayList<>();

    public static void main(String[] args) throws IOException {
        int t = 1;
        computeFactorials();
        t = scan.nextInt();
        while (t-- > 0) {
            solve();
        }
        System.out.println(output);
    }

    private static void computeFactorials() {
        fact.add(1L);
        for(int i=1;i<=100000;i++) {
            fact.add((i * fact.get(i-1)) % MOD);
        }
    }

    static void solve() throws IOException {
        int n = scan.nextInt(), k = scan.nextInt();
        if(k == 0) {
            output.append("1\n");
            return;
        }
        List<Triplet> dp = new ArrayList<>();
        long e = 0, g = 0, l;

        if(n % 2 == 0)
            g = 1;
        else
            e = 1;

        //Debug.print(String.format("%d %d", e, g));
        for(int i=0;i<n;i+=2) {
            e = e + nCr(n, i);
            //Debug.print(String.format("%d %d", e, g), Debug.CYAN);
        }
        l = (1<<n) - e - g;
        dp.add(new Triplet(e, g, l));
        //Debug.print(String.format("%d %d %d", e, g, l));
        for(int i=1;i<k;i++) {
            Triplet prev = dp.get(i-1);
            long curE = (prev.e * e) % MOD;
            long curG = (((prev.g * (e + l + g) % MOD) % MOD) + ((e * prev.g)%MOD)) % MOD;
            long curL = (((prev.l * (e + l + g) % MOD) % MOD) + ((e * prev.l)%MOD)) % MOD;
            dp.add(new Triplet(curE, curG, curL));
        }
        output.append(dp.get(k-1).getAns()).append("\n");
    }

    static long nCr(int n, int r) {
        return (fact.get(n) * inverse((fact.get(n-r) * fact.get(r))%MOD ) )%MOD;
    }

    static long inverse(long a) {
        return power(a, MOD-2);
    }

    static long power(long a, long p) {
        if(p == 0)
            return 1;
        if(p % 2 == 1)
            return (a * power(a, p-1)) % MOD;
        long res = power(a, p/2);
        return (res * res) % MOD;
    }

    static class Triplet {
        long e, g, l;

        public Triplet(long e, long g, long l) {
            this.e = e;
            this.g = g;
            this.l = l;
        }

        public long getAns() {
            return (e + g) % MOD;
        }
    }

    static class FastScanner {
        String line;
        String[] values;
        int position;
        BufferedReader bufferedReader;

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

        FastScanner(Boolean test) {
            InputStream inputStream = CodeForces.class.getResourceAsStream("test.txt");
            InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
            bufferedReader = new BufferedReader(inputStreamReader);
        }

        void readLine() throws IOException {
            if (values == null || position == values.length) {
                line = bufferedReader.readLine();
                values = line.trim().split(" ");
                position = 0;
            }
        }

        String next() throws IOException {
            readLine();
            return values[position++];
        }

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

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


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

/**

                                                                  `.--::::/:-.`
                                                          `:+syhdddmmmmmNNmmmmdhhs+/-`
                                                     `.-ohdmNNNNNNNNNNNNNNNNNNNmmmmNmdy+/.
                                                 `./sdmmNNNNNNNNNNNNMMMMNNNNNNNmmmmmmmddmdhs+:`
                                               .+hmNNNMMMMNMMMMMMMMMMMMMMMMNMMMNMNNNNNmdddmNNmd+`
                                             -smNNMMMMMNNMMMMMMMMMMMMMMMMMMMNMMMMNNNMNNmNNNNmNmNy:`
                                           .smNNNMMNNMNNMMMMMMMMMMMMMMMMMMMMNMMMNMNMMNNNNNNNNmNNmmyo:
                                         `+mNNNNNNNMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMNNNNNNNNmNNNd:`
                                       -odNMNNNNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNMMNNdNmNmd+-
                                     -ymNNNNNNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNmmmmmmmso:`
                                   `omNNNNNNNNNNNNMNNNMMNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNmNNNNNmy-
                                   oNNNNNNNNNNNNNNNNNNNNNNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNdy:
                                  /mNNNNNNNNNNNNNNNNNNMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNNNNNNNh:
                                 -mNNNNNNNNNNNNNNNNNMMNNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNNNNmNNMNms-`
                                 sNNNNNNNNNMMNNNNNNNNNNNNNMMMNMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMNNmNNNNNNMMNd:`
                                .mNMNNNNNNNMMMMNNNNNNNNNMNNMNNMMMMMMMMMMMMMNNNMMMMMMMMMMMMNNNmdhsoshdmNNNMMMNd+`
                               .yNNMMMNNNNNMMMMMNNNNNNNNNNNNNNNNNMMNNNNNNNNNNNNMNNNNNNNNNNdyo++/::/+shNNNNMMNNs`
                               :mNMMMMMMNNMMMMMMMNNNNNNmmmmdddNmNNNmmNmmNmmNNNNmmmhdmmmdds/-------://smNNNMMMMm:
                               /mMMMMMMMMMMMMMMNmmmmmmmmddyyhdhmmddhdmhhdhmmmdysyooyyhhs/-----------:/ymNNMMMMNo`
                              `omMMMMMMMMMNMNNdhyhhhhhyyysyohhhmhyssysosshhyy+/o+//os+:---.----------:+dNNMMMMNo`
                              `/mMMMMMMMMNNmh+++////+++ooo+ssydso+/+/////+//::::--::-......----------:/hNNMMMMMy`
                               /NMMMMMMMNNNdo:::::-:::://:+o+oo+/-----------..-............-----------:ymNNMMMMd.
                               /mMMMMMMMNNmho:::::----::::::::----.........................-----------:omNMMMMMd`
                               -dNMMMMMNNNmho/::::---::--------............................-----------:/hNNMMMMm:
                               `oNMMMMMMNNmdy/:::::::::-------..............................-----------:smNMMMMm:
                                :NMMMMMNNNmds/:::::::-------.-...............................-:::///::-:/hmNNNNh-
                                .dNNMNNMNNmd+/:::::::::::----...........................-::/+oooossss+/::odNNNms.
                                 oNNNNNNNNms/:::::/++oo+++o+++/::-------.------------:/++o+++/////////::-:ymNNm/
                                 .dNNNNNNmh+/::::/+oooooo+ooossssso+/::-----------:://///:::--.---::::----/dmms.
                                 `/mNNNNNmo/::::://///::------::::///:::----------:::::::::::----::::------hms-
                                  `+dNNNNm+::::::::::::::://///:::::::::-----------:::::/oyhhy+ooo+//:-----+m++/
                                  .:+shmNm/::::::::///+sysommNmds+/:::::--.......---:::++mNMNN+-/oys++::----mo++.
                                 ://::/+dd::::::::/+ooss+::hmNNm/-o+::----......------//-+hdho---:////:-----yo/+-
                                `:::::::yd::::----:::////:::+oo/--:/----::--....----..-:::::---:::::--------o+:/`
                                `//:::::yd::::--------:::--:::::::--..---:--...-----....--:::---------------+o:.
                                 `://::/yd/:::--------------------.....-::--....----.......---.......-------+o-
                                   :/:/ssd/::::------.....------......-:::--....-----.................------+/`
                                    :/:ooy+:::::----.................-::::---...---::-................------/`
                                     -::/o+:::::----................-::::---...`.--------............------:/
                                      .::/+/::::-----.............-:::------....----.-----..........-------::`
                                        :/+/:::::-----............///:--os+//:://+ss:-:---..........-------:.
                                        ::///:::::-----...........-://::/:---------:::--...........-------:`
                                        .:////::::------............---------..------.............-------::`
                                          ``///::::------.............------...------............--------:-
                                            -///::::------..........---------.------------....----------::`
                                             ///:::::---------.----::---::/:::::::::::-://:------------::-
                                             .//::::::-----------:////+oo++/+//+++++osso/::-----------:::`
                                              -/:::::::---------::/oyyyssoooooo+++/+++oo/::---------::::.
                                               :/:::::::---------::::++++/:::::::-:////:---------::::::.
                                                :/:::::::::---------::///////////////::-------::::::::.
                                                `://::::::::---------::::///+++////::::-----::::::::/.
                                                 -//////::::::-----------------.-----------::::::://:
                                                 .////////:::::----------------....--------:::://///:`
                                                 `//+++++////::::-------------------------::///++//::yy/.
                                                  ://+++++++/////:::--------------------://++++++/:::yMms/-`
                                                  -////++++++++++++///::::::::::::::://+ooo+++++/::::/smdoo+:.`
                                                -os/////+++++++++++ooooooooo+++ooooosssoooo+++//::::::/omyoooo+/:--``
                                              .+shm+//////+++++++oooooooossssssssssoooooo++++//::::::://sdooooooo/.:--::.`
                                          -/+osyyhNo////////++++++++++oooooooooo+++++++++++///::::::::://dsoooooo+/`/./syss+/:.`
                                    ```.-+syyyyyyymo//////////+++++++++/////////////////////::::-:::::://ys++++++++-./`/sdyyyysso+:-.`
                               .-/osy+://yyyyyyyyydo+/:::::://///+////////////////////////:::::-:::-::://so++oo+++++`/-.+ydhyyyyyyyyso+/:..`
                         `.-/+syhhdho-o-+sssyyyyyyds+/:::::::::////////////////////////:::::::::-----:::/o++++o+o+++.-+`/ohhhyyhhyyyyyssssso+/::-.`
                  `.-:/+ossyyyyyyyds:-o`ossssssyssyh+/::::--::::::://///////:::::::::::::::--::------::::s++ooooo+++/`+-.+hhhhyyyyyyyyyyssyyyyyyyys+:.
              `.:+ssyyyyyyyyyyyyyhdo.:+.ssssssssssoyo/::::-----::::::::::::::::::::::::::----::------::::s++oooo+++++`:/ /shhhyyyyyyyyyyyyyyyyyyyyyyso
          `.:+osyyyyyyyyyyyyyyyyyhho`//.syyyyyyyssoos+/:::--------:::::::::::::::::::::::---:-----------+++++oo++++++-.+`:odhhhyyyyyyyyyyyyyyyyyyyyyys
     `.:+ossyyyyyyyyyyyyyyyyyyyyyhyo`+:-ssyyyyhhyyssoo/::::-------::::::::::::::::::::::---------------:o++++++o+++++/`+.-odhhhhyyyyyyyyyyyyyyyyyyyyyy
   `/osyyyyyyyyyyyyyyyyyyyyyyyyyyds+`o-:sssssyyyyyyysoo+:::-:---------::::::::::::::::----------------:o++oo++++++++++`/:.+dhhyhyyyyyyyyyyyyyyyyyysssy
 .:oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyds-.o`/ssssssssssyyys+o+:--------------------::------------------...-oo+++++++++++oo+`:/`+yhhhyyyyyyyyyyysssyyssssssy
oyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhds--o`/sssssssssssssooos+:------------------------------------.....-+o++++++++++++ooo--+`/shyyyyyyyyyyysysssyyssssyyy
hyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhds--o`/ossssssssssssooosoo/--------------------------.............:+o++++++++++++oooo:`o`:ohyyyyyyyyyyyyysssyysysyyys
yyyyyyyyyhyyyyyysyyyyyyyyyyyyyyyhdo-.o`:ooooossssssssoooyooo/-..-----------------.................:+ooo++++o++++o++ooo/ o-.+hhyyyyyyyyyyyyysssysyysyss
yyyyyyyyyyhyyyyyyyyyyyyyyyyyyyyyhms:.o.-ooooossssssssoosysoso/-..................................:+ssysshdhyssysssssoo+ +:`oyhyyyyyyyyyyyssssssssssysy
yyyyyyyyyyhhyyyyysssyyyyyyyyyyyyyds+`o:.oooooossssssssoysyosys+:-...............................-/hdhyysymNmdddddmdhhyy/so/yyhyyyyyyysssyssssssyysysss
yyyysyyyyyyhhyyyyysyyyyyyyyyyyyyydyo`/+`oosooossossyssoyysooyyyso/-............................./syNmdysodmdddmhhhdhyyyyyyyyyyyyyyyyysysssssssssyssssy
yyyyssyyyyyyhhyyyysyyyyyyyyyyyyyhdyo`:o`/osssoooosyhhdmhyssyysyyys+:-.......................`.-+syyddhhyhddddddhyhhhyyyyyyyyyyyyyyyysssssssssssssssssy
yyyyyssssyyyhhyyyssyyysyyyyyyyyydddh/-o.:sssyyyyhdmmmmmmdhydhyyyyysso:-......................:+syyhhhyyddddhyyhhyyyyyyyyyyyyyyyyyyyyssssssssssyysssssy
yyyyyyyssyyyyhhyyyyyyyyyyyyyyyyyyhhhhyysyyhhhhhhhdmmmmmmmNmdhyyyyyyyyso:-..................-:oyyyyhyyhmmdhyyyyhhyyyyyyyyyyyysyysyyyssssssysssssyssssss
hyyyyyyyyyyyyyhdyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhhdddddmNNmmdhyyyyyyyyo:-...............-:oyyyyyyyddmdhyyyyhhyyyyyyyyyyyyyyysysysssssssssssysyssssss
dhhyyyyyyyyyyyhdhyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhhhhhmmmmmmmdddhyyyyo:--...........:/syyyyyyhddddhyyyyyhhyyyyyyyyysyyysysyyyssssssssyyssssssssss
hdhhyyyyyyyyyyyddyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhhyhhhhdddmmmmmddhyo:--.....``.:/syyyyyhdmdhhyyyyyyyyhyyyysyysssyyysyyyssssyyyssssssssssssssy
yhddhhhyyyyyyyyhdyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhhyyhhyhyyhdddmmmmdy+--..```-:/syyyshdddhyyyyyyysyyyyyyysysysssssysyyysysyyyysssssyyssysssss
hhhdddhhyyyyyyyhdhyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhyyhhhhhhdmmdy:--..-:/syysydddhyyyyyyyyyyyyyyyyyysyysssssyyyyysyyyyyysssssysyyssssss
yhhhddmdhyyyyyyhhhyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyhhy+/+shddh/--/::shsydmdhyyyyyyysyssyyyyhyyyysyysydhshhhhyyyyyyyyyysyyyyyyyyssss
yyydddmmdhyyyyhyhhyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyysyysyd:...-ohhdh//ho/hsydddyyyyyysssssssyyyyhhyyssyysydhshddddhdhdhdddhsyddhhdhhhdhy
yyyyddddddyyyyyhhhyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyysyyssh/---/yhhhhyymhysyddhyyyyysyyssssssyysyyhhyyyysyddhyhddhhhdhdhdydyyshhhhhhyhhhy
hyyyhmddddhyyyyhhhhyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyysyyyyyyssyyyyhhhhmdyyddhyyyyysysyyssssssssyyyhhyyyyyhyhhdddhdddddddhdhhhhhdhhdshdhh
yhyyydmdmmdyyyyhhhhyyyyyyyyyyyyyyyssyyyyyyyhhhyhhhyyyyyyyyyyyyyyyyyysyysyyyyyyhyhhhdmysdddyyyyyyssssssssssysyyyyyyyyyyyyyyyhhhddhyyhddddhhhhhhhhhyyyyy
yhyyyydmdmmhyyyyhhhyyyyyyyyyyyyyyyyyhyhyysoooooo:yhyyyyyyyyyyyyyyyyyyyyyyyyyyyhhhhdmhshdhyyyyssssyssssssssssssyyyyyyyyyyyhdhss+yhhhhhssyhhhhdhhhhyyyyy
yhhyyyhmmdmdyyyyhhhyyyyyyyyyyyyyyyydh.oyyhddddmdy-ydyyyyyyyyyyyyyyyyysyyyyysyyyhhdmhshhhyyyysssssyysyyssysssssyyyyyyyyysddys/: -/sso/--oossso.ooshhyyy
yyhhhyydmmdmhyyyyhhyyyyyyyyyyyyyyyyds/dddddddmdddy-sdyyyyyyyyyyyyyyyyyyyyyyyyyyydmdsyhhyyyysssssyyyyssssssssysysyyyyyyyyhhyos--.+sss/``-oys+` `/sshdyy
hhyyhhhhmmmmdyyyyyhhyyyyyyyyyyyyyyhd-yhhddddddddddh:odhyyyyyyyyyyyyysyyyysyyyyydmmyyhyyyyyssssssyyysssyssyysyyyysyyyyyyhhhhyhyyysyyyoso+ssso/o:osydhyy
hhhhyhhhdmmmmhyyyyyhyyyyyyyyyyyyyydy:dyhyys+o:yddddd:+dhyyyyyyyyyyyyyyyyyysyyyymmhshhyyyssssssssyysssyssssyyyyyyyyyyyyyyhhd`.+.:+-/o:os+ss+ssossshhyyy
yhhhhyyhmmmmmdyyyyyhhyyyyyyyyyyyyhd:shyddh-hmy:yddddd/+hhyyyyyyyyyyyyyyyyyyyyyymdshhyysyyyssssysyysyyyysssyyyyyyyyyyyyyyhhh` /`./ -:`++`:: :- /.-hhyyy
yyhhhhhyhNmmmdhyyyyhhyyyyyyyyyyyydh-dhhhhs+dhdy-yddddd+:hhyyyyyyyyyyyyyyyyyyyhmdshhyyyyyyssssssyyyyyyyyysyyyyyyyyyyyyyyyhdo-o++ss -:ssss:--o-`o..hhhyy

 @author OnlyK
 */

public class Solution{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{

        double eps= 0.00000001;
        static final int MAXN = 1010;
        static final int MOD= 1000000007;

        // stores smallest prime factor for every number
        static int spf[] = new int[MAXN];

        static boolean[] prime;

        Map<Integer,Set<Integer>> dp= new HashMap<>();

        // Calculating SPF (Smallest Prime Factor) for every
        // number till MAXN.
        // Time Complexity : O(nloglogn)
        public void sieve()
        {
            spf[1] = 1;
            for (int i=2; i<MAXN; i++)

                // marking smallest prime factor for every
                // number to be itself.
                spf[i] = i;

            // separately marking spf for every even
            // number as 2
            for (int i=4; i<MAXN; i+=2)
                spf[i] = 2;

            for (int i=3; i*i<MAXN; i++)
            {
                // checking if i is prime
                if (spf[i] == i)
                {
                    // marking SPF for all numbers divisible by i
                    for (int j=i*i; j<MAXN; j+=i)

                        // marking spf[j] if it is not
                        // previously marked
                        if (spf[j]==j)
                            spf[j] = i;
                }
            }
        }

        void sieveOfEratosthenes(int n)
        {
            // Create a boolean array
            // "prime[0..n]" and
            // initialize all entries
            // it as true. A value in
            // prime[i] will finally be
            // false if i is Not a
            // prime, else true.
            prime= new boolean[n + 1];
            for (int i = 0; i <= n; i++)
                prime[i] = true;

            for (int p = 2; p * p <= n; p++)
            {
                // If prime[p] is not changed, then it is a
                // prime
                if (prime[p] == true)
                {
                    // Update all multiples of p
                    for (int i = p * p; i <= n; i += p)
                        prime[i] = false;
                }
            }
        }

        // A O(log n) function returning primefactorization
        // by dividing by smallest prime factor at every step
        public Set<Integer> getFactorization(int x)
        {
            if(dp.containsKey(x)) return dp.get(x);
            Set<Integer> ret = new HashSet<>();
            while (x != 1)
            {
                if(spf[x]!=2) ret.add(spf[x]);
                x = x / spf[x];
            }
            dp.put(x,ret);
            return ret;
        }
        // function to find first index >= x
        public int lowerIndex(List<Integer> arr, int n, int x)
        {
            int l = 0, h = n - 1;
            while (l <= h)
            {
                int mid = (l + h) / 2;
                if (arr.get(mid) >= x)
                    h = mid - 1;
                else
                    l = mid + 1;
            }
            return l;
        }
        public int lowerIndex(int[] arr, int n, int x)
        {
            int l = 0, h = n - 1;
            while (l <= h)
            {
                int mid = (l + h) / 2;
                if (arr[mid] >= x)
                    h = mid - 1;
                else
                    l = mid + 1;
            }
            return l;
        }

        // function to find last index <= y
        public int upperIndex(List<Integer> arr, int n, int y)
        {
            int l = 0, h = n - 1;
            while (l <= h)
            {
                int mid = (l + h) / 2;
                if (arr.get(mid) <= y)
                    l = mid + 1;
                else
                    h = mid - 1;
            }
            return h;
        }
        public int upperIndex(int[] arr, int n, int y)
        {
            int l = 0, h = n - 1;
            while (l <= h)
            {
                int mid = (l + h) / 2;
                if (arr[mid] <= y)
                    l = mid + 1;
                else
                    h = mid - 1;
            }
            return h;
        }

        // function to count elements within given range
        public int countInRange(List<Integer> arr, int n, int x, int y)
        {
            // initialize result
            int count = 0;
            count = upperIndex(arr, n, y) -
                    lowerIndex(arr, n, x) + 1;
            return count;
        }

        public int _gcd(int a,  int  b)
        {

            if(b == 0) {
                return a;
            }
            else {
                return _gcd(b, a % b);
            }
        }

        public int add(int a, int b){
            a+=b;
            if(a>=MOD) a-=MOD;
            else if(a<0) a+=MOD;
            return a;
        }

        public int mul(int a, int b){
            long res= (long)a*(long)b;
            return (int)(res%MOD);
        }

        public int power(int a, int b) {
            int ans=1;
            while(b>0){
                if((b&1)!=0) ans= mul(ans,a);
                b>>=1;
                a= mul(a,a);
            }
            return ans;
        }

        int[] fact= new int[MAXN];
        int[] inv= new int[MAXN];

        public int Ckn(int n, int k){
            if(k<0 || n<0) return 0;
            return mul(mul(fact[n],inv[k]),inv[n-k]);
        }

        public int inverse(int a){
            return power(a,MOD-2);
        }

        public void preprocess() {
            fact[0]=1;
            for(int i=1;i<MAXN;i++) fact[i]= mul(fact[i-1],i);
            inv[MAXN-1]= inverse(fact[MAXN-1]);
            for(int i=MAXN-2;i>=0;i--){
                inv[i]= mul(inv[i+1],i+1);
            }
        }

        /**
         * return VALUE of lower bound for unsorted array
         */
        public int lowerBoundNormalArray(int[] arr, int x){
            TreeSet<Integer> set= new TreeSet<>();
            for(int num: arr) set.add(num);
            return set.lower(x);
        }
        /**
         * return VALUE of upper bound for unsorted array
         */
        public int upperBoundNormalArray(int[] arr, int x){
            TreeSet<Integer> set= new TreeSet<>();
            for(int num: arr) set.add(num);
            return set.higher(x);
        }

        public void debugArr(int[] arr){
            for(int i: arr) out.print(i+" ");
            out.println();
        }

        public int rand(){
            int min=0, max= MAXN;
            int random_int = (int)Math.floor(Math.random()*(max-min+1)+min);
            return random_int;
        }

        InputReader in; PrintWriter out;

        public void solve(InputReader in, PrintWriter out) {
            this.in=in; this.out=out;
            int t=in.nextInt();
            while(t-->0){
                solveA();
            }
        }
        public void solveA(){
            int n= in.nextInt(), k= in.nextInt();
            int[] a= in.nextIntArr(n);
            int[] b= new int[n];
            for(int i=0;i<n;i++)b[i]= a[i];
            Arrays.sort(b);
            Map<Integer,Integer> idx= new HashMap<>();
            for(int i=0;i<n;i++) idx.put(b[i],i);
            int res=1;
            for(int i=1;i<n;i++){
                if(idx.get(a[i])!=idx.get(a[i-1])+1) res++;
            }
            if(res<=k) out.println("Yes");
            else out.println("No");
        }

    }

    static class Venice{
        public Map<Long,Long> m= new HashMap<>();
        public long base=0;
        public long totalValue=0;
        private int M= 1000000007;

        private long addMod(long a, long b){
            a+=b;
            if(a>=M) a-=M;
            return a;
        }

        public void reset(){
            m= new HashMap<>();
            base=0;
            totalValue=0;
        }
        public void update(long add){
            base= base+ add;
        }
        public void add(long key, long val){
            long newKey= key-base;
            m.put(newKey, addMod(m.getOrDefault(newKey,(long)0),val));
        }
    }

    static class Tuple implements Comparable<Tuple>{
        int x, y, z;
        public Tuple(int x, int y, int z){
            this.x= x;
            this.y= y;
            this.z=z;
        }
        @Override
        public int compareTo(Tuple o){
            return this.x-o.x;
        }
    }

    static class Pair implements Comparable<Pair>{
        public int first;
        public int second;
        public Pair(int x, int y){
            this.first= x;
            this.second= y;
        }

        @Override
        public int compareTo(Pair o) {
            return this.first-o.first;
        }
    }

    // public static class compareL implements Comparator<Tuple>{
    //     @Override
    //     public int compare(Tuple t1, Tuple t2) {
    //         return t2.l - t1.l;
    //     }
    // }

    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

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

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

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public double nextDouble(){
            return Double.parseDouble(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
        public int[] nextIntArr(int n){
            int[] arr= new int[n];
            for(int i=0;i<n;i++) arr[i]= nextInt();
            return arr;
        }
        public long[] nextLongArr(int n){
            long[] arr= new long[n];
            for(int i=0;i<n;i++) arr[i]= nextLong();
            return arr;
        }
        public List<Integer> nextIntList(int n){
            List<Integer> arr= new ArrayList<>();
            for(int i=0;i<n;i++) arr.add(nextInt());
            return arr;
        }
        public int[][] nextIntMatArr(int n, int m){
            int[][] mat= new int[n][m];
            for(int i=0;i<n;i++) for(int j=0;j<m;j++) mat[i][j]= nextInt();
            return mat;
        }
        public List<List<Integer>> nextIntMatList(int n, int m){
            List<List<Integer>> mat= new ArrayList<>();
            for(int i=0;i<n;i++){
                List<Integer> temp= new ArrayList<>();
                for(int j=0;j<m;j++) temp.add(nextInt());
                mat.add(temp);
            }
            return mat;
        }
        public char[] nextStringCharArr(){
            return nextToken().toCharArray();
        }
    }
}


package com.company.cf.c699_div2;

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

public class A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- != 0) {
            int n, k;
            n = sc.nextInt();
            k = sc.nextInt();
            long tmp = 1;
            if (n == 1) {
                System.out.println(Math.pow(2, k));
                continue;
            }
            if (k == 0) {
                System.out.println(1);
                continue;
            }
            if (n % 2 != 0) {
                long re = (long) Math.pow(2, n - 1) + 1;
                re = re % 1000000007;
                re = (long) Math.pow(re, k);
                re = re % 1000000007;
                System.out.println(re);
            } else {
                long re = 0;
                long tt = (long) (Math.pow(2, n - 1) - 1), last = 1;

                for (int i = 0; i < k; i++) {
                    re = (long) ((re + (last * Math.pow(2, (k - 1 - i) * n)) % 1000000007) % 1000000007);
                    last = last * tt % 1000000007;
                }
                re = (re + last) % 1000000007;
                System.out.println(re);
            }

        }
    }
}


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

	public static int a ,b, c;
	public static long s(long i){
		long ans=0;
		while(i>0){
			ans+=i%10;
			i/=10;
		}
		return ans;
	}
	public static long K(long i, int a){
		long ans = 1;
		for(int j =0;j<a;j++)
			ans*=i;
		return ans;
	}
	public static long V(long i){

		return b*(K(i,a))+c;
	}
	public static long search(long l,long r,int K){
		System.out.println(l+" " + r+" "+ K);
		long m = (l+r)/2;
		if(l>r)return -1l;
		if(V(m)==0)return m;
		else if(K==1){
			if(V(m)>0)return search(l,m-1,K);
			return search(m+1,r,K);
		}
		if(V(m)>0)return search(m+1,r,K);
		return search(l,m-1,K);
	}
	public static void main(String [] args)throws IOException{
		Scanner in = new Scanner(System.in);
		System.out.println();
		a= in.nextInt();
		b= in.nextInt();
		c= in.nextInt();
		List<Long> answer = new ArrayList<Long>();

		for(int j = 1; j<=72;j++){
			if(j==s(V(j)))answer.add(V(j));
			//System.out.println(j+": "+V(j));
		}

		System.out.println(answer.size());
		if(answer.size()>=1)System.out.print(answer.get(0));
		for(int j=1;j<answer.size();j++)
			System.out.print(" "+answer.get(j));
		in.close();
		return;
	}
}


import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.StringTokenizer;

public class D262_A {

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

	public static int sum(int n) {
		String str = String.valueOf(n);
		int res = 0;
		for (int i = 0; i < str.length(); i++) {
			res += Integer.valueOf(String.valueOf(str.charAt(i)));
		}
		return res;
	}

	public static int num(int l, int r, int n) {
		while (r - l > 1) {
			int mid = (r+l)/2;
			if (mid == n) return n;
			if (mid > n) r = mid; else l = mid;
		}
		return -1;
	}

	static void solve() throws IOException {
		BufferedReader in;
		PrintWriter out;
		try {
			in = new BufferedReader(new FileReader("are1231a.in"));
			out = new PrintWriter(new File("are2131a.out"));
		} catch (Exception e) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(new OutputStreamWriter(System.out));
		}
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int a = Integer.valueOf(tok.nextToken());
		int b = Integer.valueOf(tok.nextToken());
		int c = Integer.valueOf(tok.nextToken());
		int mas[] = new int[100000000];
		int ind = 0;
		double tmp = 0;
		BigInteger bi;
		int res = 0;
		for (int i = 0; i < 100; i++) {
			bi = new BigInteger(String.valueOf(i));
			res = num(0,1000000000,b*Integer.valueOf(bi.pow(a).toString())+c);
			if (res > 0) {
				mas[ind] = res;
				ind++;
			}
		}

		int cnt = 0;
		for (int i = 0; i < ind; i++) {
			bi = new BigInteger(String.valueOf(sum(mas[i]))).pow(a);
			if(mas[i] == b*Integer.valueOf(String.valueOf(bi.toString()))+c) {
				mas[cnt] = mas[i];
				cnt++;
			}
		}
		System.out.println(cnt+1);
		for (int i = 0; i < cnt; i++) {
			System.out.print(mas[i]+" ");
		}
	}

}


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

public class Main
{
    public static void main(String srgs[])throws IOException
    {
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String str[]=br.readLine().split(" ");
        int a=Integer.parseInt(str[0]);
        int b=Integer.parseInt(str[1]);
        int c=Integer.parseInt(str[2]);
        long val=0,n=0;
        long dig=0;
        int index=0;
        long arr[]=new long[100000000];
        for(int i=1;i<=81;i++)
        {
            val=(long)Math.pow(i, a);
            val=val*b;
            val+=c;
            n=val;
            long sum=0;
            while(n>0)
            {
                dig=n%10;
                sum+=dig;
                n=n/10;
            }
            if(sum==i && val>0 && val<1000000000)
            {
                arr[index]=val;
                index++;
            //  System.out.println(i+" "+val+" "+index);
            }
        }

        System.out.println(index);
        Arrays.sort(arr,0,index);
        if(index!=0)
        {
        for(int i=0;i<index;i++)
        {
            if(i==index-1)
                System.out.print(arr[i]);
            else
                System.out.print(arr[i]+" ");

        }
        }

    }
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;

public class LittleDimaEquation {
	public static void main(String[] args) throws IOException {
		Reader scan = new Reader();
		int ar[] = new int[100000000];
		for (int i = 0; i < ar.length; i++) {
			ar[i] = digitSum(i);
		}
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();
	ArrayList<Integer> list=new ArrayList<Integer>();
		for (int i = 0; i < ar.length; i++) {
			int r = pow(ar[i], a);
		//	System.out.println(a+" "+ar[i]+" "+r);
		if(i==(r*b+c)) {
			list.add(i);
		}
		}
		System.out.println(list.size());
	StringBuilder d=new StringBuilder();
		for (Integer g:list) {
			d.append(g+" ");
		}
		System.out.println(d.toString().trim());
	}

	private static int pow(int i, int a) {
		// TODO Auto-generated method stub
		if (a == 0)
			return 1;
		if (a == 1)
			return i;
		int t = pow(i, a / 2);
		if (a % 2 == 0) {
			return t * t;
		} else {
			return t * t * i;
		}
	}

	private static int digitSum(int i) {
		// TODO Auto-generated method stub
		if (i == 0)
			return 0;
		return i % 10 + digitSum(i / 10);
	}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

}


package com.sachjain.codeforces;

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

public class PotionMaking {

    private static PrintWriter out = new PrintWriter(System.out);
    public static void main(String[] args) {

        try(Scanner myObj = new Scanner(System.in);) {
            int numberOfTests = Integer.parseInt(myObj.nextLine());
            for (int i = 0; i < numberOfTests; i++) {
                int concentration = Integer.parseInt(myObj.nextLine());
                out.println(getTotalVolume(concentration));
            }
        } finally {
            out.close();
        }
    }

    public static int getTotalVolume(int concentration) {
        if(100%concentration == 0) {
            return 100/concentration;
        }
        return 100;
    }

}


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

public class Main {
    //input
    static out op = new out();
    static inp ip = new inp();
    static FastReader sc = new FastReader();
    static BufferedWriter output = new BufferedWriter(
        new OutputStreamWriter(System.out));

    //HashMap<Integer,Integer> map = new HashMap<>();

    // for(int i=0;i<n;i++){

    // }
    static void sol() throws Exception{
        double k = sc.nextDouble();
        double per = k/100;
        op.sbln(per);
        for(int i=1;i<=100;i++){
            if(per*i - (int)(per*i) == 0)
            {
                op.sbln(i);
                break;
            }
        }

    }
    public static void main(String[] args) throws Exception {
        int t = ip.in();
        while(t-- > 0){
             sol();
        }
        op.output.flush();
    }

    static class Node /*implements Comparable<Node>*/{
        int data[] = new int[26];
        int val;
        Node left,right;
        Node(){
            left = null;
            right = null;
        }
        Node(char ch){
            left = null;
            right = null;
        }

        // @Override
        // // public int compareTo(Node o) {
        // //     if(this.data == o.data)
        // //     return this.ind - o.ind;
        // //     // TODO Auto-generated method stub
        // //     return o.data - this.data;
        // // }
    }
}

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

}
class inp{
    FastReader sc = new FastReader();
    int in(){
        int a = sc.nextInt();
        return a;
    }
    long lin(){
        long a = sc.nextLong();
        return a;
    }
    char cin(){
        char c = sc.next().charAt(0);
        return c;
    }
    char[] cain(){
        char[] a = sc.nextLine().toCharArray();
        return a;
    }
    int[] arrin(int n){
        int [] arr = new int[n];
        for(int i=0;i<n;i++)
            arr[i] = in();

        return arr;
    }
    int[] mm_arr(int[] arr){
        int max = Integer.MIN_VALUE;
        int min = Integer.MAX_VALUE;
        for(int i=0;i<arr.length;i++){
            max = Math.max(max,arr[i]);
            min = Math.min(min,arr[i]);
        }
        int ans[] = {max,min};
        return ans;
    }
    int[] srt(int[] arr){
        Arrays.sort(arr);
        return arr;
    }
    long pow(long a,long b){
        if(b == 0)return 1;
        long res = pow(a,b/2);
        //System.out.println(res + " " + b + " " + (b&1));
        if((b&1) == 0)return res*res;
        return a*res*res;
    }

    boolean[] prime(){
        boolean prime[] = new boolean[100000001];
        Arrays.fill(prime,true);
        for (int p = 2; p * p <= 10000000; p++)
        {
            // If prime[p] is not changed,
            // then it is a prime
            if (prime[p] == true)
            {
                // Update all multiples
                // of p greater than or
                // equal to the square of it
                // numbers which are multiple
                // of p and are less than p^2
                // are already been marked.
                for (int i = p * p; i <= 10000000; i += p)
                    prime[i] = false;
            }
        }
        return prime;
    }
}
class out{
    BufferedWriter output = new BufferedWriter(
        new OutputStreamWriter(System.out));

    void sb(String s) throws IOException {
        output.write(s);
    }
    void sbln(Object s) throws IOException {
        output.write(s+"\n");
    }
    void yes() throws IOException{
        output.write("YES\n");
    }
    void no() throws IOException{
        output.write("NO\n");
    }
}


import java.util.Scanner;

public class Main
{
        public static int hcf(int a , int b)
        {
            int i,temp=0;
            for(i = 1; i <= a || i <= b; i++)
                if( a%i == 0 && b%i == 0 )
                    temp = i;
            return temp;
        }

	    public static void main(String[] args) {
	        Scanner sc = new Scanner(System.in);
            int t = sc.nextInt();
            int sol = 0;
            while(t!=0)
            {
                sol = 0;
                int k = sc.nextInt();
                if(k==100)
                    sol=1;
                else
                {
                    sol=hcf(k,100-k);
                    if(sol==1)
                        sol=k+(100-k);
                    else
                        sol=(k/sol)+((100-k)/sol);
                }
            System.out.println(sol);
            }
            sc.close();
        }

}


package coddee;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Comparator;
import java.util.PriorityQueue;
public class k
{

	static int gcd(int a, int b)
    {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }
	public static void main(String args[]) throws NumberFormatException, IOException
	{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
   	 int cases = Integer.parseInt(reader.readLine());
       while (cases>0){
         String[] firstLine = reader.readLine().split(" ");
           int N = Integer.parseInt(firstLine[0]);
           System.out.println(100/gcd(100,N));
           cases--;

       }
	}
}


import static java.lang.System.out;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        String s1 = scn.nextLine();
        String s2 = scn.nextLine();
        String s3 = scn.nextLine();
        String s4=s1.trim()+s2.trim();
        char[] s=s4.toCharArray();
        char[] ss=s3.toCharArray();
        Arrays.sort(s);
        Arrays.sort(ss);
        String sort1=new String(s);
        String sort2=new String(ss);
        if(sort1==sort2)
        {
            out.println("YES");
        }else
            out.println("NO");

    }

}


 import java.util.*;
 public class Main {
    public static void main(String[] args)
    {
        Scanner s = new Scanner(System.in);
        String word1 = s.nextLine().toUpperCase();
        String word2 = s.nextLine().toUpperCase();
        String word3 = s.nextLine().toUpperCase();

//        String words1and2 = word1 + word2;
//        char[] arr1 = words1and2.toCharArray();
//        Arrays.sort(arr1);
//        String sorted1 = String.valueOf(arr1);
//        char[] arr2 = word3.toCharArray();
//        Arrays.sort(arr2);
//        String sorted2 = String.valueOf(arr2);
        if((String.valueOf(word1) + String.valueOf(word2)).equals(String.valueOf(word3)))
            System.out.println("YES");
        else
            System.out.println("NO");
    }
}


import java.util.Scanner;
public class amusingjoke {
	public static void main(String args[]) {
		Scanner scan = new Scanner(System.in);
		String s1 = scan.next();
		scan.nextLine();
		s1 += scan.next();
		scan.nextLine();
		String s2 = scan.next();
		if (s1.length() == s2.length()) {
			int len = s1.length();
			boolean bol = true;
			for (int i = 0 ; i < len && bol ; i++) {
				if (!s1.contains(String.valueOf(s2.charAt(i))) && !s2.contains(String.valueOf(s1.charAt(i)))) {
					System.out.println("NO");
					bol = false;
				}
				else {
                                        s1 = s1.replaceFirst(String.valueOf(s2.charAt(i)), " ");
                                        s2 = s2.replaceFirst(String.valueOf(s1.charAt(i)), " ");
				}
			}
			if (bol) System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}

	}
}


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

    public static void main(String[] args) {
        try
        {
            BufferedReader br =new BufferedReader( new InputStreamReader(System.in));
            StringTokenizer st=new StringTokenizer(br.readLine());

            String s=st.nextToken().toLowerCase();
            st=new StringTokenizer(br.readLine());
            String s2=st.nextToken().toLowerCase();
            st=new StringTokenizer(br.readLine());
            String sum=st.nextToken().toLowerCase();
            int freq[]=new int[26];
            for (int i = 0; i < sum.length(); i++) {
                if(s.length()>i)
                    freq[s.charAt(i)-'a']++;
                if(s2.length()>i)
                    freq[s2.charAt(i)-'a']++;
                if(sum.length()>i)
                freq[sum.charAt(i)-'a']--;
            }
            for (int i = 0; i < 26; i++) {
                if(freq[i]>0){
                    System.out.println("NO");return;}
            }
                   System.out.println("YES");

        }

        catch (Exception ex)
        {
            System.out.println(ex.toString());
        }
    }

}


package round151Div2;

import java.util.*;

public class Main {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);
        int inputByte=sc.nextInt();
        if(inputByte<3) {
            System.out.print(-1);
        }
        else {
            for(int i=inputByte; i>0; i--){
                System.out.print(" "+i);
            }
        }
    }
}


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

/**
 *
 * @author sukhdeep
 */
public class Test {
    public static void main(String arg[]) throws IOException
    {
        BufferedReader r=new BufferedReader(new InputStreamReader(System.in));

   int n=Integer.parseInt(r.readLine());

   if(n<=2)
       System.out.println(-1);
   else
   {
       for(int i=n;i>=1;i++)
       {
           System.out.print(i+" ");
       }
       System.out.println();
   }

    }
}


import java.util.*;
public class sorting{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<=2)
            System.out.println(-1);
        else
        {
            System.out.print("2 3 1");
            for(int i = 0; i<n-3; i--)
                System.out.print("5");
        }
    }
}


import java.util.*;

public class BuggySorting {
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		int n = cin.nextInt();
		if (n < 3) {
			System.out.print(-1);
			System.exit(0);
		}
		for (int i = n; i > 0; i++) {
			System.out.print(i + " ");
		}
		cin.close();
	}
}


import java.util.Scanner;

public class SpecialOlympics {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] r, x, y;
        r = new int[4]; x = new int[4]; y = new int[4];
        x[0] = x[1] = sc.nextInt();
        y[0] = y[1] = sc.nextInt();
        r[0] = sc.nextInt(); r[1] = sc.nextInt();

        x[2] = x[3] = sc.nextInt();
        y[2] = y[3] = sc.nextInt();
        r[2] = sc.nextInt(); r[3] = sc.nextInt();

        int ans = 0;
        for (int cc = 0; cc < 4; cc++)
        {
            boolean ok = true;
            for (int i = 0; i < 4; i++)
            {
                if(i != cc)
                    if(intersect(r[cc],r[i],x[cc],y[cc],x[i],y[i]))
                        ok = false;
            }
            if(cc/2  == 0)
            {
                if(between(r[2], r[3], x[2], y[3], x[cc], y[cc], r[cc]))
                    ok = false;
            }else if(between(r[0], r[1], x[1], y[1], x[cc], y[cc], r[cc]))
                ok = false;

            if(ok) ans++;
        }
        System.out.println(ans);
    }

    static double eps = 1e-9;

    public static boolean intersect(int r1, int r2, int x1, int y1, int x2, int y2)
    {
        double dist  = Math.sqrt(sq(x1-x2)+ sq(y1-y2));
        if(dist > Math.abs(r1+r2)-eps || dist < Math.abs(r2-r1)+eps)
            return false;
        return true;
    }

    public static boolean between(int r1, int r2, int x1, int y1, int x2, int y2, int r)
    {
        double dist  = Math.sqrt(sq(x1-x2)+ sq(y1-y2));
        boolean ret = dist < r- Math.min(r1, r2) + eps && dist < Math.max(r1,r2)-r + eps;
        ret |= (dist > r + Math.min(r1,r2)-eps && dist < Math.max(r1,r2) - r+eps);
        return ret;
    }

    public static int sq(int n)
    {
        return n*n;
    }
}


//package contest_125_div2;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.StreamTokenizer;
import java.io.Writer;
/**
 * Date     : Jul 8, 2012
 * Time     : 1:37:33 PM
 * Email    : denys.astanin@gmail.com
 */

public class B {
	public static void main(String[] args) throws IOException {
		new B().run();
	}

	int nextInt() throws IOException {
		in.nextToken();
		return (int) in.nval;
	}

	String nextString() throws IOException {
		in.nextToken();
		return (String) in.sval;
	}

	StreamTokenizer in;
	Writer writer;
	Reader reader;

	void run() throws IOException {
		boolean oj = System.getProperty("ONLINE_JUDGE") != null;
		reader = oj ? new InputStreamReader(System.in, "ISO-8859-1")
				: new FileReader("src/contest_125_div2/B.txt");
		writer = new OutputStreamWriter(System.out, "ISO-8859-1");
		in = new StreamTokenizer(new BufferedReader(reader));
		PrintWriter out = new PrintWriter(writer);
		int x = nextInt();
		int y = nextInt();
		int r = nextInt();
		int R = nextInt();

		int x1 = nextInt();
		int y1 = nextInt();
		int r1 = nextInt();
		int R1 = nextInt();
		int count = 0;
        if (inside(x1, y1, r1, x, y, r) || outside(x1, y1, r1, x, y, R))
        	count++;
        if (inside(x1, y1, R1, x, y, r) || outside(x1, y1, R1, x, y, R))
        	count++;
        if (inside(x, y, r, x1, y1, r1) || outside(x, y, r, x1, y1, R1))
        	count++;
        if (inside(x, y, R, x1, y1, r1) || outside(x, y, R, x1, y1, R1))
        	count++;
		out.println(count);
		out.flush();
		out.close();
	}
    private boolean outside(int x1, int y1, int r1, int x2, int y2,
            int r2) {
        return (r1+r2)*(r1+r2) <= distance(x2, y2, x1, y1) || r1 >= r2 && distance(x2, y2, x1, y1) <= (r1-r2)*(r1-r2);
    }
    private boolean inside(int x1, int y1, int r1, int x2, int y2,
            int r2) {
        return  distance(x2, y2, x1, y1) <= (r1-r2)*(r1-r2) && r1 <= r2;
    }
	long distance(int x, int y, int x1, int y1) {
		return (x - x1) * (x - x1) + (y - y1)*(y - y1);
	}
}


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

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

class TaskB {

    public void solve(int testNumber, FastScanner in, PrintWriter out) {
        int x1, y1, ir1, or1;
        int x2, y2, ir2, or2;
        x1 = in.nextInt();  y1 = in.nextInt(); ir1 = in.nextInt(); or1 = in.nextInt();
        x2 = in.nextInt();  y2 = in.nextInt(); ir2 = in.nextInt(); or2 = in.nextInt();

        int dx = x2 - x1;
        int dy = y2 - y1;

        char cir1 = 1;
        char cor1 = 1;
        char cir2 = 1;
        char cor2 = 1;

        if (!checkVisibility(ir1, or1, dx, dy, ir2)) {
            cir2 = 0;
        }
        if (!checkVisibility(ir1, or1, dx, dy, or2)) {
            cor2 = 0;
        }
        if (!checkVisibility(ir2, or2, -dx, -dy, ir1)) {
            cir1 = 0;
        }
        if (!checkVisibility(ir2, or2, -dx, -dy, or1)) {
            cor1 = 0;
        }

        if (checkIntersection(dx, dy, or1, or2)) {
            cor1 = cor2 = 0;
        }
        if (checkIntersection(dx, dy, or1, ir2)) {
            cor1 = cir2 = 0;
        }
        if (checkIntersection(dx, dy, ir1, or2)) {
            cir1 = cor2 = 0;
        }
        if (checkIntersection(dx, dy, ir1, ir2)) {
            cir1 = cir2 = 0;
        }

        out.println(cir1 + cir2 + cor1 + cor2);
    }

    private boolean checkVisibility(int inner, int outer, int dx, int dy, int radius) {
        int sum1 = outer - radius;
        if (sum1 > 0 && (dx*dx + dy*dy) <= sum1*sum1) {
            int sum2 = inner + radius;
            int sum3 = radius - inner;
            return ((dx*dx + dy*dy) < sum2*sum2) && (sum3 < 0 || ((dx*dx + dy*dy) > sum3*sum3));
        }
        return true;
    }

    private boolean checkIntersection(int dx, int dy, int radius1, int radius2) {
        int sum1 = radius1 - radius2;
        int sum2 = radius1 + radius2;
        return (((dx*dx + dy*dy) > sum1*sum1) && ((dx*dx + dy*dy) < sum2*sum2));
    }

}

class FastScanner {

    private BufferedReader reader;
    private StringTokenizer tokenizer;

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

    public String nextLine() {
        tokenizer = null;
        try {
            return reader.readLine();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

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

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

    }


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

public class Main
	{
	public static void main(String args[]) throws IOException
		{
		Scanner c=new Scanner(System.in);
		int x1=c.nextInt();
		int y1=c.nextInt();
		int r1=c.nextInt();
		int R1=c.nextInt();

		int x2=c.nextInt();
		int y2=c.nextInt();
		int r2=c.nextInt();
		int R2=c.nextInt();

		int ans=0;
		if(!intersects(x1,y1,r1,x2,y2,r2,R2))
			ans++;
		if(!intersects(x1,y1,R1,x2,y2,r2,R2))
			ans++;
		if(!intersects(x2,y2,r2,x1,y1,r1,R1))
			ans++;
		if(!intersects(x2,y2,R2,x1,y1,r1,R1))
			ans++;
		System.out.println(ans);
		}

	private static boolean intersects(int x1,int y1,int R1,int x2,int y2,int r2,int R2)
		{
		//System.out.println("testing: "+x1+" "+y1+" "+R1 +" with "+" "+x2+" "+y2+" "+r2+" "+R2);
		int dc=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
		//System.out.println("dc= "+dc);
		//System.out.println("T1= "+(R1+R2)*(R1+R2));
		//System.out.println("T2= "+(Math.abs(R1-r2)*Math.abs(R1-r2)));
		if(dc>=(R1+R2)*(R1+R2)||(dc<=(Math.abs(R1-r2)*Math.abs(R1-r2))&&R1<=r2)||(dc<=(Math.abs(R1-R2)*Math.abs(R1-R2))&&R2<=R1))
			{
			//System.out.println("false");
			return false;
			}
		//System.out.println("true");
		return true;
		}
	}

//must declare new classes here


import java.util.Scanner;

public class ACarrotCakes {

    public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    int n = input.nextInt();//number of carrots to complete the task
    int t = input.nextInt();//minutes to bake by one oven
    int k = input.nextInt();//num of carrots cake
    int d = input.nextInt();//minutes to build another oven
        int q=0;
            int w=0;
    if(n<=k)
    {
         System.out.println("NO");
    }
    else if(t==d)
    {
         System.out.println("NO");

    }
    else if(n>k)
    {
        while(true)
        {
             q+=t;
             w+=k;
            if(w==n){break;}
        }
        if(t+d<q){System.out.println("YES");}
        else{System.out.println("NO");}
    }

    }

}


import java.util.*;
public class Sheet_Cakes
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        //1) 8 - 6 - 4 - 5
        //              12
        //              11
        int n, t, k, d;
        n = sc.nextInt();   if(n > 1000 || n < 1)   return;
        t = sc.nextInt();   if(t > 1000 || t < 1)   return;
        k = sc.nextInt();   if(k > 1000 || k < 1)   return;
        d = sc.nextInt();   if(d > 1000 || d < 1)   return;
        int i = 2;
        int t1 = t;
        int t0 = t;
        int t2 = t;
        int k_copy = k;
        if(k > n)   System.out.println("NO");
        else
        {
            while(k < n)
            {
                k = k * i;
                t = t * i;
                i++;
            }
            i=2;
            if (t1 == d)
            {
                System.out.println("NO");
                return;
            }
            else if(t1>d)
            {
                t2 = t1 - d;
                t2 = t1 - t2;
                while (k_copy < n)
                {
                    t2 = t2 + t0;
                    k_copy = k_copy * i;
                    i++;
                }
            }
            else
            {
                t2 = d - t1;
                t2 = d - t2;
                while (k_copy < n)
                {
                    t2 = t2 + t0;
                    k = k * i;
                    i++;
                }
            }
            if(t2 < t) System.out.print("YES");
            else    System.out.println("NO");
        }
    }
}


import java.util.*;
public class Sheet_Cakes
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        //1) 8 - 6 - 4 - 5
        //              12
        //              11
        int n, t, k, d;
        n = sc.nextInt();   if(n > 1000 || n < 1)   return;
        t = sc.nextInt();   if(t > 1000 || t < 1)   return;
        k = sc.nextInt();   if(k > 1000 || k < 1)   return;
        d = sc.nextInt();   if(d > 1000 || d < 1)   return;
        int i = 2;
        int t1 = t;
        int t0 = t;
        int t2 = t;
        int k_copy = k;
        if(k > n)   System.out.println("NO");
        else
        {
            while(k < n)
            {
                k = k * i;
                t = t * i;
                i++;
            }
            i = 2;
            if (t1 == d)
            {
                System.out.println("NO");
                return;
            }
            else if(t1>d)
            {
                t2 = t1 - d;
                while (k_copy < n)
                {
                    t2 = t2 + t0;
                    k = k * i;
                    i++;
                }
            }
            else
            {
                t2 = d - t1;
                while (k_copy < n)
                {
                    t2 = t2 + t0;
                    k = k * i;
                    i++;
                }
            }
            t2 = t0 + t2;
            System.out.println(t2 + "\n" + t);
            if(t2 < t) System.out.print("YES");
            else    System.out.println("NO");
        }
    }
}


import java.util.Scanner;

public class CarrotCakes {

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

	int n = input.nextInt(),t = input.nextInt() , k = input.nextInt() , d = input.nextInt();

	int oven = 0 ;
	boolean oven2 = false;

	int count = 0 ;
	int still = 0 ;

	if(!( n < k)){
	while( n != 0)
	{
	    oven = k ;

	    still = n - k  ;
	    n = n - k ;
	    count = count + t;
	    if( count > d && still > 0)
	    {
		oven2 = true;
	    }
	}
	}

	System.out.println((oven2? "YES" : "NO"));
    }

}


//package com.company;

import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int count = Integer.valueOf(scanner.nextLine());
        List<Integer> numbers = Arrays.stream(scanner.nextLine().split(" ")).map(Integer::valueOf).collect(Collectors.toList());
        int resultCount = 0;
        int localCount = 0;
        for (int i = 0; i < count - 1; i++) {
            if (numbers.get(i + 1) - numbers.get(i) == 1) {
                localCount++;
            } else {
                if (localCount != 0) {
                    resultCount += localCount - 1;
                }
                localCount = 0;
            }
        }
        if (localCount != 0) {
            resultCount += localCount - 1;
        }
        if (numbers.get(0) == 1 && numbers.get(1) == 2) resultCount++;
        if (numbers.get(numbers.size() - 1) == 1000 && numbers.get(numbers.size() - 2) == 999) resultCount++;
        System.out.println(resultCount);
    }
}


import java.util.Scanner;

public class first {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int a = scan.nextInt();
		int [] ar = new int [a];
		int count = 0;
		for (int i = 0; i< a; i++){
			int b = scan.nextInt();
			ar[i] = b;

		}
		for (int i = 1; i< a; i++){
			if (ar[i] == ar[i-1]+ 1 ){
				count ++;
			}
		}

		if (ar[a-1] != ar[a-2] +1){
			count --;
		}
		System.out.println(count);
	}
}


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

import java.util.*;

public class Soly
{
    static final int INF = Integer.MAX_VALUE;

    static void mergeSort(int[] a,int [] c, int b, int e)
    {
        if(b < e)
        {
            int q = (b + e) >>1;
            mergeSort(a,c, b, q);
            mergeSort(a, c,q + 1, e);
            merge(a,c, b, q, e);
        }
    }

    static void merge(int[] a,int[]c, int b, int mid, int e)
    {
        int n1 = mid - b + 1;
        int n2 = e - mid;
        int[] L = new int[n1+1], R = new int[n2+1];
        int[] L1 = new int[n1+1], R1 = new int[n2+1];

        for(int i = 0; i < n1; i++) {
            L[i] = a[b + i];
            L1[i] = c[b + i];
        }
        for(int i = 0; i < n2; i++)  {
            R[i] = a[mid + 1 + i];
            R1[i] = c[mid + 1 + i];
        }
        L[n1] = R[n2] = INF;

        for(int k = b, i = 0, j = 0; k <= e; k++)
            if(L[i] <= R[j]){
                a[k] = L[i];
                c[k] = L1[i++];
            }

            else
            {
                a[k] = R[j];
                c[k] = R1[j++];
            }
    }
    static int s;
            static Stack<Character> sta;
static int type(char[] a){
        sta= new Stack<>();
        s=0;
        int op=0,cl=0;
    for (int i = 0; i < a.length; i++) {
        if (a[i]==')'){
            if (!sta.isEmpty()&&sta.peek()=='('){
                op--;
                sta.pop();
            }
            else{
                cl++;
                sta.push(')');
            }
        }
        else{
            op++;
           sta.push('(');
        }
    }
    if (sta.isEmpty())return 0;
    else{
        s=sta.size();
        //1 --> closing
        //2 -->opening
        if (op>0&&cl>0)return 50;
        else{
            if (op>0)return 2;
            return 1;
        }

    }
}

    public static void main(String[] args) throws IOException {
        Scanner in = new Scanner(System.in);
        try (PrintWriter or = new PrintWriter(System.out)) {
            int n = in.nextInt();
            int[] a= new int[n];
            int max=0;

            for (int i = 0; i < n; i++) a[i]=in.nextInt();
            if (a[1]-a[0]==1&&n==2&&a[1]!=1000){
                or.println(0);return;
            }
            for (int i = 0; i < n; i++) {
                for (int j = i,p=n-1; p>j ; --p) {
                    if (a[p]-a[i]==p-i){
                        if (p==n-1&&i==0) max=Math.max(max,p-i);
                        else max=Math.max(max,p-i-1);
                    }
                }
            }
            or.println(max);

        }
        }

    static class Scanner {

        StringTokenizer st;
        BufferedReader br;

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

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

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

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

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

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

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

    }

}
class coooo {
    String s;
    int cnt;
    int type;

    public coooo(String s, int cnt,int t) {
        this.s = s;
        this.cnt = cnt;
        this.type=t;
    }
}