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

public class Main {

    /**
     * @param args
     */
    public static BigInteger W,K,M;
    public static BigInteger calc(BigInteger x){
        BigInteger tmp = BigInteger.valueOf(0);
        BigInteger ans = BigInteger.valueOf(0);
        BigInteger tmq = BigInteger.valueOf(1);
        BigInteger t;
        while (tmp.compareTo(x) < 0){
            t = tmp.multiply(BigInteger.valueOf(10));
            t = t.add(BigInteger.valueOf(9));
            if (t.compareTo(x) <= 0){
                ans = ans.add(t.subtract(tmp).multiply(K).multiply(tmq));
            }
            else{
                ans = ans.add(x.subtract(tmp).multiply(K).multiply(tmq));
            }
            tmq = tmq.add(BigInteger.valueOf(1));
            tmp = t;
            //System.out.print(tmq+" "+ans+"\n");
        }
        return ans;
    }
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner cin = new Scanner(new BufferedInputStream(System.in));
        W = cin.nextBigInteger();
        M = cin.nextBigInteger();
        K = cin.nextBigInteger();
        BigInteger x = BigInteger.valueOf(10);
        //System.out.print(calc(x)+"\n");
         W = W.add(calc(M.subtract(BigInteger.valueOf(1))));
        BigInteger l = BigInteger.valueOf(0);
        BigInteger r = BigInteger.valueOf(1);
        while (W.compareTo(calc(r)) > 0)
                r = r.multiply(BigInteger.valueOf(10));
        while (l.compareTo(r) != 0){
            BigInteger mid = l.add(r);
            mid = mid.divide(BigInteger.valueOf(2));
            mid = mid.add(BigInteger.valueOf(1));
            if (W.compareTo(calc(mid)) >= 0)
                l = mid;
            else
                r = mid.subtract(BigInteger.valueOf(1));
        }
        System.out.print(l.subtract(M).add(BigInteger.valueOf(1)));
    }

}


//package goodbye2015;

import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;

public class B {

    public static void main(String[] args) {
        IO io = new IO();
        try {
            io.println(codeForce(io));
        } finally {
            //System.out.println("CLOSING FINALLY");
            io.close();
        }
    }

    public static long codeForce(IO io) {
        long a = io.nextLong();
        long b = io.nextLong();
        String bin = Long.toBinaryString(a);
        String goal = Long.toBinaryString(b);
        int indexForInitialZero = 0; // placeholder value

        //System.out.println("BIN: " + bin);
        //System.out.println("GOAL: " + goal);

        // We want to start with a binary string that has a single 0
        // If we have too much, fill out extra 0's with 1's
        // Going right->left to increase value as little as possible
        int zerosInBin = countZeros(bin);
        for (int i=bin.length()-1; zerosInBin>1; i--) {
            if (bin.charAt(i) == '0') {
                zerosInBin--;
                StringBuilder newBin = new StringBuilder();
                if (i>0) newBin.append(bin.substring(0,i));
                newBin.append('1');
                if (i<bin.length()-1) newBin.append(bin.substring(i+1, bin.length()));
                bin = newBin.toString();
            }
        }

        // If we have no zeros in starting binary string, turn 111 -> 1011
        if (zerosInBin == 0) {
            String possibleAddition = "";
            if (bin.length() > 1) possibleAddition = bin.substring(1,bin.length());
            if (goal.length() < bin.length()+1) return 0;
            if (goal.length() == bin.length()+1 && !stringIsBelowOrAtGoal(1, goal)) {
                Long parsed = Long.parseLong("10" + possibleAddition, 2);
                if (parsed > b) {
                    //System.out.println("parsed: " + parsed);
                    return 0;
                }
                else {
                    long count = 0;
                    if (goal.contains("0")) count++;
                    if (b != parsed) count++;
                    return count;
                }
            }
            bin = "10" + possibleAddition;
        }
        // Find initial zero
        int i=0;
        for ( ;i<bin.length(); i++) {
            if (bin.charAt(i) == '0') break;
        }
        indexForInitialZero = i;

        // First round may start from middle so do it separately
        long count = 0;
        for (i=indexForInitialZero; i<bin.length(); i++) {
            Long parsed = Long.parseLong(bin, 2);
            if (parsed <= b) count++;
            if (parsed >= b) return count;

            int len = bin.length();
            bin = "";

            for (int j=0; j<=i; j++) {
                bin += '1';
            }
            if (bin.length() < len) {
                bin += '0';
            }
            for (int j=i+2; j<len; j++) {
                bin += '1';
            }
        }

        // All other rounds. specRep represents binary strings
        // from 11110 -> 10111
        int specRep = bin.length()+1;
        boolean doneSomethingHere = false;
        while (specRep <= goal.length() + 1) {
            if (specRep == goal.length()+1) {
                // We possibly counted too many
                // Subtract the ones that went over
                if (!doneSomethingHere) return count;
                while (specRep > goal.length()) specRep--;
                for (i=specRep-1; i>=1; i--) {
                    if (stringIsBelowOrAtGoal(i, goal)) break;
                    count--;
                }
                return count;
            }
            doneSomethingHere = true;
            count += (specRep-1); // bc cant replace first '1' with '0'
            specRep++;
        }

        return count;
    }

    public static boolean stringIsBelowOrAtGoal(int a, String b) {
        // a represents a string that has same length as b
        // with all characters '1' except for a single '0' in index a
        for (int i=1; i<a; i++) {
            if (b.charAt(i) == '0') return false;
        }
        if (b.charAt(a) == '1') return true;
        for (int i=a+1; i<b.length(); i++) {
            if (b.charAt(i) == '0') return false;
        }
        return true;
    }

    public static int countZeros(String a) {
        int count = 0;
        for (int i=0; i<a.length(); i++) {
            if (a.charAt(i) == '0') count++;
        }
        return count;
    }

    static class IO extends PrintWriter {
	private InputStreamReader r;
	private static final int BUFSIZE = 1 << 15;
	private char[] buf;
	private int bufc;
	private int bufi;
	private StringBuilder sb;

	public IO() {
		super(new BufferedOutputStream(System.out));
		r = new InputStreamReader(System.in);

		buf = new char[BUFSIZE];
		bufc = 0;
		bufi = 0;
		sb = new StringBuilder();
	}

	private void fillBuf() throws IOException {
		bufi = 0;
		bufc = 0;
		while(bufc == 0) {
			bufc = r.read(buf, 0, BUFSIZE);
			if(bufc == -1) {
				bufc = 0;
				return;
			}
		}
	}

	private boolean pumpBuf() throws IOException {
		if(bufi == bufc) {
			fillBuf();
		}
		return bufc != 0;
	}

	private boolean isDelimiter(char c) {
		return c == ' ' || c == '\t' || c == '\n' || c == '\r' || c == '\f';
	}

	private void eatDelimiters() throws IOException {
		while(true) {
			if(bufi == bufc) {
				fillBuf();
				if(bufc == 0) throw new RuntimeException("IO: Out of input.");
			}

			if(!isDelimiter(buf[bufi])) break;
			++bufi;
		}
	}

	public String next() {
		try {
			sb.setLength(0);

			eatDelimiters();
			int start = bufi;

			while(true) {
				if(bufi == bufc) {
					sb.append(buf, start, bufi - start);
					fillBuf();
					start = 0;
					if(bufc == 0) break;
				}

				if(isDelimiter(buf[bufi])) break;
				++bufi;
			}

			sb.append(buf, start, bufi - start);

			return sb.toString();
		} catch(IOException e) {
			throw new RuntimeException("IO.next: Caught IOException.");
		}
	}

	public int nextInt() {
		try {
			int ret = 0;

			eatDelimiters();

			boolean positive = true;
			if(buf[bufi] == '-') {
				++bufi;
				if(!pumpBuf()) throw new RuntimeException("IO.nextInt: Invalid int.");
				positive = false;
			}

			boolean first = true;
			while(true) {
				if(!pumpBuf()) break;
				if(isDelimiter(buf[bufi])) {
					if(first) throw new RuntimeException("IO.nextInt: Invalid int.");
					break;
				}
				first = false;

				if(buf[bufi] >= '0' && buf[bufi] <= '9') {
					if(ret < -214748364) throw new RuntimeException("IO.nextInt: Invalid int.");
					ret *= 10;
					ret -= (int)(buf[bufi] - '0');
					if(ret > 0) throw new RuntimeException("IO.nextInt: Invalid int.");
				} else {
					throw new RuntimeException("IO.nextInt: Invalid int.");
				}

				++bufi;
			}

			if(positive) {
				if(ret == -2147483648) throw new RuntimeException("IO.nextInt: Invalid int.");
				ret = -ret;
			}

			return ret;
		} catch(IOException e) {
			throw new RuntimeException("IO.nextInt: Caught IOException.");
		}
	}

	public long nextLong() {
		try {
			long ret = 0;

			eatDelimiters();

			boolean positive = true;
			if(buf[bufi] == '-') {
				++bufi;
				if(!pumpBuf()) throw new RuntimeException("IO.nextLong: Invalid long.");
				positive = false;
			}

			boolean first = true;
			while(true) {
				if(!pumpBuf()) break;
				if(isDelimiter(buf[bufi])) {
					if(first) throw new RuntimeException("IO.nextLong: Invalid long.");
					break;
				}
				first = false;

				if(buf[bufi] >= '0' && buf[bufi] <= '9') {
					if(ret < -922337203685477580L) throw new RuntimeException("IO.nextLong: Invalid long.");
					ret *= 10;
					ret -= (long)(buf[bufi] - '0');
					if(ret > 0) throw new RuntimeException("IO.nextLong: Invalid long.");
				} else {
					throw new RuntimeException("IO.nextLong: Invalid long.");
				}

				++bufi;
			}

			if(positive) {
				if(ret == -9223372036854775808L) throw new RuntimeException("IO.nextLong: Invalid long.");
				ret = -ret;
			}

			return ret;
		} catch(IOException e) {
			throw new RuntimeException("IO.nextLong: Caught IOException.");
		}
	}

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

    }
}


import java.util.Scanner;

public class Triangle {

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

		if (a + b > c && a + c > b && b + c > a || a + b > d && a + d > b
				&& b + d > a || b + c > d && b + d > c && c + d > b
				|| a + c > d && a + d > c && c + d > a)
			System.out.println("TRIANGLE");
		else if (a + b == c || a + b == d || a + c == b || a + c == d
				|| a + d == b || a + d == c || c + b == a || c + b == d
				|| d + b == a || d + b == c || c + d == a || c + d == b)
			System.out.println("SEGMENT");
		else
			System.out.println("IMPOSSIBLE");
	}
}


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

public class Main {
	//////
	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	//////

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

		FastReader scan = new FastReader();

		int A=scan.nextInt();

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

		System.out.println(2*(A-1)+" 2");
		System.out.println("1 2");

	}

}


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

public class Solution {
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter pr = new PrintWriter(System.out);
		long n = sc.nextLong();
		long max = Long.MIN_VALUE;
		long min = Long.MAX_VALUE;
		for (int i = 1; i <= Math.sqrt(n); i++) {
			long k = n;
			if (k % i == 0) {
				k /= i;
				for (int j = 1; j <= Math.sqrt(n); j++) {
					long m = k;
						if (m % j == 0) {
							m /= j;
							min = Math.min((i + 1) * (j + 2) * (m + 2) - n, min);
							min = Math.min((i + 2) * (j + 1) * (m + 2) - n, min);
							min = Math.min((i + 2) * (j + 2) * (m + 1) - n, min);
							max = Math.max((i + 1) * (j + 2) * (m + 2) - n, max);
							max = Math.max((i + 2) * (j + 1) * (m + 2) - n, max);
							max = Math.max((i + 2) * (j + 2) * (m + 1) - n, max);
						}
					}
			}
		}
		pr.print(min + " " + max);
		pr.close();
	}
}


//package sol2;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;

public class Solution1 {

  static long MOD = (long)1e9 + 7;
  static long T, x;

  static int ret=0;
  static int a, b;
  public static void main(String[] args) throws IOException {
    FastInput fi = new FastInput(System.in);
    PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

    int x=fi.nextInt(), y = fi.nextInt(), z = fi.nextInt(), a = fi.nextInt(), b = fi.nextInt(), c = fi.nextInt();
    if(x>a) {
      System.out.println("NO");
      return;
    }
    a-=x;
    if(y>a+b) {
      System.out.println("NO");
      return;
    }
    if(a>=y) {
      a-=y;
      y=0;
    } else {
      y-=a;
      a=0;
      b-=y;
    }

    if(z>a+b+c) {
      System.out.println("NO");
      return;
    } else {
      System.out.println("YES");
    }
  }

  static long calc(long[] arr, long from, long to, int st, int fin) {
    if(st == fin || from==to) {
      return (fin-st+1)*b*(to-from+1);
    }
    int piv = -1;
    long toNext = (from + to)/2 + 1;
    for(int i=st; i<=fin; i++) {
      if(arr[i]>=toNext) {
        piv=i;
        break;
      }
    }
    long ret = (fin-st+1)*b*(to-from+1);
    if(piv == -1) {
      ret = Math.min(ret, a + calc(arr, from, toNext-1, st, fin));
    } else if(piv == st) {
      ret = Math.min(ret, a + calc(arr, toNext, fin, st, fin));
    } else {
      ret = Math.min(ret, calc(arr, from, toNext-1, st, piv-1) + calc(arr, toNext, to, piv, fin));
    }
    return ret;
  }

  static class Pair<K extends Comparable, V extends Comparable> implements Comparable {
    K key;
    V value;

    @Override
    public boolean equals(Object o) {
      if (this == o) {
        return true;
      }
      if (!(o instanceof Pair)) {
        return false;
      }
      Pair<?, ?> pair = (Pair<?, ?>) o;
      return Objects.equals(key, pair.key) &&
          Objects.equals(value, pair.value);
    }

    @Override
    public int hashCode() {
      return Objects.hash(key, value);
    }

    public Pair(K key, V value) {
      this.key = key;
      this.value = value;
    }

    @Override
    public int compareTo(Object o) {
      Pair<K, V> p = (Pair)o;
      if(p.key.compareTo(this.key) > 0)
        return 1;
      else if(p.key.compareTo(this.key) < 0)
        return -1;
      else {
        if(p.value.compareTo(this.value) > 0)
          return 1;
        else if(p.value.compareTo(this.value) < 0)
          return -1;
        else return 0;
      }
    }
  }

  private static class FastInput {

    BufferedReader  reader;
    StringTokenizer st;

    public FastInput(InputStream inputStream) {
      reader = new BufferedReader(new InputStreamReader(inputStream), 32768);
    }

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

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

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


import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
	public static long mod= (long) (1e9 +7);
	public static void main(String args[])
	{
		InputReader s= new InputReader(System.in);
		OutputStream outputStream= System.out;
		PrintWriter out= new PrintWriter(outputStream);
		int n= s.nextInt();
		String str= s.next();
		HashMap<Character,Integer> hmap= new HashMap<>();
		hmap.put('B', 0);
		hmap.put('G', 0);
		hmap.put('R', 0);
		for(int i=0;i<n;i++){
			hmap.put(str.charAt(i), hmap.get(str.charAt(i))+1);
		}
		int cnt=0;
		for(Character k : hmap.keySet()){
			if(hmap.get(k)>=2)
				cnt++;
		}
		if(cnt>=2){
			out.println("BGR");
		}
		else if(cnt>=1){
			int sum=0;
			for(Character k : hmap.keySet()){
				if(hmap.get(k)==0){
					sum++;
				}
			}
			if(sum==2){
				for(Character k : hmap.keySet()){
					if(hmap.get(k)>=2){
						System.out.println(k);
						return;
					}
				}
			}
			ArrayList<Character> arr= new ArrayList<>();
			if(sum==1){
				for(Character k : hmap.keySet()){
					if(hmap.get(k)<2){
						arr.add(k);
						//System.out.print(k);
						//out.println("fsdfs");
					}
				}
				Collections.sort(arr);
				for(int i=0;i<arr.size();i++)
					out.print(arr.get(i));
			}
			if(sum==0)
				out.println("BGR");
		}
		else{
		//s	out.println("fewfs");
			int count=0;
			for(Character k : hmap.keySet()){
				if(hmap.get(k)==1){
					count++;
				}
			}

			ArrayList<Character> arr= new ArrayList<>();
			if(count==3)
				out.print("BGR");
			else if(count==2){
				for(Character k : hmap.keySet()){
					if(hmap.get(k)==0){
						arr.add(k);
						//out.print(k);
					}
				}
				Collections.sort(arr);
				for(int i=0;i<arr.size();i++)
					out.print(arr.get(i));
			}
			else{
				for(Character k : hmap.keySet()){
					if(hmap.get(k)==1){
						arr.add(k);
					}
				}
				Collections.sort(arr);
				for(int i=0;i<arr.size();i++)
					out.print(arr.get(i));
			}
		}
		out.close();
	}

	static long combinations(long n,long r){   // O(r)
		if(r==0 || r==n) return 1;
		r= Math.min(r, n-r);
		long ans=n;  // nC1=n;
		for(int i=1;i<r;i++){
			ans= ans*(n-i);
			ans= ans/(i+1);
		}
		return ans;

	}
	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}
	static long modulo(long a,long b,long c) {
		long x=1;
		long y=a;
		while(b > 0){
			if(b%2 == 1){
				x=(x*y)%c;
			}
			y = (y*y)%c; // squaring the base
			b /= 2;
		}
		return  x%c;
	}
	static void catalan_numbers(int n) {
		long catalan[]= new long[n+1];
	    catalan[1] = 1;
	    for (int i = 2; i <= n; i++) {
	        for (int j = 1; j <= i - 1; j++) {
	            catalan[i] = catalan[i] + ((catalan[j]) * catalan[i - j]);
	        }
	    }
	}

	static ArrayList<Integer> primeFactors(int n)   // O(sqrt(n))
	{
	    // Print the number of 2s that divide n
		ArrayList<Integer> arr= new ArrayList<>();
	    while (n%2 == 0)
	    {
	        arr.add(2);
	        n = n/2;
	    }

	    // n must be odd at this point.  So we can skip one element (Note i = i +2)
	    for (int i = 3; i <= Math.sqrt(n); i = i+2)
	    {
	        // While i divides n, print i and divide n
	        while (n%i == 0)
	        {
	            arr.add(i);
	            n = n/i;
	        }
	    }
	    // This condition is to handle the case when n is a prime number
	    // greater than 2
	    if (n > 2)
	        arr.add(n);

	    return arr;
	}

	public static int expo(int a, int b){
		if (b==0)
	        return 1;
	    if (b==1)
	        return a;
	    if (b==2)
	        return a*a;

	    if (b%2==0){
	            return expo(expo(a,b/2),2);
	    }
	    else{
	        return a*expo(expo(a,(b-1)/2),2);
	    }
	}
	static class Pair implements Comparable<Pair>
	{
		long f;
		String s;
		Pair(long ii, String cc)
		{
			f=ii;
			s=cc;
		}

		public int compareTo(Pair o)
		{
			return Long.compare(this.f, o.f);
		}

	}

	public static int[] sieve(int N){    // O(n*log(logn))
		int arr[]= new int[N+1];
		for(int i=2;i<=Math.sqrt(N);i++){
			if(arr[i]==0){
				for(int j= i*i;j<= N;j= j+i){
					arr[j]=1;
				}
			}
		}
		return arr;
		// All the i for which arr[i]==0 are prime numbers.
	}
	static long gcd(long a,long b){       // O(logn)
		if(b==0) return a;
		return gcd(b,a%b);
	}
	static class InputReader {

	    public BufferedReader reader;
	    public StringTokenizer tokenizer;

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

	    public String nextLine(){
	    	String fullLine=null;
	    	while (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	              fullLine=reader.readLine();
	            } catch (IOException e) {
	              throw new RuntimeException(e);
	            }
	            return fullLine;
	          }
	          return fullLine;
	    }
		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 long nextLong() {
		      return Long.parseLong(next());
		    }
	    public int nextInt() {
	      return Integer.parseInt(next());
	    }
	  }
}


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

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

class Task {

	Map<Long, Integer> map=new EHashMap<>();
	Map<Long, List<Long>> divides=new EHashMap<>();
	long[][] dp;
	int idx=0;
	List<Long> list=new ArrayList<>();

	public void solve(int testNumber, InputReader in, OutputWriter out) {
		long A=in.readLong();
		for (long i=1; i*i<=A; i++) if (A%i==0) {
			process(i);
			if (i*i!=A) process(A/i);
		}
		dp=new long[2][map.size()];
//		for (long i: map.keySet()) System.out.println(i+" "+map.get(i));
		dp[0][map.get(1L)]=1;
		int idx=0;
		for (long i: divides.keySet()) {
			idx^=1;
//			if (idx>1) dp[idx-2].clear();
			for (long j: map.keySet()) {
				int j2=map.get(j);
				dp[idx][j2]=dp[idx^1][j2];
				for (long x: divides.get(i))
					if (j%x==0) {
//						System.out.println(idx);
//						System.out.println(dp[idx]);
//						System.out.println(dp[idx-1]);
						dp[idx][j2]+=dp[idx^1][map.get(j/x)];
					}
			}
		}
		out.printLine(dp[idx][map.get(A)]);
	}

	long prime(long n) {
		if (n<=1) return -1;
		for (long i=2; i*i<=n; i++) if (n%i==0) {
			while (n%i==0) n/=i;
			return n==1?i:-1;
		}
		return n;
	}

	void process(long x) {
		map.put(x, idx++);
		long p=prime(x-1);
		if (p>0) {
			if (!divides.containsKey(p)) divides.put(p, new ArrayList<Long>());
			divides.get(p).add(x);
		}
	}
}

class InputReader {
	private boolean finished = false;

	private InputStream stream;
	private byte[] buf = new byte[1024];
	private int curChar;
	private int numChars;
	private SpaceCharFilter filter;

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

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

	public int peek() {
		if (numChars == -1)
			return -1;
		if (curChar >= numChars) {
			curChar = 0;
			try {
				numChars = stream.read(buf);
			} catch (IOException e) {
				return -1;
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar];
	}

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

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

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

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

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

	private String readLine0() {
		StringBuilder buf = new StringBuilder();
		int c = read();
		while (c != '\n' && c != -1) {
			if (c != '\r')
				buf.appendCodePoint(c);
			c = read();
		}
		return buf.toString();
	}

	public String readLine() {
		String s = readLine0();
		while (s.trim().length() == 0)
			s = readLine0();
		return s;
	}

	public String readLine(boolean ignoreEmptyLines) {
		if (ignoreEmptyLines)
			return readLine();
		else
			return readLine0();
	}

	public BigInteger readBigInteger() {
		try {
			return new BigInteger(readString());
		} catch (NumberFormatException e) {
			throw new InputMismatchException();
		}
	}

	public char readCharacter() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		return (char) c;
	}

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

	public boolean isExhausted() {
		int value;
		while (isSpaceChar(value = peek()) && value != -1)
			read();
		return value == -1;
	}

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

	public SpaceCharFilter getFilter() {
		return filter;
	}

	public void setFilter(SpaceCharFilter filter) {
		this.filter = filter;
	}

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

class OutputWriter {
	private final PrintWriter writer;

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

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

	public void print(char[] array) {
		writer.print(array);
	}

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

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

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

	public void print(Collection<Integer> collection) {
		boolean first = true;
		for (int i : collection) {
			if (first)
				first = false;
			else
				writer.print(' ');
			writer.print(i);
		}
	}

	public void printLine(int[] array) {
		print(array);
		writer.println();
	}

	public void printLine(long[] array) {
		print(array);
		writer.println();
	}

	public void printLine(Collection<Integer> collection) {
		print(collection);
		writer.println();
	}

	public void printLine() {
		writer.println();
	}

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

	public void print(char i) {
		writer.print(i);
	}

	public void printLine(char i) {
		writer.println(i);
	}

	public void printLine(char[] array) {
		writer.println(array);
	}

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

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

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

	public void print(long i) {
		writer.print(i);
	}

	public void printLine(long i) {
		writer.println(i);
	}

	public void print(int i) {
		writer.print(i);
	}

	public void printLine(int i) {
		writer.println(i);
	}
}

class Polygon {
	public final Point[] vertices;
	private Segment[] sides;

	public Polygon(Point... vertices) {
		this.vertices = vertices.clone();
	}

	public double square() {
		double sum = 0;
		for (int i = 1; i < vertices.length; i++)
			sum += (vertices[i].x - vertices[i - 1].x)
					* (vertices[i].y + vertices[i - 1].y);
		sum += (vertices[0].x - vertices[vertices.length - 1].x)
				* (vertices[0].y + vertices[vertices.length - 1].y);
		return Math.abs(sum) / 2;
	}

	public Point center() {
		double sx = 0;
		double sy = 0;
		for (Point point : vertices) {
			sx += point.x;
			sy += point.y;
		}
		return new Point(sx / vertices.length, sy / vertices.length);
	}

	public static boolean over(Point a, Point b, Point c) {
		return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) < -GeometryUtils.epsilon;
	}

	private static boolean under(Point a, Point b, Point c) {
		return a.x * (b.y - c.y) + b.x * (c.y - a.y) + c.x * (a.y - b.y) > GeometryUtils.epsilon;
	}

	public static Polygon convexHull(Point[] points) {
		if (points.length == 1)
			return new Polygon(points);
		Arrays.sort(points, new Comparator<Point>() {
			public int compare(Point o1, Point o2) {
				int value = Double.compare(o1.x, o2.x);
				if (value != 0)
					return value;
				return Double.compare(o1.y, o2.y);
			}
		});
		Point left = points[0];
		Point right = points[points.length - 1];
		List<Point> up = new ArrayList<Point>();
		List<Point> down = new ArrayList<Point>();
		for (Point point : points) {
			if (point == left || point == right || !under(left, point, right)) {
				while (up.size() >= 2
						&& under(up.get(up.size() - 2), up.get(up.size() - 1),
								point))
					up.remove(up.size() - 1);
				up.add(point);
			}
			if (point == left || point == right || !over(left, point, right)) {
				while (down.size() >= 2
						&& over(down.get(down.size() - 2),
								down.get(down.size() - 1), point))
					down.remove(down.size() - 1);
				down.add(point);
			}
		}
		Point[] result = new Point[up.size() + down.size() - 2];
		int index = 0;
		for (Point point : up)
			result[index++] = point;
		for (int i = down.size() - 2; i > 0; i--)
			result[index++] = down.get(i);
		return new Polygon(result);
	}

	public boolean contains(Point point) {
		return contains(point, false);
	}

	public boolean contains(Point point, boolean strict) {
		for (Segment segment : sides()) {
			if (segment.contains(point, true))
				return !strict;
		}
		double totalAngle = GeometryUtils.canonicalAngle(Math.atan2(
				vertices[0].y - point.y, vertices[0].x - point.x)
				- Math.atan2(vertices[vertices.length - 1].y - point.y,
						vertices[vertices.length - 1].x - point.x));
		for (int i = 1; i < vertices.length; i++) {
			totalAngle += GeometryUtils.canonicalAngle(Math.atan2(vertices[i].y
					- point.y, vertices[i].x - point.x)
					- Math.atan2(vertices[i - 1].y - point.y, vertices[i - 1].x
							- point.x));
		}
		return Math.abs(totalAngle) > Math.PI;
	}

	public Segment[] sides() {
		if (sides == null) {
			sides = new Segment[vertices.length];
			for (int i = 0; i < vertices.length - 1; i++)
				sides[i] = new Segment(vertices[i], vertices[i + 1]);
			sides[sides.length - 1] = new Segment(
					vertices[vertices.length - 1], vertices[0]);
		}
		return sides;
	}

	public static double triangleSquare(Point a, Point b, Point c) {
		return Math.abs((a.x - b.x) * (a.y + b.y) + (b.x - c.x) * (b.y + c.y)
				+ (c.x - a.x) * (c.y + a.y)) / 2;
	}

	public double perimeter() {
		double result = vertices[0].distance(vertices[vertices.length - 1]);
		for (int i = 1; i < vertices.length; i++)
			result += vertices[i].distance(vertices[i - 1]);
		return result;
	}
}

class Point {
	public static final Point ORIGIN = new Point(0, 0);
	public final double x;
	public final double y;

	@Override
	public String toString() {
		return "(" + x + ", " + y + ")";
	}

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

	public Line line(Point other) {
		if (equals(other))
			return null;
		double a = other.y - y;
		double b = x - other.x;
		double c = -a * x - b * y;
		return new Line(a, b, c);
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Point point = (Point) o;

		return Math.abs(x - point.x) <= GeometryUtils.epsilon
				&& Math.abs(y - point.y) <= GeometryUtils.epsilon;
	}

	@Override
	public int hashCode() {
		int result;
		long temp;
		temp = x != +0.0d ? Double.doubleToLongBits(x) : 0L;
		result = (int) (temp ^ (temp >>> 32));
		temp = y != +0.0d ? Double.doubleToLongBits(y) : 0L;
		result = 31 * result + (int) (temp ^ (temp >>> 32));
		return result;
	}

	public double distance(Point other) {
		return GeometryUtils.fastHypot(x - other.x, y - other.y);
	}

	public double distance(Line line) {
		return Math.abs(line.a * x + line.b * y + line.c);
	}

	public double value() {
		return GeometryUtils.fastHypot(x, y);
	}

	public double angle() {
		return Math.atan2(y, x);
	}

	public static Point readPoint(InputReader in) {
		double x = in.readDouble();
		double y = in.readDouble();
		return new Point(x, y);
	}

	public Point rotate(double angle) {
		double nx = x * Math.cos(angle) - y * Math.sin(angle);
		double ny = y * Math.cos(angle) + x * Math.sin(angle);
		return new Point(nx, ny);
	}
}

class Segment {
	public final Point a;
	public final Point b;
	private double distance = Double.NaN;
	private Line line = null;

	public Segment(Point a, Point b) {
		this.a = a;
		this.b = b;
	}

	public double length() {
		if (Double.isNaN(distance))
			distance = a.distance(b);
		return distance;
	}

	public double distance(Point point) {
		double length = length();
		double left = point.distance(a);
		if (length < GeometryUtils.epsilon)
			return left;
		double right = point.distance(b);
		if (left * left > right * right + length * length)
			return right;
		if (right * right > left * left + length * length)
			return left;
		return point.distance(line());
	}

	public Point intersect(Segment other, boolean includeEnds) {
		Line line = line();
		Line otherLine = other.a.line(other.b);
		if (line.parallel(otherLine))
			return null;
		Point intersection = line.intersect(otherLine);
		if (contains(intersection, includeEnds)
				&& other.contains(intersection, includeEnds))
			return intersection;
		else
			return null;
	}

	public boolean contains(Point point, boolean includeEnds) {
		if (a.equals(point) || b.equals(point))
			return includeEnds;
		if (a.equals(b))
			return false;
		Line line = line();
		if (!line.contains(point))
			return false;
		Line perpendicular = line.perpendicular(a);
		double aValue = perpendicular.value(a);
		double bValue = perpendicular.value(b);
		double pointValue = perpendicular.value(point);
		return aValue < pointValue && pointValue < bValue
				|| bValue < pointValue && pointValue < aValue;
	}

	public Line line() {
		if (line == null)
			line = a.line(b);
		return line;
	}

	public Point middle() {
		return new Point((a.x + b.x) / 2, (a.y + b.y) / 2);
	}

	public Point[] intersect(Circle circle) {
		Point[] result = line().intersect(circle);
		if (result.length == 0)
			return result;
		if (result.length == 1) {
			if (contains(result[0], true))
				return result;
			return new Point[0];
		}
		if (contains(result[0], true)) {
			if (contains(result[1], true))
				return result;
			return new Point[] { result[0] };
		}
		if (contains(result[1], true))
			return new Point[] { result[1] };
		return new Point[0];
	}

	public Point intersect(Line line) {
		Line selfLine = line();
		Point intersect = selfLine.intersect(line);
		if (intersect == null)
			return null;
		if (contains(intersect, true))
			return intersect;
		return null;
	}

	public double distance(Segment other) {
		Line line = line();
		Line otherLine = other.line();
		Point p = line == null || otherLine == null ? null : line
				.intersect(otherLine);
		if (p != null && contains(p, true) && other.contains(p, true))
			return 0;
		return Math.min(Math.min(other.distance(a), other.distance(b)),
				Math.min(distance(other.a), distance(other.b)));
	}
}

class GeometryUtils {
	public static double epsilon = 1e-8;

	public static double fastHypot(double... x) {
		if (x.length == 0)
			return 0;
		else if (x.length == 1)
			return Math.abs(x[0]);
		else {
			double sumSquares = 0;
			for (double value : x)
				sumSquares += value * value;
			return Math.sqrt(sumSquares);
		}
	}

	public static double fastHypot(double x, double y) {
		return Math.sqrt(x * x + y * y);
	}

	public static double fastHypot(double[] x, double[] y) {
		if (x.length == 0)
			return 0;
		else if (x.length == 1)
			return Math.abs(x[0] - y[0]);
		else {
			double sumSquares = 0;
			for (int i = 0; i < x.length; i++) {
				double diff = x[i] - y[i];
				sumSquares += diff * diff;
			}
			return Math.sqrt(sumSquares);
		}
	}

	public static double fastHypot(int[] x, int[] y) {
		if (x.length == 0)
			return 0;
		else if (x.length == 1)
			return Math.abs(x[0] - y[0]);
		else {
			double sumSquares = 0;
			for (int i = 0; i < x.length; i++) {
				double diff = x[i] - y[i];
				sumSquares += diff * diff;
			}
			return Math.sqrt(sumSquares);
		}
	}

	public static double missileTrajectoryLength(double v, double angle,
			double g) {
		return (v * v * Math.sin(2 * angle)) / g;
	}

	public static double sphereVolume(double radius) {
		return 4 * Math.PI * radius * radius * radius / 3;
	}

	public static double triangleSquare(double first, double second,
			double third) {
		double p = (first + second + third) / 2;
		return Math.sqrt(p * (p - first) * (p - second) * (p - third));
	}

	public static double canonicalAngle(double angle) {
		while (angle > Math.PI)
			angle -= 2 * Math.PI;
		while (angle < -Math.PI)
			angle += 2 * Math.PI;
		return angle;
	}

	public static double positiveAngle(double angle) {
		while (angle > 2 * Math.PI - GeometryUtils.epsilon)
			angle -= 2 * Math.PI;
		while (angle < -GeometryUtils.epsilon)
			angle += 2 * Math.PI;
		return angle;
	}
}

class Line {
	public final double a;
	public final double b;
	public final double c;

	public Line(Point p, double angle) {
		a = Math.sin(angle);
		b = -Math.cos(angle);
		c = -p.x * a - p.y * b;
	}

	public Line(double a, double b, double c) {
		double h = GeometryUtils.fastHypot(a, b);
		this.a = a / h;
		this.b = b / h;
		this.c = c / h;
	}

	public Point intersect(Line other) {
		if (parallel(other))
			return null;
		double determinant = b * other.a - a * other.b;
		double x = (c * other.b - b * other.c) / determinant;
		double y = (a * other.c - c * other.a) / determinant;
		return new Point(x, y);
	}

	public boolean parallel(Line other) {
		return Math.abs(a * other.b - b * other.a) < GeometryUtils.epsilon;
	}

	public boolean contains(Point point) {
		return Math.abs(value(point)) < GeometryUtils.epsilon;
	}

	public Line perpendicular(Point point) {
		return new Line(-b, a, b * point.x - a * point.y);
	}

	public double value(Point point) {
		return a * point.x + b * point.y + c;
	}

	public Point[] intersect(Circle circle) {
		double distance = distance(circle.center);
		if (distance > circle.radius + GeometryUtils.epsilon)
			return new Point[0];
		Point intersection = intersect(perpendicular(circle.center));
		if (Math.abs(distance - circle.radius) < GeometryUtils.epsilon)
			return new Point[] { intersection };
		double shift = Math.sqrt(circle.radius * circle.radius - distance
				* distance);
		return new Point[] {
				new Point(intersection.x + shift * b, intersection.y - shift
						* a),
				new Point(intersection.x - shift * b, intersection.y + shift
						* a) };
	}

	public double distance(Point center) {
		return Math.abs(value(center));
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Line line = (Line) o;

		if (!parallel(line))
			return false;
		if (Math.abs(a * line.c - c * line.a) > GeometryUtils.epsilon
				|| Math.abs(b * line.c - c * line.b) > GeometryUtils.epsilon)
			return false;

		return true;
	}
}

class Circle {
	public final Point center;
	public final double radius;

	public Circle(Point center, double radius) {
		this.center = center;
		this.radius = radius;
	}

	public boolean contains(Point point) {
		return center.distance(point) < radius + GeometryUtils.epsilon;
	}

	public boolean strictContains(Point point) {
		return center.distance(point) < radius - GeometryUtils.epsilon;
	}

	public Point[] findTouchingPoints(Point point) {
		double distance = center.distance(point);
		if (distance < radius - GeometryUtils.epsilon)
			return new Point[0];
		if (distance < radius + GeometryUtils.epsilon)
			return new Point[] { point };
		Circle power = new Circle(point, Math.sqrt((distance - radius)
				* (distance + radius)));
		return intersect(power);
	}

	public Point[] intersect(Circle other) {
		double distance = center.distance(other.center);
		if (distance > radius + other.radius + GeometryUtils.epsilon
				|| Math.abs(radius - other.radius) > distance
						+ GeometryUtils.epsilon)
			return new Point[0];
		double p = (radius + other.radius + distance) / 2;
		double height = 2
				* Math.sqrt(p * (p - radius) * (p - other.radius)
						* (p - distance)) / distance;
		double l1 = Math.sqrt(radius * radius - height * height);
		double l2 = Math.sqrt(other.radius * other.radius - height * height);
		if (radius * radius + distance * distance < other.radius * other.radius)
			l1 = -l1;
		if (radius * radius > distance * distance + other.radius * other.radius)
			l2 = -l2;
		Point middle = new Point((center.x * l2 + other.center.x * l1)
				/ (l1 + l2), (center.y * l2 + other.center.y * l1) / (l1 + l2));
		Line line = center.line(other.center).perpendicular(middle);
		return line.intersect(this);
	}
}

class Pair<U, V> implements Comparable<Pair<U, V>> {
	public final U first;
	public final V second;

	public static <U, V> Pair<U, V> makePair(U first, V second) {
		return new Pair<U, V>(first, second);
	}

	private Pair(U first, V second) {
		this.first = first;
		this.second = second;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		Pair pair = (Pair) o;

		return !(first != null ? !first.equals(pair.first) : pair.first != null)
				&& !(second != null ? !second.equals(pair.second)
						: pair.second != null);

	}

	public int hashCode() {
		int result = first != null ? first.hashCode() : 0;
		result = 31 * result + (second != null ? second.hashCode() : 0);
		return result;
	}

	public String toString() {
		return "(" + first + "," + second + ")";
	}

	public int compareTo(Pair<U, V> o) {
		int value = ((Comparable<U>) first).compareTo(o.first);
		if (value != 0)
			return value;
		return ((Comparable<V>) second).compareTo(o.second);
	}
}

class IOUtils {

	public static void readIntArrays(InputReader in, int[]... arrays) {
		for (int i = 0; i < arrays[0].length; i++) {
			for (int j = 0; j < arrays.length; j++)
				arrays[j][i] = in.readInt();
		}
	}

}

class TreapSet<K> implements NavigableSet<K> {
	protected static final Random rnd = new Random(239);

	protected final Node nullNode;
	protected final Comparator<? super K> comparator;
	protected Node root;
	private final K from;
	private final K to;
	private final boolean fromInclusive;
	private final boolean toInclusive;

	public TreapSet() {
		this((Comparator<? super K>) null);
	}

	public TreapSet(Comparator<? super K> comparator) {
		this(null, null, false, false, comparator, null, null);
	}

	protected TreapSet(K from, K to, boolean fromInclusive,
			boolean toInclusive, Comparator<? super K> comparator, Node root,
			Node nullNode) {
		this.comparator = comparator;
		this.from = from;
		this.to = to;
		this.fromInclusive = fromInclusive;
		this.toInclusive = toInclusive;
		if (nullNode == null)
			nullNode = new NullNode();
		if (root == null)
			root = nullNode;
		this.root = root;
		this.nullNode = nullNode;
	}

	public boolean addAll(Iterable<? extends K> collection) {
		boolean result = false;
		for (K element : collection)
			result |= add(element);
		return result;
	}

	public K lower(K k) {
		Node target = root.lower(k);
		if (target == nullNode)
			return null;
		if (belongs(target.key))
			return target.key;
		return null;
	}

	private boolean belongs(K key) {
		int valueFrom = compare(from, key);
		int valueTo = compare(key, to);
		return (valueFrom < 0 || valueFrom == 0 && fromInclusive)
				&& (valueTo < 0 || valueTo == 0 && toInclusive);
	}

	public K floor(K k) {
		Node target = root.floor(k);
		if (target == nullNode)
			return null;
		if (belongs(target.key))
			return target.key;
		return null;
	}

	public K ceiling(K k) {
		Node target = root.ceil(k);
		if (target == nullNode)
			return null;
		if (belongs(target.key))
			return target.key;
		return null;
	}

	public K higher(K k) {
		Node target = root.higher(k);
		if (target == nullNode)
			return null;
		if (belongs(target.key))
			return target.key;
		return null;
	}

	public K pollFirst() {
		K first = first();
		if (first == null)
			throw new NoSuchElementException();
		root.erase(first);
		return first;
	}

	public K pollLast() {
		K last = last();
		if (last == null)
			throw new NoSuchElementException();
		root.erase(last);
		return last;
	}

	public int size() {
		if (from == null && to == null)
			return root.size;
		if (from == null) {
			Node to = toInclusive ? root.floor(this.to) : root.lower(this.to);
			if (to == nullNode)
				return 0;
			return root.indexOf(to) + 1;
		}
		if (to == null) {
			Node from = fromInclusive ? root.ceil(this.from) : root
					.higher(this.from);
			if (from == nullNode)
				return 0;
			return root.size - root.indexOf(from);
		}
		Node from = fromInclusive ? root.ceil(this.from) : root
				.higher(this.from);
		if (from == nullNode || !belongs(from.key))
			return 0;
		Node to = toInclusive ? root.floor(this.to) : root.lower(this.to);
		return root.indexOf(to) - root.indexOf(from) + 1;
	}

	public boolean isEmpty() {
		return size() == 0;
	}

	public boolean contains(Object o) {
		return belongs((K) o) && root.search((K) o) != nullNode;
	}

	public Iterator<K> iterator() {
		return new Iterator<K>() {
			private K current = first();

			public boolean hasNext() {
				return current != null;
			}

			public K next() {
				K result = current;
				current = higher(current);
				return result;
			}

			public void remove() {
				TreapSet.this.remove(current);
			}
		};
	}

	public Object[] toArray() {
		Object[] array = new Object[size()];
		int index = 0;
		for (K key : this)
			array[index++] = key;
		return array;
	}

	public <T> T[] toArray(T[] a) {
		if (a.length < size())
			throw new IllegalArgumentException();
		int index = 0;
		for (K key : this)
			a[index++] = (T) key;
		return a;
	}

	public boolean add(K k) {
		if (k == null)
			throw new NullPointerException();
		if (contains(k))
			return false;
		root = root.insert(createNode(k));
		return true;
	}

	protected Node createNode(K k) {
		return new Node(k, rnd.nextLong());
	}

	public boolean remove(Object o) {
		if (!contains(o))
			return false;
		// noinspection unchecked
		root = root.erase((K) o);
		return true;
	}

	public boolean containsAll(Collection<?> c) {
		for (Object o : c) {
			if (!contains(o))
				return false;
		}
		return true;
	}

	public boolean addAll(Collection<? extends K> c) {
		return addAll((Iterable<? extends K>) c);
	}

	public boolean retainAll(Collection<?> c) {
		List<K> toRemove = new ArrayList<K>();
		for (K key : this) {
			if (!c.contains(key))
				toRemove.add(key);
		}
		return removeAll(toRemove);
	}

	public boolean removeAll(Collection<?> c) {
		boolean result = false;
		for (Object o : c)
			result |= remove(o);
		return result;
	}

	public void clear() {
		retainAll(Collections.<Object> emptySet());
	}

	public NavigableSet<K> descendingSet() {
		throw new UnsupportedOperationException();
	}

	public Iterator<K> descendingIterator() {
		return new Iterator<K>() {
			private K current = last();

			public boolean hasNext() {
				return current != null;
			}

			public K next() {
				K result = current;
				current = lower(current);
				return result;
			}

			public void remove() {
				TreapSet.this.remove(current);
			}
		};
	}

	public NavigableSet<K> subSet(K fromElement, boolean fromInclusive,
			K toElement, boolean toInclusive) {
		return new TreapSet<K>(fromElement, toElement, fromInclusive,
				toInclusive, comparator, root, nullNode);
	}

	public NavigableSet<K> headSet(K toElement, boolean inclusive) {
		return subSet(null, false, toElement, inclusive);
	}

	public NavigableSet<K> tailSet(K fromElement, boolean inclusive) {
		return subSet(fromElement, inclusive, null, false);
	}

	public Comparator<? super K> comparator() {
		return comparator;
	}

	public SortedSet<K> subSet(K fromElement, K toElement) {
		return subSet(fromElement, true, toElement, false);
	}

	public SortedSet<K> headSet(K toElement) {
		return subSet(null, false, toElement, false);
	}

	public SortedSet<K> tailSet(K fromElement) {
		return tailSet(fromElement, true);
	}

	public K first() {
		if (isEmpty())
			return null;
		if (from == null)
			return root.first().key;
		if (fromInclusive)
			return ceiling(from);
		return higher(from);
	}

	public K last() {
		if (isEmpty())
			return null;
		if (to == null)
			return root.last().key;
		if (toInclusive)
			return floor(to);
		return lower(to);
	}

	protected int compare(K first, K second) {
		if (first == null || second == null)
			return -1;
		if (comparator != null)
			return comparator.compare(first, second);
		// noinspection unchecked
		return ((Comparable<? super K>) first).compareTo(second);
	}

	protected class Node {
		protected final K key;
		protected final long priority;
		protected Node left;
		protected Node right;
		protected int size;

		protected Node(K key, long priority) {
			this.key = key;
			this.priority = priority;
			left = nullNode;
			right = nullNode;
			size = 1;
		}

		protected Object[] split(K key) {
			if (compare(key, this.key) < 0) {
				Object[] result = left.split(key);
				left = (Node) result[1];
				result[1] = this;
				updateSize();
				return result;
			}
			Object[] result = right.split(key);
			right = (Node) result[0];
			result[0] = this;
			updateSize();
			return result;
		}

		protected void updateSize() {
			size = left.size + right.size + 1;
		}

		protected Node insert(Node node) {
			if (node.priority > priority) {
				Object[] result = split(node.key);
				node.left = (Node) result[0];
				node.right = (Node) result[1];
				node.updateSize();
				return node;
			}
			if (compare(node.key, this.key) < 0) {
				left = left.insert(node);
				updateSize();
				return this;
			}
			right = right.insert(node);
			updateSize();
			return this;
		}

		protected Node merge(Node left, Node right) {
			if (left == nullNode)
				return right;
			if (right == nullNode)
				return left;
			if (left.priority > right.priority) {
				left.right = left.right.merge(left.right, right);
				left.updateSize();
				return left;
			}
			right.left = right.left.merge(left, right.left);
			right.updateSize();
			return right;
		}

		protected Node erase(K key) {
			int value = compare(key, this.key);
			if (value == 0)
				return merge(left, right);
			if (value < 0) {
				left = left.erase(key);
				updateSize();
				return this;
			}
			right = right.erase(key);
			updateSize();
			return this;
		}

		protected Node lower(K key) {
			if (compare(key, this.key) <= 0)
				return left.lower(key);
			Node result = right.lower(key);
			if (result == nullNode)
				return this;
			return result;
		}

		protected Node floor(K key) {
			if (compare(key, this.key) < 0)
				return left.floor(key);
			Node result = right.floor(key);
			if (result == nullNode)
				return this;
			return result;
		}

		protected Node higher(K key) {
			if (compare(key, this.key) >= 0)
				return right.higher(key);
			Node result = left.higher(key);
			if (result == nullNode)
				return this;
			return result;
		}

		protected Node ceil(K key) {
			if (compare(key, this.key) > 0)
				return right.ceil(key);
			Node result = left.ceil(key);
			if (result == nullNode)
				return this;
			return result;
		}

		protected Node first() {
			if (left == nullNode)
				return this;
			return left.first();
		}

		protected Node last() {
			if (right == nullNode)
				return this;
			return right.last();
		}

		protected Node search(K key) {
			int value = compare(key, this.key);
			if (value == 0)
				return this;
			if (value < 0)
				return left.search(key);
			return right.search(key);
		}

		public int indexOf(Node node) {
			if (this == node)
				return left.size;
			if (compare(node.key, this.key) > 0)
				return left.size + 1 + right.indexOf(node);
			return left.indexOf(node);
		}

	}

	private class NullNode extends Node {
		private Object[] splitResult = new Object[2];

		private NullNode() {
			super(null, Long.MIN_VALUE);
			left = this;
			right = this;
			size = 0;
		}

		protected Object[] split(K key) {
			splitResult[0] = splitResult[1] = this;
			return splitResult;
		}

		protected Node insert(Node node) {
			return node;
		}

		protected Node erase(K key) {
			return this;
		}

		protected Node lower(K key) {
			return this;
		}

		protected Node floor(K key) {
			return this;
		}

		protected Node higher(K key) {
			return this;
		}

		protected Node ceil(K key) {
			return this;
		}

		protected Node first() {
			throw new NoSuchElementException();
		}

		protected Node last() {
			throw new NoSuchElementException();
		}

		protected void updateSize() {
		}

		protected Node search(K key) {
			return this;
		}

	}
}

class EHashMap<E, V> extends AbstractMap<E, V> {
	private static final int[] shifts = new int[10];

	private int size;
	private HashEntry<E, V>[] data;
	private int capacity;
	private Set<Entry<E, V>> entrySet;

	static {
		Random random = new Random(System.currentTimeMillis());
		for (int i = 0; i < 10; i++)
			shifts[i] = 1 + 3 * i + random.nextInt(3);
	}

	public EHashMap() {
		this(4);
	}

	private void setCapacity(int size) {
		capacity = Integer.highestOneBit(4 * size);
		// noinspection unchecked
		data = new HashEntry[capacity];
	}

	public EHashMap(int maxSize) {
		setCapacity(maxSize);
		entrySet = new AbstractSet<Entry<E, V>>() {
			public Iterator<Entry<E, V>> iterator() {
				return new Iterator<Entry<E, V>>() {
					private HashEntry<E, V> last = null;
					private HashEntry<E, V> current = null;
					private HashEntry<E, V> base = null;
					private int lastIndex = -1;
					private int index = -1;

					public boolean hasNext() {
						if (current == null) {
							for (index++; index < capacity; index++) {
								if (data[index] != null) {
									base = current = data[index];
									break;
								}
							}
						}
						return current != null;
					}

					public Entry<E, V> next() {
						if (!hasNext())
							throw new NoSuchElementException();
						last = current;
						lastIndex = index;
						current = current.next;
						if (base.next != last)
							base = base.next;
						return last;
					}

					public void remove() {
						if (last == null)
							throw new IllegalStateException();
						size--;
						if (base == last)
							data[lastIndex] = last.next;
						else
							base.next = last.next;
					}
				};
			}

			public int size() {
				return size;
			}
		};
	}

	public Set<Entry<E, V>> entrySet() {
		return entrySet;
	}

	public void clear() {
		Arrays.fill(data, null);
		size = 0;
	}

	private int index(Object o) {
		return getHash(o.hashCode()) & (capacity - 1);
	}

	private int getHash(int h) {
		int result = h;
		for (int i : shifts)
			result ^= h >>> i;
		return result;
	}

	public V remove(Object o) {
		if (o == null)
			return null;
		int index = index(o);
		HashEntry<E, V> current = data[index];
		HashEntry<E, V> last = null;
		while (current != null) {
			if (current.key.equals(o)) {
				if (last == null)
					data[index] = current.next;
				else
					last.next = current.next;
				size--;
				return current.value;
			}
			last = current;
			current = current.next;
		}
		return null;
	}

	public V put(E e, V value) {
		if (e == null)
			return null;
		int index = index(e);
		HashEntry<E, V> current = data[index];
		if (current != null) {
			while (true) {
				if (current.key.equals(e)) {
					V oldValue = current.value;
					current.value = value;
					return oldValue;
				}
				if (current.next == null)
					break;
				current = current.next;
			}
		}
		if (current == null)
			data[index] = new HashEntry<E, V>(e, value);
		else
			current.next = new HashEntry<E, V>(e, value);
		size++;
		if (2 * size > capacity) {
			HashEntry<E, V>[] oldData = data;
			setCapacity(size);
			for (HashEntry<E, V> entry : oldData) {
				while (entry != null) {
					HashEntry<E, V> next = entry.next;
					index = index(entry.key);
					entry.next = data[index];
					data[index] = entry;
					entry = next;
				}
			}
		}
		return null;
	}

	public V get(Object o) {
		if (o == null)
			return null;
		int index = index(o);
		HashEntry<E, V> current = data[index];
		while (current != null) {
			if (current.key.equals(o))
				return current.value;
			current = current.next;
		}
		return null;
	}

	public boolean containsKey(Object o) {
		if (o == null)
			return false;
		int index = index(o);
		HashEntry<E, V> current = data[index];
		while (current != null) {
			if (current.key.equals(o))
				return true;
			current = current.next;
		}
		return false;
	}

	public int size() {
		return size;
	}

	private static class HashEntry<E, V> implements Entry<E, V> {
		private final E key;
		private V value;
		private HashEntry<E, V> next;

		private HashEntry(E key, V value) {
			this.key = key;
			this.value = value;
		}

		public E getKey() {
			return key;
		}

		public V getValue() {
			return value;
		}

		public V setValue(V value) {
			V oldValue = this.value;
			this.value = value;
			return oldValue;
		}
	}
}

abstract class IntervalTree {
	protected int size;

	public IntervalTree(int size, boolean shouldInit) {
		this.size = size;
		int nodeCount = Math.max(1, Integer.highestOneBit(size) << 2);
		initData(size, nodeCount);
		if (shouldInit)
			init();
	}

	protected abstract void initData(int size, int nodeCount);

	protected abstract void initAfter(int root, int left, int right, int middle);

	protected abstract void initBefore(int root, int left, int right, int middle);

	protected abstract void initLeaf(int root, int index);

	protected abstract void updatePostProcess(int root, int left, int right,
			int from, int to, long delta, int middle);

	protected abstract void updatePreProcess(int root, int left, int right,
			int from, int to, long delta, int middle);

	protected abstract void updateFull(int root, int left, int right, int from,
			int to, long delta);

	protected abstract long queryPostProcess(int root, int left, int right,
			int from, int to, int middle, long leftResult, long rightResult);

	protected abstract void queryPreProcess(int root, int left, int right,
			int from, int to, int middle);

	protected abstract long queryFull(int root, int left, int right, int from,
			int to);

	protected abstract long emptySegmentResult();

	public void init() {
		if (size == 0)
			return;
		init(0, 0, size - 1);
	}

	private void init(int root, int left, int right) {
		if (left == right) {
			initLeaf(root, left);
		} else {
			int middle = (left + right) >> 1;
			initBefore(root, left, right, middle);
			init(2 * root + 1, left, middle);
			init(2 * root + 2, middle + 1, right);
			initAfter(root, left, right, middle);
		}
	}

	public void update(int from, int to, long delta) {
		update(0, 0, size - 1, from, to, delta);
	}

	protected void update(int root, int left, int right, int from, int to,
			long delta) {
		if (left > to || right < from)
			return;
		if (left >= from && right <= to) {
			updateFull(root, left, right, from, to, delta);
			return;
		}
		int middle = (left + right) >> 1;
		updatePreProcess(root, left, right, from, to, delta, middle);
		update(2 * root + 1, left, middle, from, to, delta);
		update(2 * root + 2, middle + 1, right, from, to, delta);
		updatePostProcess(root, left, right, from, to, delta, middle);
	}

	public long query(int from, int to) {
		return query(0, 0, size - 1, from, to);
	}

	protected long query(int root, int left, int right, int from, int to) {
		if (left > to || right < from)
			return emptySegmentResult();
		if (left >= from && right <= to)
			return queryFull(root, left, right, from, to);
		int middle = (left + right) >> 1;
		queryPreProcess(root, left, right, from, to, middle);
		long leftResult = query(2 * root + 1, left, middle, from, to);
		long rightResult = query(2 * root + 2, middle + 1, right, from, to);
		return queryPostProcess(root, left, right, from, to, middle,
				leftResult, rightResult);
	}
}

abstract class LongIntervalTree extends IntervalTree {
	protected long[] value;
	protected long[] delta;

	protected LongIntervalTree(int size) {
		this(size, true);
	}

	public LongIntervalTree(int size, boolean shouldInit) {
		super(size, shouldInit);
	}

	protected void initData(int size, int nodeCount) {
		value = new long[nodeCount];
		delta = new long[nodeCount];
	}

	protected abstract long joinValue(long left, long right);

	protected abstract long joinDelta(long was, long delta);

	protected abstract long accumulate(long value, long delta, int length);

	protected abstract long neutralValue();

	protected abstract long neutralDelta();

	protected long initValue(int index) {
		return neutralValue();
	}

	protected void initAfter(int root, int left, int right, int middle) {
		value[root] = joinValue(value[2 * root + 1], value[2 * root + 2]);
		delta[root] = neutralDelta();
	}

	protected void initBefore(int root, int left, int right, int middle) {
	}

	protected void initLeaf(int root, int index) {
		value[root] = initValue(index);
		delta[root] = neutralDelta();
	}

	protected void updatePostProcess(int root, int left, int right, int from,
			int to, long delta, int middle) {
		value[root] = joinValue(value[2 * root + 1], value[2 * root + 2]);
	}

	protected void updatePreProcess(int root, int left, int right, int from,
			int to, long delta, int middle) {
		pushDown(root, left, middle, right);
	}

	protected void pushDown(int root, int left, int middle, int right) {
		value[2 * root + 1] = accumulate(value[2 * root + 1], delta[root],
				middle - left + 1);
		value[2 * root + 2] = accumulate(value[2 * root + 2], delta[root],
				right - middle);
		delta[2 * root + 1] = joinDelta(delta[2 * root + 1], delta[root]);
		delta[2 * root + 2] = joinDelta(delta[2 * root + 2], delta[root]);
		delta[root] = neutralDelta();
	}

	protected void updateFull(int root, int left, int right, int from, int to,
			long delta) {
		value[root] = accumulate(value[root], delta, right - left + 1);
		this.delta[root] = joinDelta(this.delta[root], delta);
	}

	protected long queryPostProcess(int root, int left, int right, int from,
			int to, int middle, long leftResult, long rightResult) {
		return joinValue(leftResult, rightResult);
	}

	protected void queryPreProcess(int root, int left, int right, int from,
			int to, int middle) {
		pushDown(root, left, middle, right);
	}

	protected long queryFull(int root, int left, int right, int from, int to) {
		return value[root];
	}

	protected long emptySegmentResult() {
		return neutralValue();
	}
}


import java.util.*;
public class A988 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
        int st = scan.nextInt();
        int h, c = 0;
        boolean[] ar = new boolean[101];
        int[] res = new int[101];
        for(int i = 0; i < num; i++){
            h = scan.nextInt();
            if(!ar[h]){
            	res[c++] = i+1;
            	ar[h] = true;
            }
        }
        if(c < st){
            System.out.print("NO");
            return;
        }
        System.out.println("YES");
        for(int i = 0; i < st-1; i++)
            System.out.print(res[i] + " ");
        System.out.print(res[st-1]);
	}
}


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

/**
 * Created by sbabkin on 9/14/2015.
 */
public class SolverB {

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

    BufferedReader br;
    PrintWriter pw;
    StringTokenizer stok;

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

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

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

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

    private void Run() throws IOException {
//        br = new BufferedReader(new FileReader("input.txt"));
//        pw = new PrintWriter("output.txt");
        br=new BufferedReader(new InputStreamReader(System.in));
        pw=new PrintWriter(new OutputStreamWriter(System.out));

        solve();
        pw.flush();
        pw.close();
    }

    int n;
    int m;
    boolean[] used;
    int[] result;
    int[] inds;

    private void solve() throws IOException {
        n = nextInt();
        m = nextInt();
        used = new boolean[101];
        result = new int[n + 1];
        inds = new int[m];
        for (int i = 0; i < m; i++) {
            inds[i] = nextInt();
        }
        for (int i = 0; i < m - 1; i++) {
            int next = (inds[i + 1] + n - inds[i] - 1) % n + 1;
            if (next > n) {
                pw.println(-1);
                return;
            }
            if (result[inds[i]] > 0 && next != result[inds[i]]) {
                pw.println(-1);
                return;
            }
            if (used[next] && result[inds[i]]==0) {
                pw.println(-1);
                return;
            }
            result[inds[i]]=next;
            used[next]=true;
        }
        int ui = 1;
        for (int i=1; i<=n; i++) {
            if (result[i]==0) {
                while (used[ui]) {
                    ui++;
                }
                result[i]=ui;
                used[ui]=true;
            }
        }
        for (int i=1; i<=n; i++) {
            pw.print(result[i] + " ");
        }
        pw.println();
    }

}


import java.util.*;

public class Bishok {
        static int count = 0;
        public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        String up = sc.nextLine();
        String dn = sc.nextLine();

        int empty = 0;
        int ans = 0;
        for(int i=0;i<up.length();i++) {
            if(up.charAt(i) == '0') {
                empty++;
            }

            if(dn.charAt(i) == '0') {
                empty++;
            }

            if(empty>=3) {
                empty -= 3;
                ans++;
            } else {
                empty = 0;
                if(up.charAt(i) == '0') {
                    empty++;
                }
                if(dn.charAt(i) == '0') {
                    empty++;
                }
            }
        }
        System.out.println(ans);
    }
}


import java.util.Scanner;

public class A {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int c = in.nextInt();
        int res = 0;
        int[] A = new int[n];
        for (int i = 0; i < n; i++)
            A[i] = in.nextInt();
        for (int i = 1; i < n; i++)
            res = Math.max(A[i - 1] - A[i] - c, res);
        System.out.println(res);
    }
}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 * @author flk
 */
public class Main {
    public static void main(String[] args) throws IOException {
        InputStream inputStream = System.in;
        //OutputStream outputStream = System.out;
        //BufferedOutputStream buffered = new BufferedOutputStream(outputStream);
        BufferedOutputStream buffered = new BufferedOutputStream(System.out);
        //Scanner in = new Scanner(inputStream);
        Reader in = new Reader(); in.init(inputStream);
        PrintWriter out = new PrintWriter(buffered);
        Task solver = new Task();
        solver.solve(1, in, out);
        out.close();
    }
}

class Task {

    public void solve(int testNumber, Reader in, PrintWriter out) throws IOException {

        int A = in.nextInt();
        int B = in.nextInt();

        ArrayList<Integer> seq = new ArrayList<Integer>();
        seq.add(B);
        while (B > A) {
            if (B % 2 == 0) {
                B = B/2;
            }
            else if (B % 10 == 1) {
                B = B/10;
            }
            else break;
            seq.add(B);
        }

        if (A == B) {
            out.println("YES");
            out.println(seq.size());
            for (int i = seq.size()-1; i>=0 ; i--) {
                out.print(seq.get(i));
                out.print(" ");
            }
        }
        else {
            out.println("NO");
        }

        //      out.print(sb);
    }

}

/** Class for buffered reading int and double values */
class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

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

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

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

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

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


import java.util.Scanner;

public class G {
	static final long mod = 1000000007;
	static Integer[][] memo = new Integer[4005][4005];
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		int Y = sc.nextInt();
		long add = 0, sub =0;

		long combs = (X+1L)*(Y+1L);
		long oo = ((X+1)>>1) * ((Y+1)>>1);
		long oe = ((X+1)>>1) * ((Y+2)>>1);
		long eo = ((X+2)>>1) * ((Y+1)>>1);
		long ee = ((X+2)>>1) * ((Y+2)>>1);

		//two
		add+=trip(ee,ee-1,combs-ee);
		add+=trip(eo,eo-1,combs-eo);
		add+=trip(oe,oe-1,combs-oe);
		add+=trip(oo,oo-1,combs-oo);
		add*=3;

		//three
		add+=trip(ee,ee-1,ee-2);
		add+=trip(eo,eo-1,eo-2);
		add+=trip(oe,oe-1,oe-2);
		add+=trip(oo,oo-1,oo-2);

		for (int x = -X; x <= X; x++) {
			for (int y = 0; y <= Y; y++) {
				if(x<=0 && y == 0) continue;
				long ways = GCD(Math.abs(y), Math.abs(x)) + 1;
				long pick = (X - Math.abs(x) + 1) * (Y - y + 1);
				long temp = (pick * (6*(ways-2))) % mod;
				if(temp>0){
					sub+=temp;
				}
			}

		}
		sub%=mod;
		add%=mod;

	//	System.out.println(add+" "+sub);
		System.out.println((((add-sub) % mod)+mod)%mod);
	}

	private static long trip(long A, long B, long C) {
		return (((A*B)%mod)*C)%mod;
	}

	private static Integer GCD(int a, int b) {
		if(memo[a][b]!=null)return memo[a][b];
		if (b == 0)	return memo[a][b]=a;
		return memo[a][b]=GCD(b, a % b);
	}
}


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

//System.out.println();
public class A
{
    public static int[] arr;
    public static int n, k;
    public static String s;
    public static void main(String[] args) throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] in = br.readLine().trim().split("\\s");
            n = Integer.parseInt(in[0]);
            k = Integer.parseInt(in[1]);

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

    public static int fn()
    {
        //System.out.println();
        //StringBuilder x = new StringBuilder(s);
        int rem = 240 - k;
        int ans = 0;
        for(int i = 1; i <= n; i++)
            if(5 * i <= rem){
                ans++;
                rem -= 5*i;
            }

        return ans;
    }

    public static int swap(int g1, int g2)
    {
        return g1;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class ProblemC {

	static final long MOD = 51123987;

	public static void main(String[] args) throws IOException {
		BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);

		int N = Integer.valueOf(s.readLine());
		char[] cl = s.readLine().toCharArray();

		List<Integer> arr = new ArrayList<Integer>();
		char prv = '-';
		for (char c : cl) {
			if (prv != c) {
				arr.add(c - 'a');
			}
			prv = c;
		}

		int len = arr.size();
		int[][] next = new int[len][3];
		for (int t = 0 ; t < len ; t++) {
			for (int d = 0 ; d <= 2 ; d++) {
				int ta = t;
				while (ta < len && arr.get(ta) != d) {
					ta++;
				}
				next[t][d] = ta;
			}
		}

		long[][][][] dp = new long[2][len+1][61][61];
		dp[0][0][0][0] = 1;
		for (int c = 0 ; c < N ; c++) {
			int fr = c % 2;
			int to = 1 - fr;
			for (int t = 0 ; t <= len ; t++) {
				for (int a = 0 ; a <= 60 ; a++) {
					Arrays.fill(dp[to][t][a], 0);
				}
			}
			for (int t = 0 ; t < len ; t++) {
				int ta = next[t][0];
				int tb = next[t][1];
				int tc = next[t][2];
				for (int a = 0 ; a <= 55 ; a++) {
					for (int b = 0 ; b <= 55 ; b++) {
						if (dp[fr][t][a][b] >= 1) {
							dp[to][ta][a+1][b] += dp[fr][t][a][b];
							dp[to][ta][a+1][b] %= MOD;

							dp[to][tb][a][b+1] += dp[fr][t][a][b];
							dp[to][tb][a][b+1] %= MOD;

							dp[to][tc][a][b] += dp[fr][t][a][b];
							dp[to][tc][a][b] %= MOD;
						}
					}
				}
			}
		}

		int fin = N % 2;
		long ptn = 0;
		for (int cu = 0 ; cu <= len - 1 ; cu++) {
			for (int a = 0 ; a <= 55 ; a++) {
				for (int b = 0 ; b <= 55 ; b++) {
					int c = N - a - b;
					if (c >= 0 && Math.abs(a - b) <= 1 && Math.abs(b - c) <= 1 && Math.abs(c - a) <= 1) {
						ptn += dp[fin][cu][a][b];
						ptn %= MOD;
					}
				}
			}
		}
		out.println(ptn);
		out.flush();
	}

	public static void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}
}


import java.io.File;
import java.io.IOException;
import java.util.Scanner;

/**
 *
 * @author USer
 */
public class CutRibbon {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
        Scanner r=new Scanner(System.in);
        int n=r.nextInt();
        int a=r.nextInt();
        int b=r.nextInt();
        int c=r.nextInt();
     int max=0;
    for(int i=0;i*a<=n;i++){
            for(int j=0;i*a+j*b<=n;j++){
            if((n-i*a-j*b)%c==0 && (n-i*a-j*b)/c+i+j>max)
                max=(n-i*a-j*b)/c+i+j;
        }
    }
    System.out.println(max);
}
}