import java.util.*;
public class Main{
     static ArrayList<Integer> check(char ch){
          int c=ch-'0';
          if(c==2){
               int ar[]={2};
               return Arrays.asList(ar);
          }
          else if(c==3){
               int ar[]={3};
               return Arrays.asList(ar);
          }else if(c==4){
               int ar[]={3,2,2};
               return Arrays.asList(ar);
          }else if(c==5){
               int ar[]={5};
               return Arrays.asList(ar);
          }else if(c==6){
               int ar[]={5,3};
               return Arrays.asList(ar);
          }else if(c==7){
               int ar[]={7};return Arrays.asList(ar);
          }else if(c==8){
               int ar[]={7,2,2,2};
               return Arrays.asList(ar);

          }else{
               int ar[]={7,3,3,2};
               return Arrays.asList(ar);
          }
     }
     public static void main(String args[]){

     Scanner s= new Scanner(System.in);
     int n=s.nextInt();
     ArrayList<Integer> al=new ArrayList<Integer>();
     String str= s.next().substring(0,n);
     for(int i=0;i<str.length();i++){
          if(str.charAt(i)-'0'>1){
               al.addAll(check(str.charAt(i)));
          }
     }
     Collections.sort(al,Collections.reverseOrder());
     for(int i=0;i<al.size();i++){
          System.out.print(al.get(i));
     }

     }
}


import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String s;
			Scanner sc= new Scanner(System.in);
			int len=sc.nextInt();
				s=sc.next();
				//System.out.println(s);
				int arr[]= new int[4];

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

				int c=s.charAt(i)-'0';

				switch(c){

					case 9:
						arr[3]++;
						arr[0]+=3;
						arr[1]+=2;
						break;

					case 8:
						arr[3]++;
						arr[0]+=3;
						break;
					case 7:

						arr[3]++;
						break;
					case 6:
						arr[2]++;
						arr[0]++;
						arr[1]++;
						break;
					case 5:

						arr[2]+=1;
						break;
					case 4:
						arr[1]++;
						arr[0]+=2;
						break;
					case 3:
						arr[1]++;
						break;
					case 2:

						arr[0]+=1;

						break;

						}

				}
			String res="";
				while((arr[3]--)!=0)
				{
				res=res+"7";
				}
				while((arr[2]--)!=0)
				{
					res=res+"5";
				while((arr[1]--)!=0)
				{
					res=res+"3";
				}
				while((arr[0]--)!=0)
					res=res+"2";
			System.out.println(res);
			}
	}


import java.util.Scanner

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

		int w1 = in.nextInt();
		int h1 = in.nextInt();
		int w2 = in.nextInt();
		int h2 = in.nextInt();

		int answer = w1 + 2 * (h1 + 1) + w2 + 2 * (h2 + 1) + w1 - w2;

		System.out.println(answer);
	}
}


import java.util.Scanner;
import java.lang.Math;
public class janam{
    public static void main{
        Scanner scanner = new Scanner(System.in);
        int w1 = scanner.nextInt();
        int h1 = scanner.nextInt();
        int w2 = scanner.nextInt();
        int h2 = scanner.nextInt();
        int ans = 2*(h1+h2+w1) + 4;
        System.out.println(ans);
    }
}


public class Main {

    public static void main(String[] args) {
        System.out.println(seaBattle(args[0],args[1], args[2],args[3]);
    }

    public static  int seaBattle(int w1, int h1 ,int w2, int h2 ){
        int p1 = (w1+h1)*2;
        int p2 = (w2+h2)*2;
        int lost = 0;
        if(w2>w1){
            lost = w1;
        }else{
            lost = w2;
        }
        return p1+p2+4-lost*2;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.lang.Math;
import java.io.*;

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

		String s = br.readLine();
		String [] parts =s.split(" ");
		long w1 =Long.parseLong(parts[0]);
		int h1=Long.parseLong(parts[1]);
		int w2=Long.parseLong(parts[2]);
		int h2=Long.parseLong(parts[3]);

		System.out.println((h1+h2)*2+w1*2+4);

	}
}


import java.util.Scanner;

public class ProblemB {

    void run(){
       Scanner sc = new Scanner(System.in);
       long d=sc.nextInt();
       long i=0;
       long a=0;
       long b=0;
       long res;
       if (d<0) d*=-1;
       while((a<=d)){
           b=a;
           i++;
           a+=i;
       }
       if (b==d)
           res=i-1;
       else{
           i++;
           a+=i;
           if (d%2==0){
               while((a%2!=0)){
                   i++;
                   a+=i;
               }
           }else {
               while((a%2==0)){
                   i++;
                   a+=i;
               }
           }
           res=i;
       }
       System.out.println(res);
       sc.close();
    }

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


public class JumpingJack {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
final int x=Math.abs(s.nextInt());

int n=0;
int p=0;
while(p < x)  {
  n++;
  p+=n;
}
if( p-x > 0 ) {
while( (p-x)%2==1 ) {
n++;
p+=n;
}
}
System.out.println(n);
}
}


import java.util.*;
import java.io.*;
public class JumpingJack {
public void main(String[] args) {
Scanner s=new Scanner(System.in);
final int x=s.nextInt();
int p=0;
int n=0;
while(p<x) {
n++;
p+=n;
}
while( (p-x)%2 != 0 || (p-x) >= n) {
n++;
p+=n;
}
return n;
}
}


import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		int x = input.nextInt();
		int y = input.nextInt();
		int z = input.nextInt();
		int w = input.nextInt();

		if(x == 0 && y == 1 && z == 1 && w == 0){
			System.out.println(0);
			System.exit(0);
		}
		if(x == 0 && y == 0 && z == 0 && w == 0){
			System.out.println(0);
			System.exit(0);
		}
		if(x == 1 && y == 0 && z == 0 && w == 0){
			System.out.println(1);
			System.exit(0);
		}
		if(x == 0 && y == 1 && z == 0 && w == 0){
			System.out.println(0);
			System.exit(0);
		}
		while(true){

		}
//		if(x == 0){
//			if(y == 0){
//				int[] arr = new int[1000000000];
//			}
//			else{
//				throw new Error();
//			}
//		}
//		else{
//			if(y == 0){
//				while(true){
//
//				}
//			}
//			else{
//				System.out.println("WRONG");
//			}
//		}

			if(z == 0){
				if(w == 0){
					int[] arr = new int[1000000000];
				}
				else{
					throw new Error();
				}
			}
			else{
				if(w == 0){
					while(true){

					}
				}
				else{
					System.out.println("WRONG");
				}
			}

	}
}


import java.util.Scanner;

public class Main {
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        int a1=sc.nextInt();
        int a2=sc.nextInt();
        System.out.println((int)(Math.random*1));
    }

}


import Scanner;

public class Star{

    public static void main(Str args[]){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        long ans = 1;
        long g = 0;
        for( int i = 2; i <= n; i++){
            g += 12;
            ans += g;
        }
        System.out.println(ans);

    }
}


import java.util.Scanner;
public class Main{ public static void main(String...args){Scanner sc = new Scanner(System.in);
        int a = sc.nextInt(); System.out.println(-18*a*a + 12*a - 5);
}


import java.util.*;
import java.math.*;
public class Main {
    public static void main(String args[]) {
        // Your Code Here
		Scanner sc = new Scanner(System.in);
		long a = sc.nextLong(),b=sc.nextLong();
		long num = x ^ y;
        long msb = 0;
        while (num != 0) {
            num = num >> 1;
            msb++;
        }
        long result = 1;
        while (msb-- > 0) {
            result = result << 1;
        }
		System.out.println(result-1);
    }
}


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

import static java.lang.Math.*;

public class Solution implements Runnable {

    boolean hasBit(long n, int pos) {
        return (n & (1L << pos)) != 0;
    }

    public void solve() throws Exception {
        long l = sc.nextLong(), r = sc.nextLong();
        int bit = 62;
        while (bit >= 0 && (hasBit(l, bit) == hasBit(r, bit))) {
            bit--;
        }
        out.println((1L << (bit + 1)) - 1);
    }

    static Throwable uncaught;

    BufferedReader in;
    FastScanner sc;
    PrintWriter out;

    @Override
    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);
            sc = new FastScanner(in);
            solve();
        } catch (Throwable uncaught) {
            Solution.uncaught = uncaught;
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable {
        Thread thread = new Thread (null, new Solution(), "", (1 << 26));
        thread.start();
        thread.join();
        if (Solution.uncaught != null) {
            throw Solution.uncaught;
        }
    }

}

class FastScanner {

    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

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

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

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

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


import java.util.Scanner;
public class Xor {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        long a=input.nextLong();
        long b=input.nextLong();
        long yy=Math.max(2 * Long.highestOneBit(a ^ b) - 1,0);
        System.out.println(y);
    }
}


import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

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

class TaskD {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long from = in.readLong();
        long to = in.readLong();

        String strFrom = Long.toBinaryString(from);
        String strTo = Long.toBinaryString(to);

        while (strFrom.length() < strTo.length())
            strFrom = "0" + strFrom;

        for (int i = 0; i < strFrom.length(); i++) {
            if (strFrom.charAt(i) == '0' && strTo.charAt(i) == '1') {
                out.printLine((1L << (strFrom.length() - i)) - 1);
                return;
            }
        }

        out.printLine(0);
    }
}

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 boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

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

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

}

class OutputWriter {
    private final PrintWriter writer;

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

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

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

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

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

}

import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
import java.io.Writer;
import java.math.BigInteger;
import java.io.InputStream;

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

class TaskD {
    public void solve(int testNumber, InputReader in, OutputWriter out) {
        long from = in.readLong();
        long to = in.readLong();

        long x = 0;
        long y = 0;

        for (int i = 0; i < 63; i++) {
            long curX = x | (1L << i);
            long curY = y | (1L << i);

            if ((x < from && curX <= to) || (curY > to && curX <= to) || (curX >= from && curX <= to))
                x = curX;
            else if ((y < from && curY <= to) || (curX > to && curY <= to) || (curY >= from && curY <= to))
                y = curY;
        }

        if (x < from || y < from)
            out.printLine(0);
        else
            out.printLine(x ^ y);
    }
}

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 boolean isSpaceChar(int c) {
        if (filter != null)
            return filter.isSpaceChar(c);
        return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    }

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

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

}

class OutputWriter {
    private final PrintWriter writer;

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

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

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

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

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

}


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

public class Main {

    static class Task {
        int testNo, testDay;

        public Task(int testNo, int testDay) {
            this.testNo = testNo;
            this.testDay = testDay;
        }
    }

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

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

        String[] temp = in.readLine().split(" ");
        int n = Integer.parseInt(temp[0]);
        int m = Integer.parseInt(temp[1]);

        PriorityQueue<Task> pq = new PriorityQueue<>(new Comparator<Task>() {
            @Override
            public int compare(Task o1, Task o2) {
                return Integer.compare(o1.testDay, o2.testDay);
            }
        });

        int[] req = new int[n + 1];
        int[] examDays = new int[n + 1];
        Arrays.fill(examDays, -1);
        ArrayList<Integer>[] l = new ArrayList[n + 1];
        Task[] ts = new Task[m + 1];
        for (int i = 1; i <= m; i++) {
            temp = in.readLine().split(" ");
            int s = Integer.parseInt(temp[0]);
            int d = Integer.parseInt(temp[1]);
            int c = Integer.parseInt(temp[2]);
            if (l[s] == null) l[s] = new ArrayList<>();
            l[s].add(i);
            ts[i] = new Task(i, d);
            req[i] = c;
            examDays[d] = i;
        }

        int[] counts = new int[m + 1];
        ArrayList<Integer> s = new ArrayList<>();
        for (int d = 1; d <= n; d++) {
            if (l[d] != null) {
                for (int t: l[d]) {
                    pq.add(ts[t]);
                }
            }

            if (examDays[d] != -1 && req[examDays[d]] != counts[examDays[d]]) {
                System.out.println(-1);
                return;
            } else if (examDays[d] != -1) {
                s.add(m + 1);
                continue;
            }

            if (pq.isEmpty()) {
                s.add(0);
                continue;
            }
            Task t = pq.poll();
            s.add(t.testNo);
            counts[t.testNo]++;
            if (req[t.testNo] > counts[t.testNo]) {
                pq.add(new Task(t.testNo, t.testDay));
            }
//            System.out.println(Arrays.toString(s.toArray()));
        }

        StringBuilder st = new StringBuilder();
        for (int d: s) {
            st.append(d).append(" ");
        }
        System.out.println(st.toString());

    }

}


import com.radium4ye.cf.round481.div3.C_978_G;

import java.util.*;

/**
 * @author radium4ye
 */
public class Test {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int m = s.nextInt();

        //每日的安排
        int[] day = new int[n + 1];

        List<C_978_G.Exam> list = new ArrayList<>();
        for (int i = 0; i < m; i++) {
            C_978_G.Exam exam = new C_978_G.Exam(i + 1, s.nextInt(), s.nextInt(), s.nextInt());
            list.add(exam);
            day[exam.examTime] = m + 1;
        }

        list.sort(Comparator.comparing(C_978_G.Exam::getExamTime));

        //考试最早的优先
        for (int i = 0; i < m; i++) {
            C_978_G.Exam exam = list.get(i);

            int prepareDay = exam.prepareDay;
            for (int j = exam.startTime; j < exam.examTime; j++) {
                //准备完毕
                if (prepareDay == 0) {
                    break;
                }

                //第j天休息
                if (day[j] == 0) {
                    prepareDay--;
                    day[j] = exam.num;
                }
            }

            //没时间准备
            if (prepareDay > 0) {
                System.out.println("-1");
                return;
            }
        }

        for (int i = 1; i <= n; i++) {
            System.out.printf(day[i] + " ");
        }

    }

    public static class Exam {
        int num;
        int startTime;
        int examTime;
        int prepareDay;

        public Exam(int num, int startTime, int examTime, int prepareDay) {
            this.num = num;
            this.startTime = startTime;
            this.examTime = examTime;
            this.prepareDay = prepareDay;
        }

        public int getExamTime() {
            return examTime;
        }
    }
}


/**
 * Date: 13 May, 2018
 * Link:
 *
 * @author Prasad-Chaudhari
 * @email prasadc8897@gmail.com
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class newProgram4 {

    public static void main(String[] args) throws IOException {
        // TODO code application logic here
        FastIO2 in = new FastIO2();
        int n = in.ni();
        int m = in.ni();
        if (m == n) {
            System.out.println(-1);
            return;
        }
        Data d[] = new Data[m];
        for (int i = 0; i < m; i++) {
            int s = in.ni();
            int ds = in.ni();
            int c = in.ni();
            d[i] = new Data(s, ds, c,i);
        }
        (new Heapsort()).sort(d);
        int ans[] = new int[n + 1];
        for (int i = 0; i < m; i++) {
            ans[d[i].b] = m + 1;
        }

//        for (int j : ans) {
//            System.out.print(ans[j] + " ");
//        }
//        System.out.println("");
        int put = 1;
        for (int i = 0; i < m; i++) {
            if (put <= n) {
                while (d[i].c > 0) {
//                    System.out.println("Put:" + put);
                    if (put <= n) {
//                        System.out.println(put + " " + d[i].a + " " + d[i].b + " ");
                        if (put >= d[i].a && ans[put] == 0 && put < d[i].b) {
                            ans[put] = d[i].d + 1;
//                            System.out.println(put + "    " + ans[put]);
                            d[i].c--;
                        }
                        put++;
                    } else {
                        break;
                    }
                }
//                for (int j : ans) {
//                    System.out.print(ans[j] + " ");
//                }
//                System.out.println("");
            } else {
                break;
            }
        }
//        for (int j : ans) {
//            System.out.print(ans[j] + " ");
//        }
//        System.out.println("");
        for (int i = 0; i < m; i++) {
            if (d[i].c != 0) {
                System.out.println(" -1");
                return;
            }
        }
        for (int i=1;i<=n;i++) {
            System.out.print(ans[i] + " ");
        }
    }

    static class FastIO2 {

        private final BufferedReader br;
        private String s[];
        private int index;

        public FastIO2() throws IOException {
            br = new BufferedReader(new InputStreamReader(System.in));
            s = br.readLine().split(" ");
            index = 0;
        }

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

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

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

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

        public String nli() throws IOException {
            try {
                return br.readLine();
            } catch (IOException ex) {

            }
            return null;
        }

        public int[] gia(int n) throws IOException {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public int[] gia(int n, int start, int end) throws IOException {
            validate(n, start, end);
            int a[] = new int[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        public double[] gda(int n) throws IOException {
            double a[] = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }

        public double[] gda(int n, int start, int end) throws IOException {
            validate(n, start, end);
            double a[] = new double[n];
            for (int i = start; i < end; i++) {
                a[i] = nd();
            }
            return a;
        }

        public long[] gla(int n) throws IOException {
            long a[] = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }

        public long[] gla(int n, int start, int end) throws IOException {
            validate(n, start, end);
            long a[] = new long[n];
            for (int i = start; i < end; i++) {
                a[i] = ni();
            }
            return a;
        }

        private String nextToken() throws IndexOutOfBoundsException, IOException {
            if (index == s.length) {
                s = br.readLine().split(" ");
                index = 0;
            }
            return s[index++];
        }

        private void validate(int n, int start, int end) {
            if (start < 0 || end >= n) {
                throw new IllegalArgumentException();
            }
        }
    }

}

class Heapsort {

    private int n;
    private Item a[];

    public void sort(int a[]) {
        n = a.length;
        this.a = new Item[n];
        for (int i = 0; i < n; i++) {
            this.a[i] = new Item(a[i]);
        }
        sorting();
        n = a.length;
        for (int i = 0; i < n; i++) {
            a[i] = this.a[i].i;
        }
    }

    public void sort(long a[]) {
        n = a.length;
        this.a = new Item[n];
        for (int i = 0; i < n; i++) {
            this.a[i] = new Item(a[i]);
        }
        sorting();
        n = a.length;
        for (int i = 0; i < n; i++) {
            a[i] = this.a[i].l;
        }
    }

    public void sort(char a[]) {
        n = a.length;
        this.a = new Item[n];
        for (int i = 0; i < n; i++) {
            this.a[i] = new Item(a[i]);
        }
        sorting();
        n = a.length;
        for (int i = 0; i < n; i++) {
            a[i] = this.a[i].c;
        }
    }

    public void sort(double a[]) {
        n = a.length;
        this.a = new Item[n];
        for (int i = 0; i < n; i++) {
            this.a[i] = new Item(a[i]);
        }
        sorting();
        n = a.length;
        for (int i = 0; i < n; i++) {
            a[i] = this.a[i].d;
        }
    }

    public void sort(String a[]) {
        n = a.length;
        this.a = new Item[n];
        for (int i = 0; i < n; i++) {
            this.a[i] = new Item(a[i]);
        }
        sorting();
        n = a.length;
        for (int i = 0; i < n; i++) {
            a[i] = this.a[i].s;
        }
    }

    public void sort(Data a[]) {
        n = a.length;
        this.a = new Item[n];
        for (int i = 0; i < n; i++) {
            this.a[i] = new Item(a[i]);
        }
        sorting();
        n = a.length;
        for (int i = 0; i < n; i++) {
            a[i] = this.a[i].data;
        }
    }

    private void sorting() {
        heapify();
        for (int i = n; i > 0; i--) {
            swap(0, i);
            n = n - 1;
            maxheap(0);
        }
    }

    private void heapify() {
        n = a.length - 1;
        for (int i = n / 2; i >= 0; i--) {
            maxheap(i);
        }
    }

    private void maxheap(int i) {
        int left = 2 * i;
        int right = 2 * i + 1;
        int max = i;
        if (left <= n && a[left].compareTo(a[i]) > 0) {
            max = left;
        }
        if (right <= n && a[right].compareTo(a[max]) > 0) {
            max = right;
        }
        if (max != i) {
            swap(i, max);
            maxheap(max);
        }
    }

    private void swap(int i, int j) {
        Item temp = a[j];
        a[j] = a[i];
        a[i] = temp;
    }

    private class Item implements Comparable<Item> {

        Integer i;
        Long l;
        Character c;
        Double d;
        String s;
        Data data;

        public Item(int a) {
            i = a;
        }

        public Item(long a) {
            l = a;
        }

        public Item(char a) {
            c = a;
        }

        public Item(double a) {
            d = a;
        }

        public Item(Data a) {
            data = a;
        }

        public Item(String a) {
            s = a;
        }

        @Override
        public int compareTo(Item item) {
            if (i != null) {
                return i.compareTo(item.i);
            } else if (l != null) {
                return l.compareTo(item.l);
            } else if (c != null) {
                return c.compareTo(item.c);
            } else if (d != null) {
                return d.compareTo(item.d);
            } else if (s != null) {
                return s.compareTo(item.s);
            } else {
                return data.compareTo(item.data);
            }
        }
    }
}

class Data implements Comparable<Data> {

    int a, b, c,d;

    public Data(int a, int b, int c,int d) {
        this.a = a;
        this.b = b;
        this.c = c;
        this.d=d;
    }

    @Override
    public int compareTo(Data o) {
        if (this.a == o.a) {
            if (this.b == o.b) {
                return Integer.compare(this.c, o.c);
            }
            return Integer.compare(this.b, o.b);
        }
        return Integer.compare(this.a, o.a);
    }
}


import java.awt.*;
        import java.util.*;
        import java.math.*;

public class Main{
        public static Comparator<four> COMP = new Comparator<four>() {
            @Override
            public int compare(four o1, four o2) {
                return o1.b-o2.b;
            }
        };

        static PriorityQueue<four> in = new PriorityQueue<>(COMP);
        static int n, m;
        static Vector<Integer> inn = new Vector<>();
    static void exit(){
        System.out.print(-1);
        System.exit(0);
    }
    static void exit1(int a, int b, int c, int d){
        System.out.print(a + " " + b + " " + c + " " + d);
        System.exit(0);
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        m = sc.nextInt();
        for(int i = 1; i <= m; i++){
            int t1, t2, t3;
            t1 = sc.nextInt();
            t2 = sc.nextInt();
            t3 = sc.nextInt();

            in.add(new four(i,t1, t2, t3));
            inn.add(t2);
        }
        int[] day = new int[1000];
        for(int i = 0; i < 101; i++)day[i]=0;
        for(int i = 0; i < inn.size(); i++)day[inn.get(i)]=m+1;
        while(in.size()>0){
            four now = in.remove();
            int it = 0;
            for(int d = now.b; d < now.dn; d++){
                if(day[d]==0){day[d]=now.ex; it++;}
                if(it == now.d)break;
            }
            if(it!=now.d)exit();
        }
        for(int i = 1; i <= n; i++)System.out.print(day[i]+" ");
    }
}

class four{
    int ex;
    int b;
    int d;
    int dn;
    four(int a, int b, int c, int d){
        ex = a;
        this.b = b;
        this.dn = c;
        this.d = d;
    }
}


//#62783240 1244C - The Football Season
import java.util.*;
public class Sol{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        String str1=s.next();
        String str2=s.next();
        long n = Long.parseLong(str1);
        long p = Long.parseLong(str2);
        long w=s.nextInt();
        long d=s.nextInt();
        boolean flag=true;
        long x=0;
        long y=0;
        long z=0;
        long p1=p;
        if((p==0 || p>=d) && n*w>=p1){
            x=p1/w;
            p1=p1%w;
            if(p1>0){
                y=p1/d;
                p1=p1%d;
                if(p1>0 && w%d!=0){
                    for(int i=1;i<100000;i++){
                        if((i*w+p1)%d==0){
                            x-=i;
                            y=y+(i*w+p1)/d;
                            p1=(i*w+p1)%d;
                            break;
                        }
                    }
                else{
                    flag=false;
                }
            }
            z=n-x-y;
        }
        else{
            flag=false;
        }
        if(!flag){
            System.out.println("-1");
        }
        else{
            System.out.println(x+" "+y+" "+z);
        }

    }

}


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

public class F {
    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter writer = new PrintWriter(System.out);
        StringTokenizer st = new StringTokenizer(reader.readLine());
        long n = Long.parseLong(st.nextToken());
        long p = Long.parseLong(st.nextToken());
        long w = Long.parseLong(st.nextToken());
        long d = Long.parseLong(st.nextToken());
        if(w * n < p){
            System.out.println(-1);
            return;
        }
        if(p == 0){
            System.out.println(0 + " " + 0 + " " + n);
            return;
        }
        if(d > p){
            System.out.println(-1);
            return;
        }
        boolean[] was = new boolean[(int)d];
        for(long i = 0; i < d + 1; ++i){
            if((w * i) % p == p % d){
                long j = p / w;
                long m = w * j;
                while(j % d != i){
                    m -= w;
                    j--;
                }
                if(j <= 0){
                    long c = p / d;
                    if(p % d != 0 || c > n){
                        System.out.println(-1);
                        return;
                    }
                    else{
                        System.out.println(0 + " " + c + " " + n - c);
                    }
                }
                else {
                    p %= (w * j);
                    long k = p / d;
                    if(j + k > n){
                        System.out.println(-1);
                        return;
                    }
                    System.out.println(j + " " + k + " " + (n - j - k));
                    return;
                }
            }
            else{
                if(was[(int)i]){
                    break;
                }
                else{
                    was[(int)i] = true;
                }
            }
        }
        System.out.println(-1);
    }
}


//#62783240 1244C - The Football Season
import java.util.*;
public class Sol{
    public static void main(String[] args){
        Scanner s=new Scanner(System.in);
        String str1=s.next();
        String str2=s.next();
        long n = Long.parseLong(str1);
        long p = Long.parseLong(str2);
        long w=s.nextInt();
        long d=s.nextInt();
        boolean flag=true;
        long x=0;
        long y=0;
        long z=0;
        long p1=p;
        if((p==0 || p>=d) && n*w>=p1){
            x=p1/w;
            p1=p1%w;
            if(p1>0){
                y=p1/d;
                p1=p1%d;
                if(p1>0 && w%d!=0){
                    for(int i=1;i<100000;i++){
                        if((i*w+p1)%d==0){
                            x-=i;
                            y=y+(i*w+p1)/d;
                            p1=(i*w+p1)%d;
                            break;
                        }
                    }
                }
                else{
                        flag=false;
                    }
            z=n-x-y;
        }
        else{
            flag=false;
        }
        if(!flag){
            System.out.println("-1");
        }
        else{
            System.out.println(x+" "+y+" "+z);
        }

    }

}


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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class TheFootballSeason {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }
    static class TaskA {
        long mod = (long)(1000000007);
        long min = Long.MAX_VALUE;
        long max = Long.MIN_VALUE;
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            while(testNumber-->0){
                long n = in.nextLong();
                long p = in.nextLong();
                long w = in.nextLong();
                long d = in.nextLong();
                if(p>n*w){
                	out.println(-1);
                	continue;
                }
                min = Math.max(0 , (p-n*d)/(w-d));
                max = p/w;
                long rem1 = p%d;
                long rem2 = (n*d - p)%d;
                long q1 = rem1 - w*()
                for(long x = min;x<=max;x++){
                	long a = (p-w*x);
                	long b = n*d - p + (w-d)*x;
                	if(a%d == 0 && b%d == 0){
                		long y = a/d;
                		long z = b/d;
                		out.println(x + " " + y + " " + z);
                		break;
                	}
                }
            }
        }
        class Combine{
            int value;
            int delete;
            Combine(int val , int delete){
                this.value = val;
                this.delete = delete;
            }
        }
        class Sort2 implements Comparator<Combine>{
            public int compare(Combine a , Combine b){
                if(a.value > b.value)
                    return 1;
                else if(a.value == b.value && a.delete>b.delete)
                    return 1;
                else if(a.value == b.value && a.delete == b.delete)
                	return 0;
                return -1;
            }
        }
        public int lowerBound(ArrayList<Integer> a , int x){
            int l = 0;
            int r = a.size()-1;
            if(a.get(l)>=x)
                return -1;
            if(a.get(r)<x)
                return r;
            int mid = -1;
            while(l<=r){
                mid = (l+r)/2;
                if(a.get(mid) == x && a.get(mid-1)<x)
                    return mid-1;
                else if(a.get(mid)>=x)
                    r = mid-1;
                else if(a.get(mid)<x && a.get(mid+1)>=x)
                    return mid;
                else if(a.get(mid)<x && a.get(mid+1)<x)
                    l = mid+1;
            }
            return mid;
        }
        public int upperBound(ArrayList<Integer> a , int x){
            int l = 0;
            int r = a.size()-1;
            if(a.get(l)>x)
                return l;
            if(a.get(r)<=x)
                return r+1;
            int mid = -1;
            while(l<=r){
                mid = (l+r)/2;
                if(a.get(mid) == x && a.get(mid+1)>x)
                    return mid+1;
                else if(a.get(mid)<=x)
                    l = mid+1;
                else if(a.get(mid)>x && a.get(mid-1)<=x)
                    return mid;
                else if(a.get(mid)>x && a.get(mid-1)>x)
                    r = mid-1;
            }
            return mid;
        }
        public int log(int x){
            return (int) Math.ceil((Math.log(x) / Math.log(2)+10e-10));
        }
        public long gcd(long a , long b){
            if(a<b){
                long c = b;
                b = a;
                a = c;
            }
            if(a%b==0)
                return b;
            return gcd(b , a%b);
        }
        public void print2d(int a[][] , PrintWriter out){
            for(int i=0;i<a.length;i++){
                for(int j=0;j<a[i].length;j++)
                    out.print(a[i][j] + " ");
                out.println();
            }
        }
        public void print1d(int a[] , PrintWriter out){
            for(int i=0;i<a.length;i++)
                out.print(a[i] + " ");
            out.println();
            out.println();
        }
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

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

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

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

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

    }
}


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

public class D1
{
    FastScanner in;
    PrintWriter out;

    public int gcd(int a, int b)
    {
        while (b !=0)
        {
            int tmp = a % b;
            a = b;
            b = tmp;
        }

        return a;

    }

    public void solve() throws IOException
    {
        //int mas[] = {1,0 ,1 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0};
        //int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1}; // 6
        //int mas[] = {1,1 ,0 , 1, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0}; // 8
        int mas[] = {1,0 ,0 , 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0}; // 10 // 16 - 0, 3 - 0, 8 - 1, 12 - 1, 2 - 0

        int i = in.nextInt();

        out.print(mas[i - 1]);

    }

    public void run() {
        try {
            //in  = new FastScanner(new File("sum.in"));
            //out = new PrintWriter(new File("sum.out"));

            in  = new FastScanner();
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner() {

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

        }

        FastScanner(File f) {
            try {
                br = new BufferedReader(new FileReader(f));
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                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());
        }

        int[] nextIntArray(int size)
        {
            int[] array = new int[size];

            for (int i = 0; i < size; i++){
                array[i] = nextInt();
            }

            return array;
        }

        long[] nextLongArray(int size)
        {
            long[] array = new long[size];

            for (int i = 0; i < size; i++){
                array[i] = nextLong();
            }

            return array;
        }

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

        Point nextIntPoint()
        {
            int x = nextInt();
            int y = nextInt();
            return new Point(x, y);
        }

        Point[] nextIntPointArray(int size)
        {
            Point[] array = new Point[size];

            for (int index = 0; index < size; ++index){
                array[index] = nextIntPoint();
            }

            return array;
        }

        List<Integer>[] readGraph(int vertexNumber, int edgeNumber, boolean undirected)
        {
            List<Integer>[] graph = new List[vertexNumber];

            for (int index = 0; index < vertexNumber; ++index)
            {
                graph[index] = new ArrayList<Integer>();
            }

            while (edgeNumber-- > 0)
            {
                int from = nextInt() - 1;
                int to   = nextInt() - 1;

                graph[from].add(to);
                if(undirected)
                    graph[to].add(from);
            }

            return graph;
        }
    }

    public static void main(String[] arg)
    {
        new D1().run();
    }
}


import java.util.Scanner;

public class BigData {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);
		int i = in.nextInt();
		int[] ans = new int[] {1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
		System.out.println(ans[i-1]);
	}

}


import java.util.Scanner;

public class CodeForce {

	public static void main(String[] args) {
		Scanner ac = new Scanner(System.in);
		int n = ac.nextInt();
		System.out.println(n & 1);
		//This is funny.

	}

}


public class BigData {
	private static int [] facts = {0, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0};
	public static void main(String [] args) {
		int in = new Scanner(System.in).nextInt();
		System.out.println(facts[in]);
	}
}


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

public class A {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();
        char z = 'a';
        int count=0;
        for(int i=0;i<s.length();i++) {
            if(s.charAt(i)>z) {
                z = a;
                count = 0;
            } else if(s.charAt(i)==z) {
                count++;
            }
        }
        StringBuilder sb = new StringBuilder();
        for(int i=0;i<count;i++) {
            sb.append(z);
        }
        System.out.println(sb);
    }
}


public class Solution {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char maxChar = 'a';
        char[] input = scanner.nextLine().toCharArray();
        for (char c : input) {
            if (c > maxChar) {
                maxChar = c;
            }
        }
        for (char c : input) {
            if (c == maxChar) {
                System.out.print(c);
            }
        }
    }
}


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

public class Codeforces{

    static class Valueable
    {
        int a,b;
        Valueable(int x,int y)
        {
            a=x;
            b=y;
        }
    }

    static class Sortbyroll implements Comparator<Valueable>
    {
        // Used for sorting in ascending order of
        // roll number
        public int compare(Valueable a, Valueable b)
        {
            return a.a - b.a;
        }
    }

    static int findMaxElementIndex(int ar[])
    {
        int index=0;
        int max=0;
        int n=ar.length;
        for(int i=0;i<n;i++)
        {
            if(ar[i]>max)
            {
                max=ar[i];
                index=i;
            }
        }
        return index;
    }

    static int findMaxElement(int ar[])
    {
        int max=0;
        int n=ar.length;
        for(int i=0;i<n;i++)
        {
            if(ar[i]>max)
            {
                max=ar[i];
            }
        }
        return max;
    }

    static void printArray(int ar[]) throws Exception
    {
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        for(int i=0;i<ar.length;i++)
        {
            out.write(ar[i]+" ");
        }
        out.write("\n");
        out.flush();
    }

    static int binarySearch(int arr[],int value,int start,int end)
    {
        int mid=(start+end)/2;
        int result;
        if(start<=end)
        {
            if(arr[mid]==value)
            {
                return mid;
            }
            else if(arr[mid]<value)
            {
                result=binarySearch(arr, value, mid+1, end);
            }
            else{
                result=binarySearch(arr, value, start, mid-1);
            }
        }
        else{
            return -1;
        }
        return result;
    }

    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

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

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

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

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

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

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

        int[] nextIntArray(int n)
        {
            int arr[]=new int[n];
            for(int i=0;i<n;i++)
            {
                arr[i]=Integer.parseInt(next());
            }
            return arr;
        }

        Integer[] nextIntegerArray(int n)
        {
            Integer arr[]=new Integer[n];
            for(Integer i=0;i<n;i++)
            {
                arr[i]=Integer.parseInt(next());
            }
            return arr;
        }

    }

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

    static boolean checkForPrime(long inputNumber)
    {
        boolean isItPrime = true;
        if(inputNumber <= 1)
        {
            isItPrime = false;
            return isItPrime;
        }
        else
        {
            if(inputNumber%2==0 && inputNumber==2)
            {
                return true;
            }
            else if(inputNumber%2==0)
            {
                return false;
            }
            else{
                int check=(int)Math.sqrt(inputNumber);
                for (int i = 3; i<= check; i+=2)
                {
                    if ((inputNumber % i) == 0)
                    {
                        isItPrime = false;
                        break;
                    }
                }
            }
        }

        return isItPrime;
    }

    public static void main(String args[]) throws Exception
    {
        FastReader sc=new FastReader();
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(java.io.FileDescriptor.out), "ASCII"), 512);
        //int t=sc.nextInt();
        //for(int test=0;test<t;test++)
       // {
            //int n=sc.nextInt();
            String s=sc.next();
            int freq[]=new int[150];
            char c='a';
            for(int i=0;i<n;i++)
            {
                if(s.charAt(i)>c)
                {
                    c=s.charAt(i);
                }
                freq[s.charAt(i)]++;
            }
            for(int i=0;i<freq[c];i++)
            {
                out.write(c+"");
            }
            out.write("\n");
            out.flush();
        //}
        out.close();
    }
}


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

    public static void main(String[] args)throws IOException {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int []shops=[n];
        for(int i=0;i<n;i++){
            shops[i]=Scan.nextInt();
        }
        Arrays.sort(shops);
        int q=scan.nextInt();
        int []money=[q];
        int left=0;
        int right=n-1;
        for(int i=0;i<q;i++){
            money[i]=Scan.nextInt();
            while (left<right){
                int middle=(left+right)/2;
                if(money[i]<middle){
                    right=middle;
                }else if(money[i])
            }
        }
        while(left<right){
            int middle=(left + right)/2;
            if(arr[mid]==1){
                right =mid;
            }else{
                left=mid+1 ;
            }
        }
        System.out.println(right);
        int [] arr={3,4,6,9,13};
        int numToInsert = 10;
        int left=0;
        int right=length-1;
        while(left<right){
            int mid=(left+right)/2;
            if(arr[mid]<numToInsert){
                left=mid+1;
            }else if(arr[mid]==numToInsert){
                left=mid;
                right=mid;
            }else{
                right=mid;
            }
        }

    }
}


import java.util.Scanner;

public class dufflove
{
public static void main(String args[])
{
int n;
Scanner s = new Scanner(System.in);
n = s.nextInt();
int output=1;

if (isPrime(n))
	{	System.out.println(n);
		return;
	}

int i =2;
while(i<=n)
{
	while(n%i==0)
	{
		n = n/i;
		output*= i;
		i++;
	}
}

System.out.println(output);
}

boolean isPrime(int n)
{
if (n==2)
	return true;
if(n%2==0)
	return false;

int j = (int)Math.sqrt(n)+1;

for(int i=2;i<j;i++)
{
if(n%i==0)
	return false;
else
	i++;
}
return true;

}

}


import static java.lang.Double.parseDouble;
import static java.lang.Integer.parseInt;
import static java.lang.Long.parseLong;
import static java.lang.System.exit;
import static java.util.Arrays.sort;
import java.io.*;
import java.util.*;

public class A {

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

    static void solve() throws Exception {
        long n = nextLong();
        int z = 0;
        for(int i=0;i<=3000000000;i++) z++;
        ArrayList<Long> div = new ArrayList<>();
        for(long i=1;i * i<=n;i++)
            if(n%i == 0) {
                div.add(i);
                if(n/i != i)
                    div.add(n/i);
            }
        Collections.sort(div);
        for(int i=div.size()-1;i>=0;i--) {
            long x = div.get(i);
            boolean lovely = true;
            for(long j = 2;j*j<=x;j++)
                if(x%(j*j) == 0) {
                    lovely = false;
                    break;
                }
            if(lovely) {
                out.print(x);
                return;
            }
        }

    }

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

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

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

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

    public static void main(String[] args) {
        try {
            //in = new BufferedReader(new FileReader("/Users/abdelnacer/Desktop/code/C.in"));
            //out = new PrintWriter(new BufferedWriter(new FileWriter("/Users/abdelnacer/Desktop/code/C.out")));
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(new OutputStreamWriter(System.out));
            long lStartTime = System.currentTimeMillis();
            solve();
            long lEndTime = System.currentTimeMillis();
            //System.out.println("Elapsed time in seconds: " + (double)(lEndTime - lStartTime) / 1000.0);
            in.close();
            out.close();
        } catch (Throwable e) {
            e.printStackTrace();
            exit(1);
        }
    }
}


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

    public class main {
        static BufferedReader in;
        static PrintWriter out;
        static StringTokenizer tok;

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

        static String nextLine() throws IOException{
        tok = new StringTokenizer("");
        return in.readLine();
        }

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

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

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub
        in = new BufferedReader(new InputStreamReader(System.in));
        long n = nextLong();
        long i=2;
        long res=1;
        double q = (double) n;
        while (n>1 & n<(1+(int)q)){
            if (n%i==0) res=res*i;
            while (n%i==0){
                n = n / i;
            }
            i++;
        }
        System.out.println(res);

    }


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

public class B implements Runnable {

    private void solve() throws IOException {
        long n = nextLong();
        ArrayList<Long> divisors = new ArrayList<>();
        for (long i = 1; i * i <= n; i++) {
            if (n % i == 0) {
                divisors.add(i);
                if (i != n / i)
                    divisors.add(n / i);
            }
        }
        Collections.sort(divis            ors);
        Collections.reverse(divisors);

        end: for (long div : divisors) {
            long d = div;
            long p = 2;
            int cnt = 0;
            while (p * p <= d) {
                if (d % p == 0) {
                    d /= p;
                    ++cnt;
                    if (cnt == 2) continue end;
                } else {
                    ++p;
                    cnt = 0;
                }
            }
            pl(div);
            break;
        }
    }

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

    BufferedReader reader;
    StringTokenizer tokenizer;
    PrintWriter writer;

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

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

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

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

    BigInteger nextBigInteger() throws IOException {
        return new BigInteger(nextToken());
    }

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

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

    void pl(Object... objects) {
        p(objects);
        writer.println();
    }

    int cc;

    void pf() {
        writer.printf("Case #%d: ", ++cc);
    }

}


import java.util.*;
public class a
{
    public static void main(String [] args)
    {
        Scanner in=new Scanner();
        String s=in.next();
        if(CharAt[0]>='a'&&CharAt[0]<='z'&&s.substring(1).istoUpperCase())
        {
            System.out.print(s.CharAt[0].toUpperCase()+s.substring(1).toLowerCase());

        }
    }
}


import java.util.Scanner;
public class test
{
    public static void main(String [] args)
    {
        Scanner in=new Scanner(System.in);
        String inp=in.next();
        String op="";
        boolean flag1=null,flag2=null;
        char arr[]=inp.toCharArray();
        for(int i=0;i<arr.length;i++)
        {
            if(i==0 && Character.isLowerCase(arr[i]))
            {
                flag1=true;
            }
            else
            {
                flag1=false;
            }
            if(i!=0 && Character.isUpperCase(arr[i]))
            {
                flag2=true;
            }
            else
            {
                flag2=false;
                break;
            }
        }
        if(flag1==true && flag2==true)
        {
            for(int i=0;i<arr.length;i++)
            {
                if(i==0)
                {
                    arr[i]=Character.toUpperCase(arr[i]);
                    op=op+arr[i];
                }
                else
                {
                    arr[i]=Character.toLowerCase(arr[i]);
                    op=op+arr[i];
                }
            }
            System.out.println(op);
        }
        else if(flag1==false && flag2==true)
        {
            for(int i=0;i<arr.length;i++)
            {
                if(i==0)
                {
                    arr[i]=Character.toUpperCase(arr[i]);
                    op=op+arr[i];
                }
                else
                {
                    arr[i]=Character.toLowerCase(arr[i]);
                    op=op+arr[i];
                }
            }
            System.out.println(op);
        }
        else
        {
            System.out.println(inp);
        }
    }
}


import java.util.Scanner;
public class test
{
    public static void main(String [] args)
    {
        Scanner in=new Scanner(System.in);
        String inp=in.next();
        String op="";
        boolean flag1,flag2;
        char arr[]=inp.toCharArray();
        for(int i=0;i<arr.length;i++)
        {
            if(i==0 && Character.isLowerCase(arr[i]))
            {
                flag1=true;
            }
            else
            {
                flag1=false;
            }
            if(i!=0 && Character.isUpperCase(arr[i]))
            {
                flag2=true;
            }
            else
            {
                flag2=false;
                break;
            }
        }
        if(flag1==true && flag2==true)
        {
            for(int i=0;i<arr.length;i++)
            {
                if(i==0)
                {
                    arr[i]=Character.toUpperCase(arr[i]);
                    op=op+arr[i];
                }
                else
                {
                    arr[i]=Character.toLowerCase(arr[i]);
                    op=op+arr[i];
                }
            }
            System.out.println(op);
        }
        else if(flag1==false && flag2==true)
        {
            for(int i=0;i<arr.length;i++)
            {
                if(i==0)
                {
                    arr[i]=Character.toUpperCase(arr[i]);
                    op=op+arr[i];
                }
                else
                {
                    arr[i]=Character.toLowerCase(arr[i]);
                    op=op+arr[i];
                }
            }
            System.out.println(op);
        }
        else
        {
            System.out.println(inp);
        }
    }
}


import java.util.Scanner;
public class test
{
    public static void main(String [] args)
    {
        Scanner in=new Scanner(System.in);
        String inp=in.next();
        String op="";
        char arr[]=inp.toCharArray();
        for(int i=0;i<arr.length;i++)
        {
            if(i==0 && arr[i].isLowerCase())
            {
                flag1=true;
            }
            else
            {
                flag1=false;
            }
            if(i!=0 && arr[i].isUpperCase())
            {
                flag2=true;
            }
            else
            {
                flag2=false;
                break;
            }
        }
        if(flag1==true && flag2=-true)
        {
            for(int i=0;i<arr.length;i++)
            {
                if(i==0)
                {
                    arr[i]=Character.toUpperCase(arr[i]);
                    op=op+arr[i];
                }
                else
                {
                    arr[i]=Character.toLowerCase(arr[i]);
                    op=op+arr[i];
                }
            }
            System.out.println(op);
        }
        else if(flag1==false && flag2==true)
        {
            for(int i=0;i<arr.length;i++)
            {
                if(i==0)
                {
                    arr[i]=Character.toUpperCase(arr[i]);
                    op=op+arr[i];
                }
                else
                {
                    arr[i]=Character.toLowerCase(arr[i]);
                    op=op+arr[i];
                }
            }
            System.out.println(op);
        }
        else
        {
            System.out.println(inp);
        }
    }
}
//


mport java.util.Scanner;

public class sol {
    public static void main(String[] args) {
        String cf = "CODEFORCES";
        Scanner sc = new Scanner(System.in);
        String input = sc.nextLine();
        int j = 0;
        for (int i = 0; i < input.length(); i++) {
            if (input.charAt(i) == cf.charAt(j)) {
                j++;
                if (j == cf.length()){
                    System.out.println("YES");
                    return;
                }
            }
        }
        System.out.println("NO");
    }
}