//*******************************************************************
// Dear CompileJava users,
//
// CompileJava has been operating since 2013 completely free. If you
// find this site useful, or would otherwise like to contribute, then
// please consider a donation (link in 'More Info' tab) to support
// development of the new CompileJava website (stay tuned!).
//
// Most sincerely, Z.
//*******************************************************************

import java.lang.Math; // headers MUST be above the first class

// one class needs to have a main() method
public class HelloWorld
{
  // arguments are passed using the text field below this editor
  public static void main(String[] args)
  {
    Scanner nhapDuLieu = new Scanner(System.in);
    int n = nhapDuLieu.nextInt();
    int result = 0;
    if (n<10)
     	result = 1;
    else if (n%10 == 0)
    	result = 10 + LuckyYear(n/10)*10;
    else
      	result = LuckyYear(n);
	System.out.print(result);
  }

  public static int LuckyYear(int n)
  {
   	if (n/10 == 0)
    {
     	return 0;
    }
    else if (n%10 == 0){
      	return 9 + LuckyYear(n/10)*10;
    }
    else {
     	return (10 - n%10) + LuckyYear(n/10)*10;
    }
  }
}

// you can add other public classes to this editor in any order


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

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

/**
 *
 * @author Dhruv
 */
public class CF808A {
    public static void main(String args[]){
		Template.InputReader in = new Template.InputReader(System.in);
		//OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(System.out);
                int n=in.nextInt();
                String s=n+"";
                int c=0;
                int l=s.length();
                for(int i =1;i<l;i++){
                    if(s.charAt(i)=='0')
                        c++;
                    else break;
                }
                double ans=0;
                if(c==l-1)
                {
                    ans=Math.pow(10, l-1);
                }
                else
                {
                    ans=((s.charAt(0)-'0')+1)*Math.pow(10, l-1)-n;
                }
                out.println((int)ans);
		out.close();

    }
    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.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), current = n;
            while (!isHappy(++current)) ;
            out.printLine(current - n);
        }

        private boolean isHappy(int n) {
            while (n > 10) {
                if (n % 10 != 0) {
                    return false;
                }
                n /= 10;
            }
            return true;
//        char[] c = String.valueOf(n).toCharArray();
//        for (int i = c.length - 1; i > 1; --i) {
//            if (c[c.length - i + 1] != '0') {
//                return false;
//            }
//        }
//        return true;
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buffer = new byte[1024];
        private int current;
        private int size;

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

        private int read() {
            if (size == -1) throw new InputMismatchException();
            if (current >= size) {
                current = 0;
                try {
                    size = stream.read(buffer);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (size <= 0) return -1;
            }
            return buffer[current++];
        }

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

        private boolean isSpaceCharacter(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

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

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

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

    }
}


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

        int N = sc.nextInt();

        int T = Math.log10(N);
        System.out.print(N + (int) Math.pow(10, T));

    }
}


import java.util.*;

public class E {

    int p2[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
        2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144};

    boolean bitSetted(int code, int bitNo) {
        int tmp = code;
        for (int i = 0; i < bitNo; i++) {
            tmp /= 2;
        }
        return tmp % 2 == 1;
    }

    int clearBit(int code, int bitNo) {
        return code - p2[bitNo];
    }

    public static void main(String[] args) {
        new E().main();
    }
    int[][] gameLines = {
        // horizontal
        {0, 1, 2},
        {3, 4, 5, 6},
        {7, 8, 9, 10, 11},
        {12, 13, 14, 15},
        {16, 17, 18},
        // /-diag
        {7, 3, 0},
        {12, 8, 4, 1},
        {16, 13, 9, 5, 2},
        {17, 14, 10, 6},
        {18, 15, 11},
        // \-diag
        {2, 6, 11},
        {1, 5, 10, 15},
        {0, 4, 9, 14, 18},
        {3, 8, 13, 17},
        {7, 12, 16}
    };
    boolean sg_values[] = new boolean[530000];
    boolean calculated[] = new boolean[530000];
    int ccount = 1;

    boolean canDoMove(int position, int gameLineNo, int left, int right) {
        for (int i = left; i <= right; i++) {
            if (!bitSetted(position, gameLines[gameLineNo][i])) {
                return false;
            }
        }
        return true;
    }

    int doMove(int position, int gameLineNo, int left, int right) {
        int res = position;
        for (int i = left; i <= right; i++) {
            res = clearBit(res, gameLines[gameLineNo][i]);
        }
        return res;
    }

    ArrayList<Integer> inOneMove(Integer position) {
        ArrayList<Integer> res = new ArrayList<Integer>();

        for (int i = 0; i < gameLines.length; i++) {
            for (int left = 0; left < gameLines[i].length; left++) {
                for (int right = left; right < gameLines[i].length; right++) {
                    if (canDoMove(position, i, left, right)) {
                        res.add(doMove(position, i, left, right));
                    }
                }
            }
        }
        return res;
    }

    // false, если позиция проигрышная
    // true,  если выигрышная
    boolean SG(Integer position) {
        if (calculated[position]) {
            return sg_values[position];
        }
        //System.out.println("Calculating SG for " + position);
        boolean res = false;
        for (int x : inOneMove(position)) {
            if (!SG(x)){
                res = true;
                break;
            }
        }
        sg_values[position] = res;
        calculated[position] = true;
        return res;
    }

    void main() {
        String spos = "";
        Scanner in = new Scanner(System.in);
        for (int i = 0; i < 5; i++) {
            String line = in.nextLine();
            for (char c : line.toCharArray()) {
                if (c == '.' || c == 'O') {
                    spos += c;
                }
            }
        }
        int now = 0;
        for (int i = 0; i < spos.length(); i++) {
            if (spos.charAt(i) == 'O') {
                now += p2[i];
            }
        }
        sg_values[0] = false;
        calculated[0] = true;
        if (!SG(now)) {
            System.out.println("Lillebror");
        } else {
            System.out.println("Karlsson");
        }
    }
}


import java.util.*;

public class E {

    int p2[] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
        2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144};

    boolean bitSetted(int code, int bitNo) {
        int tmp = code;
        for (int i = 0; i < bitNo; i++) {
            tmp /= 2;
        }
        return tmp % 2 == 1;
    }

    int clearBit(int code, int bitNo) {
        return code - p2[bitNo];
    }

    public static void main(String[] args) {
        new E().main();
    }
    int[][] gameLines = {
        // horizontal
        {0, 1, 2},
        {3, 4, 5, 6},
        {7, 8, 9, 10, 11},
        {12, 13, 14, 15},
        {16, 17, 18},
        // /-diag
        {7, 3, 0},
        {12, 8, 4, 1},
        {16, 13, 9, 5, 2},
        {17, 14, 10, 6},
        {18, 15, 11},
        // \-diag
        {2, 6, 11},
        {1, 5, 10, 15},
        {0, 4, 9, 14, 18},
        {3, 8, 13, 17},
        {7, 12, 16}
    };
    int sg_values[] = new int[530000];

    boolean canDoMove(int position, int gameLineNo, int left, int right) {
        for (int i = left; i <= right; i++) {
            if (!bitSetted(position, gameLines[gameLineNo][i])) {
                return false;
            }
        }
        return true;
    }

    int doMove(int position, int gameLineNo, int left, int right) {
        int res = position;
        for (int i = left; i <= right; i++) {
            res = clearBit(res, gameLines[gameLineNo][i]);
        }
        return res;
    }

    ArrayList<Integer> inOneMove(Integer position) {
        ArrayList<Integer> res = new ArrayList<Integer>();

        for (int i = 0; i < gameLines.length; i++) {
            for (int left = 0; left < gameLines[i].length; left++) {
                for (int right = left; right < gameLines[i].length; right++) {
                    if (canDoMove(position, i, left, right)) {
                        res.add(doMove(position, i, left, right));
                    }
                }
            }
        }
        return res;
    }

    // false, если позиция проигрышная
    // true,  если выигрышная
    int SG(Integer position) {
        if (sg_values[position]!=0){
            return sg_values[position];
        }
        //System.out.println("Calculating SG for " + position);
        int res = -1;
        for (int x : inOneMove(position)) {
            if (SG(x)==-1){
                res = 1;
                break;
            }
        }
        sg_values[position] = res;
        return res;
    }

    void main() {
        String spos = "";
        Scanner in = new Scanner(System.in);
        for (int i = 0; i < 5; i++) {
            String line = in.nextLine();
            for (char c : line.toCharArray()) {
                if (c == '.' || c == 'O') {
                    spos += c;
                }
            }
        }
        int now = 0;
        for (int i = 0; i < spos.length(); i++) {
            if (spos.charAt(i) == 'O') {
                now += p2[i];
            }
        }
        sg_values[0] = -1;
        if (SG(now)==-1) {
            System.out.println("Lillebror");
        } else {
            System.out.println("Karlsson");
        }
    }
}


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

public class Main {

	BufferedReader in;
	StringTokenizer str = null;
	PrintWriter out;

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

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

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

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

	int []dp;
	int n = 5, m = 9;
	int []x,y;

	public void run() throws Exception{
		in =  new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		char [][]a = new char[n][];
		for(int i=0;i<n;i++) {
			// String x = in.readLine();
			// while(x.length() < m) x+=" ";
			a[i] = in.readLine().toCharArray();
		}

		x = new int[19];
		y = new int[19];
		int at = 0;
		for(int i=0;i<n;i++){
			for(int j=0;j<a[i].length;j++){
				if (a[i][j] != ' ') {
					x[at] = i;
					y[at++] = j;
				}
			}
		}

		// print(a);

		dp = new int[1 << 19];
		Arrays.fill(dp, -1);

		int mask = encode(a);
		// print(decode(mask));
		boolean r = dfs(mask);

		if (r) out.println("Karlsson");
		else out.println("Lillebror");
		// out.println("{");
		// for(int i=0;i<1<<19;i++){
		// 	if (dp[i] == -1) {
		// 		dfs(i);
		// 	}
		// 	out.print(dp[i]+",");
		// }
		// out.println("}");
		out.close();
	}

	int di[] = new int[]{0,  0, 1, -1, 1,  1, -1, -1};
	int dj[] = new int[]{2, -2, 0,  0, 1, -1, -1,  1};

	private boolean dfs(int mask) {
		if (mask == 0) return false;
		if (dp[mask] != -1) return dp[mask] > 0;

		// System.out.println(mask);

		char [][]a = decode(mask);
		char [][]b;
		for(int i=0;i<19;i++){
			if (a[x[i]][y[i]] == 'O') {
				for(int k=0;k<di.length;k++){
					int ni = x[i], nj = y[i];
					b = copy(a);
					while(inRange(ni, nj) && b[ni][nj] == 'O') {
						b[ni][nj] = '.';
						int nmask = encode(b);
						// System.out.println("from ");
						// print(a);
						// System.out.println("to ");
						// print(b);
						if (!dfs(nmask)) {
							dp[mask] = 1;
							return true;
						}
						ni+=di[k];
						nj+=dj[k];
					}
				}
			}
		}

		dp[mask] = 0;
		return false;
	}

	private boolean inRange(int i, int j) {
		if (i < 0 || j < 0) return false;
		if (i >= n || j >= m) return false;
		return true;
	}

	private void print(char [][]a) {
		for(int i=0;i<n;i++) System.out.println(Arrays.toString(a[i]));
		System.out.println();
	}

	private char[][] copy(char [][]a) {
		char [][]b = a.clone();
		for(int i=0;i<n;i++) {
			b[i] = b[i].clone();
		}
		return b;
	}

	private int encode(char [][]a) {
		int mask = 0;
		for(int i=0;i<19;i++){
			if (a[x[i]][y[i]] == 'O') {
				mask|=1<<i;
			}
		}
		return mask;
	}

	private char[][] decode(int mask) {
		char [][]r = new char[n][m];
		for(int i=0;i<19;i++){
			if ((mask & (1 << i)) > 0) {
				r[x[i]][y[i]] = 'O';
			}else {
				r[x[i]][y[i]] = '.';
			}
		}
		return r;
	}

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


   1. import java.util.*;
   2. import java.io.*;
   3. import static java.lang.Math.*;
   4.

   5. public class Main{
   6.     public static void main(String[] args) throws Exception{
   7.         new Main().run();
   8.     }
   9.

  10.     int[][] dp = new int[2][1<<19];
  11.     final int[] dh = new int[]{0, 3, 7, 12, 16};
  12.     final int[] dw = new int[]{3, 4, 5, 4, 3};
  13.     boolean firstWin(int p, boolean[] u){
  14.         int mask = toi(u);
  15.         if(mask == 0){
  16.             return p == 1;
  17.         }
  18.         if(dp[p][mask] != 0)return dp[p][mask] == 1;
  19.         boolean ok = false;
  20.         loop:
  21.         for(int i = 0; i < 5; i++){
  22.             for(int j = 0; j < dw[i]; j++){
  23.                 int k = dh[i] + j;
  24.                 if(!u[k])continue;
  25.                 boolean[] v = new boolean[u.length];
  26.                 for(int a = 0; a < v.length; a++)v[a] = u[a];
  27.                 int cy = i, cx = j;
  28.                 for(;;){
  29.                     int ind = dh[cy] + cx;
  30.                     v[ind] = false;
  31.                     boolean ret = firstWin(1-p, v);
  32.                     if(p == 0 && ret){
  33.                         ok = true;
  34.                         break loop;
  35.                     }else if(p == 1 && !ret){
  36.                         ok = true;
  37.                         break loop;
  38.                     }
  39.                     cy++;
  40.                     if(cy > 2)cx--;
  41.                     if(cy >= 5 || cx < 0 || cx >= dw[cy] || !u[dh[cy] + cx])break;
  42.                 }
  43.

  44.                 v = new boolean[u.length];
  45.                 for(int a = 0; a < v.length; a++)v[a] = u[a];
  46.                 cy = i; cx = j;
  47.                 for(;;){
  48.                     int ind = dh[cy] + cx;
  49.                     v[ind] = false;
  50.                     boolean ret = firstWin(1-p, v);
  51.                     if(p == 0 && ret){
  52.                         ok = true;
  53.                         break loop;
  54.                     }else if(p == 1 && !ret){
  55.                         ok = true;
  56.                         break loop;
  57.                     }
  58.                     cy++;
  59.                     if(cy < 3)cx++;
  60.                     if(cy >= 5 || cx < 0 || cx >= dw[cy] || !u[dh[cy] + cx])break;
  61.                 }
  62.

  63.                 v = new boolean[u.length];
  64.                 for(int a = 0; a < v.length; a++)v[a] = u[a];
  65.                 cy = i; cx = j;
  66.                 for(;;){
  67.                     int ind = dh[cy] + cx;
  68.                     v[ind] = false;
  69.                     boolean ret = firstWin(1-p, v);
  70.                     if(p == 0 && ret){
  71.                         ok = true;
  72.                         break loop;
  73.                     }else if(p == 1 && !ret){
  74.                         ok = true;
  75.                         break loop;
  76.                     }
  77.                     cx++;
  78.                     if(cy >= 5 || cx >= dw[cy] || !u[dh[cy] + cx])break;
  79.                 }
  80.

  81.             }
  82.         }
  83.         if(p == 0){
  84.             if(ok){
  85.                 dp[p][mask] = 1;
  86.                 return true;
  87.             }else{
  88.                 dp[p][mask] = -1;
  89.                 return false;
  90.             }
  91.         }else{
  92.             if(ok){
  93.                 dp[p][mask] = -1;
  94.                 return false;
  95.             }else{
  96.                 dp[p][mask] = 1;
  97.                 return true;
  98.             }
  99.         }
 100.     }
 101.

 102.

 103.     int toi(boolean[] u){
 104.         int ret = 0;
 105.         for(int i = 0; i < u.length; i++)if(u[i])ret += 1 << i;
 106.         return ret;
 107.     }
 108.

 109.     void run() throws Exception{
 110.         Scanner sc = new Scanner(System.in);
 111.         //BufferedReader sc = new BufferedReader(new InputStreamReader(System.in));
 112.         // only sc.readLine() is available
 113.         boolean[] u = new boolean[19];
 114.         for(int i = 0; i < 19; i++)u[i] = sc.next().equals("O");
 115.         boolean ret = firstWin(0, u);
 116.         System.out.println(ret ? "Karlsson" : "Lillebror");
 117.     }
 118. }


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

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

    static class TaskD {
        static int smallest;
        static long[] memo;
        static int mod = 1000_000_007;

        static void smallest() {
            int n = (int) 5e6 + 10;
            smallest = new int[n + 1];
            Arrays.fill(smallest, Integer.MAX_VALUE);
            boolean primes[] = new boolean[n + 1];
            Arrays.fill(primes, true);
            primes[0] = primes[1] = false;
            for (int i = 2; i * i <= n; i++)
                if (primes[i]) {
                    smallest[i] = i;
                    for (int j = 2; i * j <= n; j++) {
                        primes[i * j] = false;
                        smallest[i * j] = Math.min(smallest[i * j], i);
                    }
                }

        }

        static long f(int x) {
            if (x == 1) return 0;
            if (memo[x] != -1) return memo[x];
            long sm = smallest[x];
            return memo[x] = ((((sm * (sm - 1) / 2) % mod) * (x / sm) % mod) + f(x / (int) sm)) % mod;
        }

        public void solve(int testNumber, Scanner sc, PrintWriter out) {
            smallest();
            memo = new long[(int) 5e6 + 10];
            Arrays.fill(memo, -1);
            int t = sc.nextInt(), l = sc.nextInt(), r = sc.nextInt();
            long res = 0;
            for (int i = l, pow = 0; i <= r; i++, pow++) {
                res += (modular_exponentiation(t, pow, mod) * f(i) % mod);
                if (res >= mod) res -= mod;
            }
            out.println(res);
        }

        public static long modular_exponentiation(long a, long b, int c) {
            long ans = 1L;
            while (b != 0) {
                if ((b & (1)) == 1)
                    ans = (ans * a) % c;

                a = (a * a) % c;
                b >>= 1L;
            }

            return ans;
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

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

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

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

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

    }
}


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

public class icpc
{
    public static void main(String[] args) throws IOException
    {
        Reader in = new Reader();
        //BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        long t = in.nextLong();
        int l = in.nextInt();
        int r = in.nextInt();
        long M = (long)1e9 + 7;
        int[] sieve = new NumberTheory().sieveOfEratosthenes(r);
        long[] dp = new long[r + 1];
        dp[1] = 0L;
        long[] pow = new long[r + 1];
        pow[0] = 1L;
        pow[1] = t % M;
        for (int i=2;i<=r;i++)
        {
            pow[i] = (pow[i - 1] * t) % M;
            dp[i] = (1L * i * (i - 1)) / 2;
            for (int j=2;j*j<=i;j++)
            {
                if (i % j == 0)
                {
                    if (sieve[j] == 0)
                    {
                        long f1 = (long)i / j;
                        long x = dp[j] * f1 + dp[(int)f1];
                        dp[i] = Math.min(dp[i], x);
                    }
                    if (sieve[i / j] == 0)
                    {
                        long f1 = (long)i / j;
                        long x = dp[j] * f1 + dp[(int)f1];
                        dp[i] = Math.min(dp[i], x);
                    }
                }
            }
        }
        long ans = 0L;
        for (int i=l;i<=r;i++)
        {
            ans = (ans + (pow[i - l] * (dp[i]) % M)) % M) % M;
        }
        System.out.println(ans);
    }
}
class DSU
{
    int[] parent;
    int[] size;
    //Pass number of total nodes as parameter to the constructor
    DSU(int n)
    {
        this.parent = new int[n];
        this.size = new int[n];
        Arrays.fill(parent, -1);
    }

    public void makeSet(int v)
    {
        parent[v] = v;
        size[v] = 1;
    }

    public int findSet(int v)
    {
        if (v == parent[v]) return v;
        return parent[v] = findSet(parent[v]);
    }

    public void unionSets(int a, int b)
    {
        a = findSet(a);
        b = findSet(b);
        if (a != b)
        {
            if (size[a] < size[b])
            {
                int temp = a;
                a = b;
                b = temp;
            }
            parent[b] = a;
            size[a] += size[b];
        }
    }
}
class FastFourierTransform
{
    private void fft(double[] a, double[] b, boolean invert)
    {
        int count = a.length;
        for (int i = 1, j = 0; i < count; i++)
        {
            int bit = count >> 1;
            for (; j >= bit; bit >>= 1)
                j -= bit;
            j += bit;
            if (i < j)
            {
                double temp = a[i];
                a[i] = a[j];
                a[j] = temp;
                temp = b[i];
                b[i] = b[j];
                b[j] = temp;
            }
        }
        for (int len = 2; len <= count; len <<= 1)
        {
            int halfLen = len >> 1;
            double angle = 2 * Math.PI / len;
            if (invert)
                angle = -angle;
            double wLenA = Math.cos(angle);
            double wLenB = Math.sin(angle);
            for (int i = 0; i < count; i += len)
            {
                double wA = 1;
                double wB = 0;
                for (int j = 0; j < halfLen; j++)
                {
                    double uA = a[i + j];
                    double uB = b[i + j];
                    double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
                    double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
                    a[i + j] = uA + vA;
                    b[i + j] = uB + vB;
                    a[i + j + halfLen] = uA - vA;
                    b[i + j + halfLen] = uB - vB;
                    double nextWA = wA * wLenA - wB * wLenB;
                    wB = wA * wLenB + wB * wLenA;
                    wA = nextWA;
                }
            }
        }
        if (invert)
        {
            for (int i = 0; i < count; i++)
            {
                a[i] /= count;
                b[i] /= count;
            }
        }
    }

    public long[] multiply(long[] a, long[] b)
    {
        int resultSize = Integer.highestOneBit(Math.max(a.length, b.length) - 1) << 2;
        resultSize = Math.max(resultSize, 1);
        double[] aReal = new double[resultSize];
        double[] aImaginary = new double[resultSize];
        double[] bReal = new double[resultSize];
        double[] bImaginary = new double[resultSize];
        for (int i = 0; i < a.length; i++)
            aReal[i] = a[i];
        for (int i = 0; i < b.length; i++)
            bReal[i] = b[i];
        fft(aReal, aImaginary, false);
        fft(bReal, bImaginary, false);
        for (int i = 0; i < resultSize; i++)
        {
            double real = aReal[i] * bReal[i] - aImaginary[i] * bImaginary[i];
            aImaginary[i] = aImaginary[i] * bReal[i] + bImaginary[i] * aReal[i];
            aReal[i] = real;
        }
        fft(aReal, aImaginary, true);
        long[] result = new long[resultSize];
        for (int i = 0; i < resultSize; i++)
            result[i] = Math.round(aReal[i]);
        return result;
    }
}
class NumberTheory
{
    public boolean isPrime(long n)
    {
        if(n < 2)
            return false;
        for(long x = 2;x * x <= n;x++)
        {
            if(n % x == 0)
                return false;
        }
        return true;
    }
    public ArrayList<Long> primeFactorisation(long n)
    {
        ArrayList<Long> f = new ArrayList<>();
        for(long x=2;x * x <= n;x++)
        {
            while(n % x == 0)
            {
                f.add(x);
                n /= x;
            }
        }
        if(n > 1)
            f.add(n);
        return f;
    }
    public int[] sieveOfEratosthenes(int n)
    {
        //Returns an array with the smallest prime factor for each number and primes marked as 0
        int[] sieve = new int[n + 1];
        for(int x=2;x * x <= n;x++)
        {
            if(sieve[x] != 0)
                continue;
            for(int u=x*x;u<=n;u+=x)
            {
                if(sieve[u] == 0)
                {
                    sieve[u] = x;
                }
            }
        }
        return sieve;
    }
    public long gcd(long a, long b)
    {
        if(b == 0)
            return a;
        return gcd(b, a % b);
    }
    public long phi(long n)
    {
        double result = n;

        for(long p=2;p*p<=n;p++)
        {
            if(n % p == 0)
            {
                while (n % p == 0)
                    n /= p;
                result *= (1.0 - (1.0 / (double)p));
            }
        }
        if(n > 1)
            result *= (1.0 - (1.0 / (double)n));
        return (long)result;
    }
    public Name extendedEuclid(long a, long b)
    {
        if(b == 0)
            return new Name(a, 1, 0);
        Name n1 = extendedEuclid(b, a % b);
        Name n2 = new Name(n1.d, n1.y, n1.x - (long)Math.floor((double)a / b) * n1.y);
        return n2;
    }
    public long modularExponentiation(long a, long b, long n)
    {
        long d = 1L;
        String bString = Long.toBinaryString(b);
        for(int i=0;i<bString.length();i++)
        {
            d = (d * d) % n;
            if(bString.charAt(i) == '1')
                d = (d * a) % n;
        }
        return d;
    }
}
class Name
{
    long d;
    long x;
    long y;

    public Name(long d, long x, long y)
    {
        this.d = d;
        this.x = x;
        this.y = y;
    }
}
class SuffixArray
{
    int ALPHABET_SZ = 256, N;
    int[] T, lcp, sa, sa2, rank, tmp, c;

    public SuffixArray(String str)
    {
        this(toIntArray(str));
    }

    private static int[] toIntArray(String s)
    {
        int[] text = new int[s.length()];
        for (int i = 0; i < s.length(); i++) text[i] = s.charAt(i);
        return text;
    }

    public SuffixArray(int[] text)
    {
        T = text;
        N = text.length;
        sa = new int[N];
        sa2 = new int[N];
        rank = new int[N];
        c = new int[Math.max(ALPHABET_SZ, N)];
        construct();
        kasai();
    }

    private void construct()
    {
        int i, p, r;
        for (i = 0; i < N; ++i) c[rank[i] = T[i]]++;
        for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
        for (i = N - 1; i >= 0; --i) sa[--c[T[i]]] = i;
        for (p = 1; p < N; p <<= 1)
        {
            for (r = 0, i = N - p; i < N; ++i) sa2[r++] = i;
            for (i = 0; i < N; ++i) if (sa[i] >= p) sa2[r++] = sa[i] - p;
            Arrays.fill(c, 0, ALPHABET_SZ, 0);
            for (i = 0; i < N; ++i) c[rank[i]]++;
            for (i = 1; i < ALPHABET_SZ; ++i) c[i] += c[i - 1];
            for (i = N - 1; i >= 0; --i) sa[--c[rank[sa2[i]]]] = sa2[i];
            for (sa2[sa[0]] = r = 0, i = 1; i < N; ++i)
            {
                if (!(rank[sa[i - 1]] == rank[sa[i]]
                        && sa[i - 1] + p < N
                        && sa[i] + p < N
                        && rank[sa[i - 1] + p] == rank[sa[i] + p])) r++;
                sa2[sa[i]] = r;
            }
            tmp = rank;
            rank = sa2;
            sa2 = tmp;
            if (r == N - 1) break;
            ALPHABET_SZ = r + 1;
        }
    }

    private void kasai()
    {
        lcp = new int[N];
        int[] inv = new int[N];
        for (int i = 0; i < N; i++) inv[sa[i]] = i;
        for (int i = 0, len = 0; i < N; i++)
        {
            if (inv[i] > 0)
            {
                int k = sa[inv[i] - 1];
                while ((i + len < N) && (k + len < N) && T[i + len] == T[k + len]) len++;
                lcp[inv[i] - 1] = len;
                if (len > 0) len--;
            }
        }
    }
}
class ZAlgorithm
{
    public int[] calculateZ(char input[])
    {
        int Z[] = new int[input.length];
        int left = 0;
        int right = 0;
        for(int k = 1; k < input.length; k++) {
            if(k > right) {
                left = right = k;
                while(right < input.length && input[right] == input[right - left]) {
                    right++;
                }
                Z[k] = right - left;
                right--;
            } else {
                //we are operating inside box
                int k1 = k - left;
                //if value does not stretches till right bound then just copy it.
                if(Z[k1] < right - k + 1) {
                    Z[k] = Z[k1];
                } else { //otherwise try to see if there are more matches.
                    left = k;
                    while(right < input.length && input[right] == input[right - left]) {
                        right++;
                    }
                    Z[k] = right - left;
                    right--;
                }
            }
        }
        return Z;
    }
    public ArrayList<Integer> matchPattern(char text[], char pattern[])
    {
        char newString[] = new char[text.length + pattern.length + 1];
        int i = 0;
        for(char ch : pattern) {
            newString[i] = ch;
            i++;
        }
        newString[i] = '$';
        i++;
        for(char ch : text) {
            newString[i] = ch;
            i++;
        }
        ArrayList<Integer> result = new ArrayList<>();
        int Z[] = calculateZ(newString);

        for(i = 0; i < Z.length ; i++) {
            if(Z[i] == pattern.length) {
                result.add(i - pattern.length - 1);
            }
        }
        return result;
    }
}
class KMPAlgorithm
{
    public int[] computeTemporalArray(char[] pattern)
    {
        int[] lps = new int[pattern.length];

        int index = 0;
        for(int i=1;i<pattern.length;)
        {
            if(pattern[i] == pattern[index])
            {
                lps[i] = index + 1;
                index++;
                i++;
            }
            else
            {
                if(index != 0)
                {
                    index = lps[index - 1];
                }
                else
                {
                    lps[i] = 0;
                    i++;
                }
            }
        }
        return lps;
    }

    public ArrayList<Integer> KMPMatcher(char[] text, char[] pattern)
    {
        int[] lps = computeTemporalArray(pattern);

        int j = 0;
        int i = 0;
        int n = text.length;
        int m = pattern.length;
        ArrayList<Integer> indices = new ArrayList<>();
        while(i < n)
        {
            if(pattern[j] == text[i])
            {
                i++;
                j++;
            }
            if(j == m)
            {
                indices.add(i - j);
                j = lps[j - 1];
            }
            else if(i < n && pattern[j] != text[i])
            {
                if(j != 0)
                    j = lps[j - 1];
                else
                    i = i + 1;
            }
        }
        return indices;
    }
}
class Hashing
{
    public long[] computePowers(long p, int n, long m)
    {
        long[] powers = new long[n];
        powers[0] = 1;
        for(int i=1;i<n;i++)
        {
            powers[i] = (powers[i - 1] * p) % m;
        }
        return powers;
    }
    public long computeHash(String s)
    {
        long p = 31;
        long m = 1_000_000_009;
        long hashValue = 0L;
        long[] powers = computePowers(p, s.length(), m);
        for(int i=0;i<s.length();i++)
        {
            char ch = s.charAt(i);
            hashValue = (hashValue + (ch - 'a' + 1) * powers[i]) % m;
        }
        return hashValue;
    }
}
class BasicFunctions
{
    public int maxOfIntArray(int[] A)
    {
        int max = Integer.MIN_VALUE;
        for (int i=0;i<A.length;i++)    max = Math.max(max, A[i]);
        return max;
    }
    public long maxOfLongArray(long[] A)
    {
        long max = Long.MIN_VALUE;
        for (int i=0;i<A.length;i++)    max = Math.max(max, A[i]);
        return max;
    }
    public int minOfIntArray(int[] A)
    {
        int min = Integer.MAX_VALUE;
        for (int i=0;i<A.length;i++)    min = Math.min(min, A[i]);
        return min;
    }
    public long minOfLongArray(long[] A)
    {
        long min = Long.MAX_VALUE;
        for (int i=0;i<A.length;i++)    min = Math.min(min, A[i]);
        return min;
    }

}
class MergeSortInt
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(int arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        int L[] = new int[n1];
        int R[] = new int[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(int arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }

}
class MergeSortLong
{
    // Merges two subarrays of arr[].
    // First subarray is arr[l..m]
    // Second subarray is arr[m+1..r]
    void merge(long arr[], int l, int m, int r) {
        // Find sizes of two subarrays to be merged
        int n1 = m - l + 1;
        int n2 = r - m;

        /* Create temp arrays */
        long L[] = new long[n1];
        long R[] = new long[n2];

        /*Copy data to temp arrays*/
        for (int i = 0; i < n1; ++i)
            L[i] = arr[l + i];
        for (int j = 0; j < n2; ++j)
            R[j] = arr[m + 1 + j];

        /* Merge the temp arrays */

        // Initial indexes of first and second subarrays
        int i = 0, j = 0;

        // Initial index of merged subarry array
        int k = l;
        while (i < n1 && j < n2) {
            if (L[i] <= R[j]) {
                arr[k] = L[i];
                i++;
            } else {
                arr[k] = R[j];
                j++;
            }
            k++;
        }

        /* Copy remaining elements of L[] if any */
        while (i < n1) {
            arr[k] = L[i];
            i++;
            k++;
        }

        /* Copy remaining elements of R[] if any */
        while (j < n2) {
            arr[k] = R[j];
            j++;
            k++;
        }
    }

    // Main function that sorts arr[l..r] using
    // merge()
    void sort(long arr[], int l, int r) {
        if (l < r) {
            // Find the middle point
            int m = (l + r) / 2;

            // Sort first and second halves
            sort(arr, l, m);
            sort(arr, m + 1, r);

            // Merge the sorted halves
            merge(arr, l, m, r);
        }
    }
}
class Node
{

    int x;
    int y;

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

    @Override
    public boolean equals(Object ob)
    {
        if(ob == null)
            return false;
        if(!(ob instanceof Node))
            return false;
        if(ob == this)
            return true;
        Node obj = (Node)ob;
        if(this.x == obj.x && this.y == obj.y)
            return true;
        return false;
    }

    @Override
    public int hashCode()
    {
        return (int)this.x;
    }
}
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();
    }
}
class SegmentTree
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }
    public int[] createSegmentTree(int[] input)
    {
        int np2 = nextPowerOfTwo(input.length);
        int[] segmentTree = new int[np2 * 2 - 1];

        for(int i=0;i<segmentTree.length;i++)
            segmentTree[i] = Integer.MIN_VALUE;

        constructSegmentTree(segmentTree,input,0,input.length-1,0);
        return segmentTree;

    }
    private void constructSegmentTree(int[] segmentTree,int[] input,int low,int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/ 2;
        constructSegmentTree(segmentTree,input,low,mid,2*pos + 1);
        constructSegmentTree(segmentTree,input,mid+1,high,2*pos + 2);
        segmentTree[pos] = Math.max(segmentTree[2*pos + 1],segmentTree[2*pos + 2]);
    }
    public int rangeMinimumQuery(int []segmentTree,int qlow,int qhigh,int len)
    {
        return rangeMinimumQuery(segmentTree,0,len-1,qlow,qhigh,0);
    }
    private int rangeMinimumQuery(int segmentTree[],int low,int high,int qlow,int qhigh,int pos)
    {
        if(qlow <= low && qhigh >= high){
            return segmentTree[pos];
        }
        if(qlow > high || qhigh < low){
            return Integer.MIN_VALUE;
        }
        int mid = (low+high)/2;
        return Math.max(rangeMinimumQuery(segmentTree, low, mid, qlow, qhigh, 2 * pos + 1),
                rangeMinimumQuery(segmentTree, mid + 1, high, qlow, qhigh, 2 * pos + 2));
    }
}
class Trie
{

    private class TrieNode
    {
        Map<Character, TrieNode> children;
        boolean endOfWord;
        public TrieNode()
        {
            children = new HashMap<>();
            endOfWord = false;
        }
    }

    private final TrieNode root;
    public Trie()
    {
        root = new TrieNode();
    }

    public void insert(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                node = new TrieNode();
                current.children.put(ch, node);
            }
            current = node;
        }
        current.endOfWord = true;
    }

    public boolean search(String word)
    {
        TrieNode current = root;
        for (int i = 0; i < word.length(); i++)
        {
            char ch = word.charAt(i);
            TrieNode node = current.children.get(ch);
            if (node == null)
            {
                return false;
            }
            current = node;
        }
        return current.endOfWord;
    }

    public void delete(String word)
    {
        delete(root, word, 0);
    }

    private boolean delete(TrieNode current, String word, int index)
    {
        if (index == word.length())
        {
            if (!current.endOfWord)
            {
                return false;
            }
            current.endOfWord = false;
            return current.children.size() == 0;
        }
        char ch = word.charAt(index);
        TrieNode node = current.children.get(ch);
        if (node == null)
        {
            return false;
        }
        boolean shouldDeleteCurrentNode = delete(node, word, index + 1);

        if (shouldDeleteCurrentNode)
        {
            current.children.remove(ch);
            return current.children.size() == 0;
        }
        return false;
    }
}
class SegmentTreeLazy
{
    public int nextPowerOfTwo(int num)
    {
        if(num == 0)
            return 1;
        if(num > 0 && (num & (num - 1)) == 0)
            return num;
        while((num &(num - 1)) > 0)
        {
            num = num & (num - 1);
        }
        return num << 1;
    }

    public int[] createSegmentTree(int input[])
    {
        int nextPowOfTwo = nextPowerOfTwo(input.length);
        int segmentTree[] = new int[nextPowOfTwo*2 -1];

        for(int i=0; i < segmentTree.length; i++){
            segmentTree[i] = Integer.MAX_VALUE;
        }
        constructMinSegmentTree(segmentTree, input, 0, input.length - 1, 0);
        return segmentTree;
    }

    private void constructMinSegmentTree(int segmentTree[], int input[], int low, int high,int pos)
    {
        if(low == high)
        {
            segmentTree[pos] = input[low];
            return;
        }
        int mid = (low + high)/2;
        constructMinSegmentTree(segmentTree, input, low, mid, 2 * pos + 1);
        constructMinSegmentTree(segmentTree, input, mid + 1, high, 2 * pos + 2);
        segmentTree[pos] = Math.min(segmentTree[2*pos+1], segmentTree[2*pos+2]);
    }

    public void updateSegmentTreeRangeLazy(int input[], int segmentTree[], int lazy[], int startRange, int endRange, int delta)
    {
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, 0, input.length - 1, 0);
    }

    private void updateSegmentTreeRangeLazy(int segmentTree[], int lazy[], int startRange, int endRange, int delta, int low, int high, int pos)
    {
        if(low > high)
        {
            return;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(startRange > high || endRange < low)
        {
            return;
        }

        if(startRange <= low && endRange >= high)
        {
            segmentTree[pos] += delta;
            if(low != high) {
                lazy[2*pos + 1] += delta;
                lazy[2*pos + 2] += delta;
            }
            lazy[pos] = 0;
        }

        int mid = (low + high)/2;
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, low, mid, 2*pos+1);
        updateSegmentTreeRangeLazy(segmentTree, lazy, startRange, endRange, delta, mid+1, high, 2*pos+2);
        segmentTree[pos] = Math.min(segmentTree[2*pos + 1], segmentTree[2*pos + 2]);
    }

    public int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int len)
    {
        return rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, 0, len - 1, 0);
    }

    private int rangeMinimumQueryLazy(int segmentTree[], int lazy[], int qlow, int qhigh, int low, int high, int pos)
    {
        if(low > high)
        {
            return Integer.MAX_VALUE;
        }
        if (lazy[pos] != 0)
        {
            segmentTree[pos] += lazy[pos];
            if (low != high)
            {
                lazy[2 * pos + 1] += lazy[pos];
                lazy[2 * pos + 2] += lazy[pos];
            }
            lazy[pos] = 0;
        }

        if(qlow > high || qhigh < low)
        {
            return Integer.MAX_VALUE;
        }

        if(qlow <= low && qhigh >= high)
        {
            return segmentTree[pos];
        }

        int mid = (low+high)/2;
        return Math.min(rangeMinimumQueryLazy(segmentTree, lazy, qlow, qhigh, low, mid, 2 * pos + 1), rangeMinimumQueryLazy(segmentTree, lazy,  qlow, qhigh, mid + 1, high, 2 * pos + 2));
    }
}
class BIT
{
    int size;
    long[] table;
    public BIT(int size)
    {
        table = new long[size];
        this.size = size;
    }

    void update(int i, long delta)
    {
        while (i < size)
        {
            table[i] += delta;
            i += Integer.lowestOneBit(i);
        }
    }

    long sum(int i)
    {
        long sum = 0L;
        while (i > 0)
        {
            sum += table[i];
            i -= Integer.lowestOneBit(i);
        }
        return sum;
    }
}


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

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

    static class atskb {
        long mod = (long) Math.pow(10, 9) + 7;
        long[] dp;
        int[] prime;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            Random gen = new Random();
            long t = in.nextLong();
            int l = in.nextInt();
            int r = in.nextInt();
            long pow[] = new long[r - l + 1];
            pow[0] = 1;
            for (int i = 1; i < pow.length; i++) {
                pow[i] = (pow[i - 1] * t) % mod;
            }
            dp = new long[r + 1];
            for (int i = 0; i < r + 1; i++) {
                dp[i] = -1;
            }
       /* long sieve[]=new long[r+1];
        for (int i = 2; i <sieve.length ; i++) {
            if(sieve[i]==0){
                for (int j = i; j <sieve.length ; j+=i) {
                    if(sieve[j]==0){
                        sieve[j]=i;
                    }
                }
            }
        }
        for (int i = 2; i <sieve.length ; i++) {
            if(sieve[i]==i){
                sieve[i]=(sieve[i]*(sieve[i]-1))/2;
            }
        }
        */
            prime = in.sieve(r +1);
            // System.out.println(prime[1]+" "+prime[2]);
            long ans = 0;
            for (int i = l; i <= r; i++) {
                ans = ans + (solve(i) * pow[i - l]) % mod;
                ans = ans % mod;
            }
            //System.out.println(dp[1]+" "+dp[2]+" "+dp[3]+" "+dp[4]);
            out.println(ans);
//out.println(solve(6));
        }

        public long solve(int n) {
            if (dp[n] != -1) {
                return dp[n];
            }
            if (n == 1) {
                return 0;
            }
            if(n==prime[n]){
                return ((long) n * (n - 1)) / 2) % mod;
            }
            int val = n;
            long ans = (long) 1e12;
            int init = prime[n];
            ans = Math.min(ans, ((((((long) init * (init - 1)) / 2) % mod) * (n / init)) % mod + (solve(n / prime[val])) % mod) % mod);
            return dp[n] = ans;
        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

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

        public int read() {
            //*-*------clare------

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

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] sieve(int n) {
            int ar[] = new int[n + 1];
            ar[0] = 0;
            ar[1] = 1;
            for (int i = 2; i < ar.length; i++) {
                if (ar[i] == 0) {
                    for (int k = i; k < ar.length; k = k + i) {
                        if (ar[k] == 0) {
                            ar[k] = i;
                        }
                    }
                }
            }
            return ar;

        }

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

    }
}


import java.util.Scanner;
import java.io.*;
import java.util.*;
import java.math.*;
import java.lang.*;
import static java.lang.Math.*;

public class Main implements Runnable{

    static LinkedList <Integer> adj[];
    static int co=0;

    static void Check2(int n){
        adj=new LinkedList[n+1];
        for(int i=0;i<=n;i++){
            adj[i]=new LinkedList();
        }

    }
    static void add(int i,int j){
        adj[i].add(j);

    }
    public static void main(String[] args) throws Exception {
        new Thread(null, new Main(), "Check2", 1<<26).start();// to increse stack size in java
    }
    public void run(){
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
        //Scanner in=new Scanner(System.in);
        InputReader in=new InputReader(System.in);
        PrintWriter w=new PrintWriter(System.out);

        long pr[]=new long[50000001];

        for(int i=2;i<=5000000;i++){
            if(pr[i]==0){
                pr[i]=i;
                for(int j=2*i;j<=5000000;j+=i){
                   if(pr[j]==0)pr[j]=i;

                }
            }

        }

        long ans[]=new long[5000001];
        long mod=(long)(1e9+7);

        for(int i=2;i<=5000000;i++){
            if(pr[i]==i){
                long p=(long)(i)*(long)(i-1);
                p=p/2;
                p%=mod;
                ans[i]=p;
            }
            else{
                long r=i/(pr[i]);

                long tp=(long)(pr[i])*(long)(pr[i]-1);

                tp/=2;
                tp=tp*r;
                tp=(tp%mod+ans[(int)r]%mod)%mod;
                ans[i]=tp;

            }
        }
        long t=in.nextLong();
        int l=in.nextInt();
        int r=in.nextInt();
        long mul=1l;
        long sum=0;
        for(int i=l;i<=r;i++){
            sum=sum%mod+(mul*(long)ans[i])%mod;
            sum%=mod;
      //      w.println(sum);
            mul=(mul*t)%mod;
        }
        w.println(sum);

        w.close();

    }
    static int bs(ArrayList <Integer> list,int x){

        int l=0;
        int r=list.size()-1;

        int ans=0;
        while(l<=r){
            int mid=(l+r)/2;

            if(list.get(mid)>=x){
                ans=mid;
                r=mid-1;
            }
            else
                l=mid+1;

        }

        return ans;

    }

static  long dp[][];
    static long mod=(long)(1e9+7);
    static long rec(int i,long m,int n,long a[]){

        if(i>n)return 0;
            if(i==n){
                if(m==0)return 1;
                else
                    return 0;
            }

        long ans=0;

        ans=ans+rec(i+1,(m*10+a[i])%8,n,a);

        ans=ans+rec(i+1,m,n,a);
        ans%=mod;
        return dp[i][(int)m]=ans;

    }

static int flag=0;
    static  ArrayList <Integer> flist;
    static void dfs(int i,int v[],ArrayList <Integer> list){

        if(v[i]==0){

            v[i]=1;
            list.add(i);
            Iterator <Integer>p=adj[i].iterator();
            while(p.hasNext()){
                Integer ne=p.next();
                if(list.contains(ne)){

                    for(Integer pq:list){
                       // System.out.println(i+" "+pq+" "+ne);
                        flist.add(pq);
                    }
                    flag=1;
                }
       dfs(ne,v,list);

           }

           list.remove(new Integer(i));

 }

    }
    static class node{

        int y;
        int val;

        node(int a,int b){

            y=a;
            val=b;

        }

    }
    static class InputReader
    {
        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 String nextLine()
        {
            BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt()
        {
            int c = read();

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

            int sgn = 1;

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

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

            return res * sgn;
        }

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

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

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

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

            return res.toString();
        }

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

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

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

}


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

public class Main_A {

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

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

		double eps = 0.000001d;

		String[] t = reader.readLine().split(" ");
		int[] num = new int[4];
		for (int i = 0; i < 4; i++)
			num[i] = Integer.parseInt(t[i]);

		int dist = num[1] - num[0];
		boolean isAr = true;
		for (int i = 2; i < 4; i++) {
			if (dist != num[i] - num[i - 1]) {
				isAr = false;
				break;
			}
		}
		if (isAr) {
			System.out.println(num[3] + dist);
			return;
		}

		double factor = (double) num[1] / num[0];
		boolean isGeo = true;
		for (int i = 2; i < 4; i++) {
			if (Math.abs(num[i - 1] * factor - num[i]) > eps) {
				isGeo = false;
				break;
			}
		}

		if (isGeo) {
			System.out.println((int) (num[3] * factor));
			return;
		}

		System.out.println(42);

	}
}


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

public class TR8_A {
    void solve() throws IOException {
        int a1 = nextInt();
        int a2 = nextInt();
        int a3 = nextInt();
        int a4 = nextInt();

        int d = a2-a1;
        if( ((a2+d)==a3) && ((a3+d)==a4)){//проверка на арифметическую прогрессию
            out.println(a4+d);
        }else{
            double q = a2/a1;
            double a5 = a4*q;
            if( (a1!=0) && (q!=0) && (q!=1)
                    && (a2*q==a3) && (a3*q==a4) && (a5/((int)a5)==1)){//проверка на геометрическую прогрессию
                out.println(a5);
            }
            else out.println(42);
        }
        out.close();
    }

    BufferedReader in;
    StringTokenizer str;
    PrintWriter out;
    String SK;

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

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

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

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

    void run() throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));//new FileReader("input.txt"));
        out = new PrintWriter(System.out);//"output.txt");
        solve();
        out.close();
    }

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


public class Main{
    public static void main(String[] args)throws IOException{
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String s=br.readLine();
        StringTokenizer st=new StringTokenizer(s);
        double []x=new double[4];
        for(int i=0;i<4;i++){
            x[i]=Double.parseDouble(st.nextToken());
        }
        double d=0;
        double q=0;
        boolean flag=false;
        if(x[0]-x[1]==x[1]-x[2] && x[1]-x[2]==x[2]-x[3]){
        d=x[1]-x[0];
        flag=true;
        }
        else if(x[0]/x[1] ==x[1]/x[2] && x[1]/x[2]==x[2]/x[3])
        q=x[1]/x[0];
        else{
            System.out.println(42);
            return;
        }
        if(flag==true){
            System.out.println((int)(x[3]+d));
        }
        else{
           if((int)(x[3]*q)==x[3]*q)
        System.out.println((int)(x[3]*q));
        else
        System.out.println(42);
        }
    }}


import java.util.*;
public class ChatRecord {

    public static int searchstring(String s,String S){
        if (s.length()>S.length())
            return -1;
        for(int i=0;i<=(S.length()-s.length());i++){
            if (s.equals(S.substring(i,i+s.length())))
                return i;
        }
        return -1;
    }

    public static boolean geometric(int x , int y , int z , int w){
        if (x == 0 || z==0 || y==0 || w==0){

            return false;
        }

        double a =y/x;

        double b =z/y;
        double c =w/z;
        if (a==b && b==c)
            return true;
        return false;
    }
    public static void main(String[] args){
        String I = "1";
        while (! I.equals("0")){
        Scanner sc = new Scanner(System.in);
        String Input = sc.nextLine();
        int space = searchstring(" ",Input);

        int x = Integer.parseInt(Input.substring(0,space));
        Input = Input.substring(space+1, Input.length());
        space = searchstring(" ",Input);
        int y = Integer.parseInt(Input.substring(0,space));
        Input = Input.substring(space+1, Input.length());
        space = searchstring(" ",Input);
        int z = Integer.parseInt(Input.substring(0,space));
        Input = Input.substring(space+1, Input.length());
        space = searchstring(" ",Input);
        int w = Integer.parseInt(Input.substring(0,Input.length()));

        if ((y-x)==(z-y) && (z-y)==(w-z)){
            System.out.println(y-x+w);
            return;
        }
        else if (geometric(x,y,z,w)){
            if (x == 0 || y/x==1 || z==0 || y==0 || w==0){
                System.out.println("42");
                return;
            }

            if ((w*w)%z == 0)
                    System.out.println(w*w/z);
            else System.out.println(42);
        }
            else
                System.out.println(42);
        I = sc.nextLine();
        }

    }
}


import java.util.*;
public class Dc {
 public static void main ( String[] args) {
    Scanner sc=new Scanner( System.in ) ;
    int r= sc.nextInt() ;
    int g=sc.nextInt();
    int b=sc.nextInt();
    int res=0;
    int x=r;int y=g;int z=b;
    if(x<=y && x<=z){
        res+=x;y-=x;z-=x;x=0;
    }
    if(y<=x && y <=z) {
        res+=y;x-=y;z-=y;y=0;
    }
    if (z<=x && z<=y) {
        res+=z;x-=z;y-=z;z=0;
    }
    res+=x/3+y/3+z/3;
    if((r%3==0 && b%3==2 && g%3==2 ) || (g%3==0 && r%3==2 b%3==2) || (b%3==0 && g%3==2 && r%3==2)) {
        if(r!=0 || g!=0 || b!=0 ) res+=1;
    }
 System.out.println(res);
 }
}


import java.util.Scanner;
public class Solution{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int r = sc.nextInt();
        int g = sc.nextInt();
        int b = sc.nextInt();
        int total = r/3 + g/3 + b/3;
        int rr = r%3;
        int gr = g%3;
        int br = b%3;
        int min = Math.min(Math.min(rr,gr),br)
        if(min > 0){
            total += min;
            rr -= min;
            gr -= min;
            br -= min;
        }
        if(rr*gr*br == 0 && rr+gr+br == 4 && total > 0){
            total++;
        }
        System.out.println(total);
    }
}


import java.util.Scanner;

public class haha {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		Long r= in.nextLong();
		Long g= in.nextLong();
		Long b= in.nextLong();

		Long k=0;
		Long l;
		l=r/3;
		l+=g/3;
		l+=b/3;
		k=r%3 +b%3 +g%3;
		l+=k/3;
		System.out.println(l);
	}

}


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

public class CeilFlowers {

    public static void main(String[] args)throws IOException {
        // TODO Auto-generated method stub
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        try
        {
            String str=br.readLine();
            String s[]=str.split(" ");
            int r=Integer.parseInt(s[0]);
            int g=Integer.parseInt(s[1]);
            int b=Integer.parseInt(s[2]);
            int count=0;
            if(r%3==0)
                count+=r/3;
            if(g%3==0)
                count+=g/3;
            if(b%3==0)
                count+=b/3;
            if(r%3==1 && g%3==1 && b%3==1)
                count=r/3+g/3+b/3+1;
            if(r%3==2 && g%3==2 && b%3==2)
                count=r/3+g/3+b/3+2;
            if(r%3==1 && g%3==2 && b%3==0)
                count=r/3+g/3+b/3;
            if(r%3==0 && g%3==1 && b%3==2)
                count=r/3+g/3+b/3;
            if(r%3==1 && g%3==0 && b%3==2)
                count=r/3+g/3+b/3;
            System.out.println(count);

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

    }

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

public class CeilFlowers {

    public static void main(String[] args)throws IOException {
        // TODO Auto-generated method stub
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

        try
        {
            String str=br.readLine();
            String s[]=str.split(" ");
            int r=Integer.parseInt(s[0]);
            int g=Integer.parseInt(s[1]);
            int b=Integer.parseInt(s[2]);
            int count=0;
            if(r%3==0)
                count+=r/3;
            if(g%3==0)
                count+=g/3;
            if(b%3==0)
                count+=b/3;
            if(r%3==1 && g%3==1 && b%3==1)
                count=r/3+g/3+b/3+1;
            if(r%3==2 && g%3==2 && b%3==2)
                count=r/3+g/3+b/3+2;
            System.out.println(count);

        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

    }

}


public class main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s1 = sc.nextLine();
		String s[] = s1.split(" ");
		int a[] = Arrays.stream(s).mapToInt(Integer::parseInt).toArray();
		int min =0,x=0,max=0,l = a[1]-1,r=a[2],n=a[0];
		min += (n-l);
		while(l>0) {
			min += Math.pow(2, l);
			l--;
		}
		while(x<r) {
			max += Math.pow(2, x);
			x++;
		}
		if((n-r)!=0) {
			max += ((n-r)*(Math.pow(2,x-1)));
		}
		System.out.println(min+" "+max);
	}
}


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

        InputStreamReader i = new InputStreamReader(System.in);

        BufferedReader bufferReader = new BufferedReader(i);

        String input = bufferReader.readLine();

        String x = input.split(" ");

        int n = Integer.valueOf(x[0]);
        int l = Integer.valueOf(x[1]);
        int r = Integer.valueOf(x[2]);

        int minVal = Min(n, l, r);
        int maxVal = Max(n, l, r);

        System.out.println(minVal + " " + maxVal );

    }

    public static int Max(int n, int l, int r){
        int[] a = new int[n];
        int answer = 0;

        a[0] = 1;
        int i = 1;
        for(; i <= r - 1; i++){
         a[i] = a[i-1] * 2;
        }

        int rightMostValue = a[i - 1];

        for(; i < a.length; i++){
          a[i] = rightMostValue;
        }

        for(int j =0; j < a.length; j++){
          answer += a[j];
        }

        return answer;
    }

    public static int Min(int n, int l, int r){
        int[] a = new int[n];
        int answer = 0;
        for(int i = 0; i < n-l+1; i++){
          a[i] = 1;
        }

        for(int j =n-l+1; j < a.length; j++){
          a[j]= a[j-1]*2;
        }
         for(int i = 0; i < a.length; i++){
          answer += a[i];
        }

        return answer;
    }
}


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

public class B {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long box = sc.nextInt();
        long lcut = sc.nextInt();
        long rcut = sc.nextInt();
        long min = box-lcut+1;
        long gp = 2*(Math.pow(2, lcut-1)-1);
        min = min+gp;
        long last = box-rcut+1;
        long gp = (Math.pow(2, rcut)-1);
        long lastnum = Math.pow(2, rcut-1);
        lastnum = lastnum*(box-rcut);
        long max = gp+lastnum;
        System.out.println(min+" "+max);
    }
}


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

public class Problem1204B {
  static Scanner s = new Scanner(System.in);

  public static void main(String args[]) {
    int n = s.nextInt();
    int l = s.nextInt();
    int r = s.nextInt();
    int min = 1;
    int max = 1;
    int minSum = 0;
    int maxSum = 0;

    //finds minimum
    for (int i = 0; i < n; i++) {
      int minSum += min;
      if (i > n-l+1) {
        min = min*2;
      }
    }

    //finds maximum
    for (int i = 0; i < n; i++) {
      int maxSum += max;
      if (i+1 < r) {
        max = max*2;
      }
    }

    System.out.print(min + " " + max);
  }
}


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

public class B144
       {
       public static void main(String args[]) throws IOException
               {
               BufferedReader c=new BufferedReader(new InputStreamReader(System.in));
               //Scanner c=new Scanner(System.in);
               long n=Long.parseLong(c.readLine());

               long sqrt=(long) Math.sqrt(n);
               long flag=0;
               long min=sqrt;
               long ans=0;
               ans=sqrt*sqrt+digit(sqrt)*sqrt-n;
               if(ans==0)
                       {
                       System.out.println(sqrt);
                       return;
                       }
               else
                       {
                       int i=0;
                        flag=0;
                       min=sqrt;
                       while(i<100000 && (sqrt-i)>0)
                               {
                               ans=(sqrt-i)(sqrt-i)+digit(sqrt-i)(sqrt-i)-n;
                               if(ans==0)
                                       {
                                       if((sqrt-i)<min)
                                               min=(sqrt-i);
                                       flag=1;
                                       }
                               i++;
                               }

                       }
               if(flag==1)
                       {
                       System.out.println(min);
                       }
               else
               System.out.println(-1);
               return;

               }

       public static int digit(long n) {
   int sum = 0;

   while (n > 0) {
           int p = (int) (n % 10);
           sum = sum + p;
           n = n / 10;
   }
   return sum;
}
       }

//must declare new classes here


import java.util.*;
import java.lang.*;
public class abc
{
    public static long calc(long x)
    {
        long sum=0L;String s=Long.toString(x);
        for(int i=0;i<s.length();i++)
        sum+=(s.charAt(i)-'0');
        return sum;
    }
    public static void main(String ar[])
    {
        Scanner sc = new Scanner(System.in);
        long n=sc.nextLong();
        if(n<=1)
        System.out.println("-1");
        else if(n==2)
        System.out.println("1");
        else
        {
            long res=-1;
            for(long x=Math.sqrt(n);((x*x)+81*x)>=n;x--)
            {
                if(((x*x)+(calc(x)*x))==n)
                {
                    res=x;
                    break;
                }
            }
            System.out.println(res);
        }
    }
}


import java.util.HashSet;
import java.util.*;
import java.util.Scanner;
import java.util.Set;
import java.util.ArrayList;
import java.util.Collections;
import java.text.DecimalFormat;
import java.lang.Math;
public class Lo {
    public static long digitsum(long n){
        long count = 0;
        while(n>0){
            count += n%10;
            n /= 10;
        }
        return count;
    }
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      long n = sc.nextLong();
      long m = (int)Math.sqrt(n);
      long l = (int)Math.sqrt(n/2);
      long ans = -1;
      while(l<=m){
          int mid = l+(m-l)/2;
          if((n-(long)Math.pow(m,2))%m==0 && (n-(long)Math.pow(m,2))/m==(long)digitsum(m)){
              ans = m;
              break;
          }
          else{
              l = m+1;
          }
      }
      System.out.println(ans);
    }
}


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

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

		Long n =Long.parseLong(br.readLine());
		int c=0;
		for(Long i=1L;c<90;i++) {

			if (n%i==0) {

				String s=i+"";
			    c=0;
				for(int j=0;j<s.length();j++) {
					c+=Integer.parseInt(s.charAt(j)+"");
			}
			if (n/i==i+c)
				{
					System.out.print(i);
				return;
				}
			}

		}
		System.out.print(-1);


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

public class Solution {

    private final static PrintWriter out = new PrintWriter(System.out);
    private final static FastReader in = new FastReader();

    public static void main(String[] args) {

        int a1 = in.nextInt();
        int a2 = in.nextInt();
        int k1 = in.nextInt();
        int k2 = in.nextInt();
        int n = in.nextInt();
        if (((a1 * k1) + (a2 * k2)) == n) {
            out.println((a1 + a2) + " " + (a1 + a2));
            out.flush();
            System.exit(0);
        }
        int min, max = 0;
        if (n - (a1 * (k1 - 1)) - (a2 * (k2 - 1)) <= 0) {
            min = 0;
        } else {
            min = n - (a1 * (k1 - 1)) - (a2 * (k2 - 1));
            if (min > a1 + a2) {
                min = a1 + a2;
            }
        }
        if (k1 >= k2) {
            if (n >= k2 * a2) {
                max += a2;
                n -= (k2 * a2);
                if (n >= k1 * a1) {
                    max += a1;
                } else {
                    for (int i = 0; i < a1; i++) {
                        if (k1 <= n) {
                            max++;
                            n -= k1;
                        } else {
                            break;
                        }
                    }
                }

            } else {
                for (int i = 0; i < a2; i++) {
                    if (k2 <= n) {
                        max++;
                        n -= k2;
                    } else {
                        break;
                    }
                }
            }
        } else {
            if (n >= k1 * a1) {
                max += a1;
                n -= (k1 * a1);
                if (n >= k2 * a2) {
                    max += a2;
                } else {
                    for (int i = 0; i < a2; i++) {
                        if (k2 <= n) {
                            max++;
                            n -= k2;
                        } else {
                            break;
                        }
                    }
                }

            } else {
                for (int i = 0; i < a1; i++) {
                    if (k1 <= n) {
                        max++;
                        n -= k1;
                    } else {
                        break;
                    }
                }
            }
        }
        out.println(min + " " + max);
        out.flush();

    }


public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int a1 = Integer.parseInt(br.readLine());
        int a2 = Integer.parseInt(br.readLine());
        int k1 = Integer.parseInt(br.readLine());
        int k2 = Integer.parseInt(br.readLine());
        int n = Integer.parseInt(br.readLine());

        int curr_a1 = a1;
        int curr_a2 = a2;
        int curr_cards = 0;
        int max = 0;
        for(int c = 0; c < n; c++) {
            curr_cards++;

            if (k1 <= k2) {
                if (curr_cards >= k1 && curr_a1 > 0) {
                    max++;
                    curr_cards = 0;
                    curr_a1--;
                } else if (curr_cards >= k2 && curr_a2 > 0) {
                    max++;
                    curr_cards = 0;
                    curr_a2--;
                }
            } else {
                if (curr_cards >= k2 && curr_a2 > 0) {
                    max++;
                    curr_cards = 0;
                    curr_a2--;
                } else if (curr_cards >= k1 && curr_a1 > 0) {
                    max++;
                    curr_cards = 0;
                    curr_a1--;
                }
            }
        }

        curr_a1 = a1;
        curr_a2 = a2;
        curr_cards = 0;
        int min = 0;
        boolean full1 = (k1 == 1), full2 = (k2 == 1);
        for(int c = 0; c < n; c++) {
            curr_cards++;

            if (full1 && full2) {
                if (curr_a1 > 0) {
                    min++;
                    curr_a1--;
                } else if (curr_a2 > 0) {
                    min++;
                    curr_a2--;
                }
            }

            if (!full1) {
                if (curr_cards + 1 > (k1 - 1) * a1) {
                    full1 = true;
                    curr_cards = 0;
                }
            } else if (!full2) {
                if (curr_cards + 1 > (k2 - 1) * a2) {
                    full2 = true;
                    curr_cards = 0;
                }
            }
        }

        System.out.println(min + " " + max);
    }
}


public class Lesson3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int a1 = scanner.nextInt();
        int a2 = scanner.nextInt();
        int k1 = scanner.nextInt();
        int k2 = scanner.nextInt();
        int n = scanner.nextInt();

        int n2=0;

        int min=0,max=0;

        //min
        n2=k1>k2?k1*a1-a1:k2*a2-a2;

        if(n2<n){
            n2=k1>k2?n2+(k2*a2-a2):n2+(k1*a1-a1);
        }
        if(n2<n){
            min=(n-n2);
            min=min>(a1+a2)?(a1+a2):min;
        }

        //max
        int n3=0;
        n2=k1<k2?k1*a1:k2*a2;
        if(n2>n){
            max=k1<k2?n2-n/k1:n2-n/k2;
        }else{
            max=k1<k2?a1:a2;
            n3=k1<k2?(k2*a2):(k1*a1);
            if(n2+n3>n){
                max=k1<k2?max+(n-n2)/k2:max+(n-n2)/k1;
            }else{
                max=a1+a2;
            }
        }

        System.out.println(min+" "+max);
    }
}


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

//Reader sc=new Reader();
public 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();
     }
 }
public class Test{
    public static void main(String []args) throws IOException{
        Reader sc = new Reader();
        int t1[] = new int[2];
        int t2[] = new int[2];
        t1[0] = sc.nextInt();
        t2[0] = sc.nextInt();
        t1[1] = sc.nextInt();
        t2[1] = sc.nextInt();
        int n = sc.nextInt();

        int max, min, amin, amax;
        int kmin = Math.min(t1[1], t2[1]);
        int kmax = t1[1]+t2[1]-kmin;
        if(kmax==t1[1]){
            amax = t1[0];
            amin = t2[0];
         }
         else{
             amin = t1[0];
             amax = t2[0];
         }
         //System.out.println(amin+" "+kmin);
        min = n-((kmax-1)*amax)-((kmin-1)*amin);
        max = (n-(Math.min(n/kmin, amin)*kmin))/kmax + Math.min(n/kmin, amin);

        //System.out.print((Math.min((n/kmin), amin))+" ");
        System.out.print(min+" "+max);
    }
}


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

public class Main {
    static HashSet<String> hs=new HashSet<>();
    public static void main(String[] args) throws Exception {
        FastReader sc = new FastReader();
        StringBuilder sb=new StringBuilder();
        StringBuilder a=new StringBuilder(sc.next()),b=new StringBuilder(sc.next());
        for(int i=0;i<a.length();i++){
            if(a.charAt(i)!=b.charAt(i)){
                if(b.charAt(i)-a.charAt(i)>1) {
                    a.replace(i,i+1,Character.toString(a.charAt(i)+1));
                    System.out.println(a);
                    return;
                }
                else{
                    a.replace(i,i+1,Character.toString(a.charAt(i)+1));
                    a.replace(i+1,a.length(),"");
                    for(int j=i+1;j<b.length();j++)a.append('a');
                    boolean z=false;
                    for(int j=i+1;j<b.length();j++){
                        if(b.charAt(i)>'a'){
                            z=true;
                            break;
                        }
                    }
                    if(z) System.out.println(a);
                    else System.out.println("No such string");
                    return;
                }
            }
        }
        System.out.println("No such string");
    }
}
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;
    }
}


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

public class Solution {

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

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

    String t = scanner.nextLine();
    String s = scanner.nextLine();
    String out = "";
    int len = s.length();
    int sum = 0;
    int hihi = false;

    for (int i = 0; i < len; i++) {
      sum += (int)(s.charAt(i) - t.charAt(i));
      if(s.charAt(i) - t.charAt(i) > 1) {
       char tmp = (char) (t.charAt(i) + 1);
       out += tmp;
       hihi = true;
      } else if (s.charAt(i) - t.charAt(i) < 0) {
       System.out.println("No such string");
       return;
      } else {
       char tmp = (char) (t.charAt(i) + 1);
       out += tmp;
      }
    }
    if (sum<=len) {
      System.out.println("No such string");
    } else {
      System.out.println(out);
    }
  }
}


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

public class Solution{

	public void run() throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str1 = br.readLine();

		String str2 = br.readLine();

		char [] arr = str1.toCharArray();

		int len = str1.length();

		int i = len-1;

		while(arr[i]==z){
			arr[i] = 'a';
			i--;
		}

		arr[i] = (char)(arr[i] + 1);

		str1 = new String(arr);

		if(str1.compareTo(str2) < 0)
			System.out.println(str1);
		else
			System.out.println("No such string");

	}

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

		new Solution().run();
	}
}


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

public class Solution{

	public void run() throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String str1 = br.readLine();

		String str2 = br.readLine();

		//char [] arr = str1.toCharArray();

		int len = str1.length();

		//arr[len-1] = (char)(arr[len-1] + 1);

		//str1 = arr.toString();

		str1.charAt(len-1) = (char)(str1.charAt(len-1) + 1);

		if(str1.compareTo(str2) < 0)
			System.out.println(str1);
		else
			System.out.println("No such string");

	}

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

		new Solution().run();
	}
}


import java.util.Scanner;
public class x{
public static void main(String[] args) {

Scanner s = new Scanner (System.in);
String s1 = s.next();
String s2 = s.next();

char[]arr1 = s1.toCharArray();
char[]arr2 = s2.toCharArray();

int count1=0,count2=0;
int count3 = 0 ;
for (int i=0 ; i<arr1.length;i++){

if(arr1[i]=='+') count1+=1 ;
if(arr1[i]=='-')count1-=1 ;

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

if(arr2[i]=='+') count2+=1 ;
if(arr2[i]=='-')count2-=1 ;
if (arr2[i]=='?')count3+=1 ;

}

if (count3==0 && count1==count2){
System.out.println("1.000000000000");

}
if (count3 !=0){
int temp=count1-count2;
if (temp<0)
temp*=-1;
if(count3==temp)
System.out.println("0.500000000000");
else
System.out.println("0.000000000000");
}}


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

public class B {
    FileReader in = new FileReader(System.in);
    PrintWriter out = new PrintWriter(System.out);

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

    void run() throws IOException {
        int sntBalance = 0;     // Difference between + and -
        String sent = in.readLine();
        for (int i = 0; i < sent.length(); i++) {
            if (sent.charAt(i) == '+')
                sntBalance++;
            else
                sntBalance--;
        }
        int rcvBalance = 0, unknown = 0;
        String received = in.readLine();
        for (int i = 0; i < received.length(); i++) {
            if (received.charAt(i) == '+')
                rcvBalance++;
            else if (received.charAt(i) == '-')
                rcvBalance--;
            else
                unknown++;
        }

        if (unknown == 0) {
            // No guess
            if (sntBalance == rcvBalance)
                out.printf("%.10f\n", 1.0);
            else
                out.printf("%.10f\n", 0.0);
        } else {
            // Difference between + and - within the unknowns
            int morePlus = sntBalance - rcvBalance;

            if (morePlus > unknown || morePlus < -unknown ||
                    (morePlus+unknown) % 2 != 0) {
                out.printf("%.10f\n", 0.0);
            } else {
                int plusInUnknown = (morePlus + unknown) / 2;   // + in the unknowns
                out.printf("%.10f\n",
                        (double) combinations(unknown, plusInUnknown) / (1 << unknown));
            }
        }
        out.flush();
    }

    // The number of combinations by selecting k positions out of n ones. Note that
    // n<=10. There would not be any overflow.
    int combinations(int n, int k) {
        int p1 = 1, p2 = 1;
        for (int i = n; i >= k+1; i--) {
            p1 *= i;
            p2 *= i - k;
        }
        return p1 / p2;
    }
}