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

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

    static class ProblemFFibonacciStringSubsequences {
        int mod = (int) 1e9 + 7;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int n = in.nextInt(), X = in.nextInt();
            String s = in.next();
            long[][][] f = new long[101][101][101];
            long[][][] g = new long[101][101][101];
            for (int i = 0; i <= s.length(); i++) {
                for (int k = 0; k < 2; k++) {
                    String t = s.substring(0, i) + (char) (k + '0');
                    for (int j = Math.min(s.length(), i + 1); j >= 0; j--) {
                        if (s.substring(0, j).equals(t.substring(t.length() - j))) {
                            f[k][i][j] = 1;
                            if (j == s.length()) g[k][i][j] = 1;
                            break;
                        }
                    }
                }
            }
            long[] fib = new long[101];
            fib[0] = fib[1] = 1;
            for (int i = 2; i <= 100; i++) {
                fib[i] = (fib[i - 1] + fib[i - 2]) % (mod - 1);
            }
            long[] dd = new long[101];
            for (int i = 0; i <= 100; i++) {
                dd[i] = IntegerUtils.powMod(2, fib[i], mod);
            }
            for (int i = 2; i <= X; i++) {
                for (int j = 0; j <= s.length(); j++) {
                    for (int k = 0; k <= s.length(); k++) {
                        f[i][j][k] = (f[i - 1][j][k] + f[i - 2][j][k]) % mod;
                        g[i][j][k] = (g[i - 1][j][k] + g[i - 2][j][k]) % mod;
                        for (int h = 0; h <= s.length(); h++) {
                            f[i][j][k] = (f[i][j][k] + f[i - 1][j][h] * f[i - 2][h][k]) % mod;
                            g[i][j][k] = (g[i][j][k] + g[i - 1][j][h] * f[i - 2][h][k] + f[i - 1][j][h] * g[i - 2][h][k]) % mod;
                        }
                    }
                }
            }
            long ans = 0;
            for (int i = 0; i <= s.length(); i++) {
                ans = (ans + g[X][0][i]) % mod;
            }
            out.println(ans);
        }

    }

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

    }

    static class IntegerUtils {
        public static long powMod(long x, long y, int mod) {
            long ret = 1;
            x %= mod;
            while (y > 0) {
                if (y % 2 > 0) {
                    ret = ret * x % mod;
                }
                x = x * x % mod;
                y >>= 1;
            }
            return ret;
        }

    }

    static class OutputWriter extends PrintWriter {
        public OutputWriter(OutputStream out) {
            super(out);
        }

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

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

    }
}


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class F {
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        // Scanner scan = new Scanner(System.in);
        // PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n];
        // for(int i=0; i<n; i++) a[i] =  Integer.parseInt(st.nextToken());
        int n = Integer.parseInt(st.nextToken());
        int x = Integer.parseInt(st.nextToken());
        String s = bf.readLine();
        int mod = 1000000007;
        int[][][] dp = new int[n][n][x+1];
        int[][][] dp_begin = new int[n][n][x+1];
        int[][][] dp_end = new int[n][n][x+1];
        int[][][] dp_final = new int[n][n][x+1];
        int[] fibonacci = new int[x+1];
        fibonacci[0] = 1;
        if(x >= 1) fibonacci[1] = 1;
        for(int i=2; i<=x; i++)
          fibonacci[i] = (int)((fibonacci[i-1] + fibonacci[i-2]) % (mod - 1));
        for(int i=0; i<n; i++) {

              if(s.charAt(i) == '1') dp[i][i][1] = 1;
              if(s.charAt(i) == '0') dp[i][i][0] = 1;
              if(s.charAt(i) == '1') dp_begin[i][i][1] = 1;
              if(s.charAt(i) == '0') dp_begin[i][i][0] = 1;
              if(s.charAt(i) == '1') dp_end[i][i][1] = 1;
              if(s.charAt(i) == '0') dp_end[i][i][0] = 1;
              if(s.charAt(i) == '1') dp_final[i][i][1] = 1;
              if(s.charAt(i) == '0') dp_final[i][i][0] = 1;

        }
        for(int k=2; k<=x; k++) {
          for(int i=0; i<n; i++) {
            for(int j=i; j<n; j++) {

              int sum = 0;
              long toAdd = 1;
              for(int c=0; c<=j-i+1; c++) {
                toAdd = 1;
                if(c != 0) toAdd *= dp[i][i+c-1][k-1];
                if(c != j-i+1) toAdd *= dp[i+c][j][k-2];
                toAdd %= mod;

                sum = (int)((0L + sum + toAdd) % mod);
              }
              dp[i][j][k] = sum;
            }
          }
        }
        for(int k=2; k<=x; k++) {
          for(int i=0; i<n; i++) {
            for(int j=i; j<n; j++) {

              int sum = 0;
              long toAdd = 1;
              for(int c=0; c<=j-i+1; c++) {
                toAdd = 1;
                if((c != 0) && (c != j-i+1)) {
                  toAdd *= dp_begin[i][i+c-1][k-1];
                  toAdd *= dp[i+c][j][k-2];
                }
                else if(c == 0) {
                  toAdd *= exp(2, fibonacci[k-1], mod);
                  toAdd *= dp_begin[i+c][j][k-2];
                }
                else if(c == j-i+1)  {
                  toAdd *= dp_begin[i][i+c-1][k-1];
                }
                toAdd %= mod;
                sum = (int)((0L + sum + toAdd) % mod);
              }
              dp_begin[i][j][k] = sum;
            }
          }
        }
        for(int k=2; k<=x; k++) {
          for(int i=0; i<n; i++) {
            for(int j=i; j<n; j++) {

              int sum = 0;
              long toAdd = 1;
              for(int c=0; c<=j-i+1; c++) {
                toAdd = 1;
                if((c != 0) && (c != j-i+1)) {
                  toAdd *= dp[i][i+c-1][k-1];
                  toAdd *= dp_end[i+c][j][k-2];
                }
                else if(c == 0) {

                  toAdd *= dp_end[i+c][j][k-2];
                }
                else if(c == j-i+1)  {
                  toAdd *= exp(2, fibonacci[k-2], mod);
                  toAdd *= dp_end[i][i+c-1][k-1];
                }
                toAdd %= mod;
                sum = (int)((0L + sum + toAdd) % mod);
              }
              dp_end[i][j][k] = sum;
            }
          }
        }
        for(int k=2; k<=x; k++) {
          for(int i=0; i<n; i++) {
            for(int j=i; j<n; j++) {

              int sum = 0;
              long toAdd = 1;
              for(int c=0; c<=j-i+1; c++) {
                toAdd = 1;
                if((c != 0) && (c != j-i+1)) {
                  toAdd *= dp_begin[i][i+c-1][k-1];
                  toAdd *= dp_end[i+c][j][k-2];
                }
                else if(c == 0) {
                  toAdd *= 1L*exp(2, fibonacci[k-1], mod)*dp_final[i+c][j][k-2];

                }
                else if(c == j-i+1) {
                  toAdd *= 1L*dp_final[i][i+c-1][k-1]*exp(2, fibonacci[k-2], mod);
                }

                toAdd %= mod;
                sum = (int)((0L + sum + toAdd) % mod);
              }
              dp_final[i][j][k] = sum;
            }
          }
        }
        //System.out.println(dp[0][0][3]);
      //  System.out.println("Occurences: " + dp[0][n-1][x]);
        int ans = dp_final[0][n-1][x];

        System.out.println(ans);
        // out.close(); System.exit(0);
    }

    public static int exp(int base, int e, int mod) {
      if(e == 0) return 1;
      if(e == 1) return base;
      int val = exp(base, e/2, mod);
      int ans = (int)(1L*val*val % mod);
      if(e % 2 == 1)
        ans = (int)(1L*ans*base % mod);
      return ans;
    }
}


import java.util.*;
public class BullsCows {
	public static void main (String [] arg) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Guess [] G = new Guess[N];
		for (int i = 0; i<N; ++i) G[i] = new Guess(sc.next(), sc.nextInt(), sc.nextInt());
		String ans = "Incorrect data";
		int anscnt = 0;
		for (int i = 0; i<=9999; ++i) {
			String s = Integer.toString(i);
			if (s.length() < 4) s = ("0000"+s).substring(s.length(), 4+s.length());
			Guess g = new Guess(s,4,0);
			boolean works = true;
			for (int j = 0; j<G.length && works; ++j) if (!G[j].works(g)) works = false;
			if (works) ans = (anscnt++ == 0) ? s : "Need more data";
		}
		System.out.println(ans);

	}
	static class Guess {
		String n;
		int pos, num;
		int [] cnt = new int [10];
		boolean valid = true;
		public Guess (String n, int p, int nu) {
			this.n = n;
			pos = p;
			num = nu;
			for (int i = 0; i<n.length(); ++i) {
				cnt[n.charAt(i)-'0']++;
				if (cnt[i] > 1) valid = false;
			}
		}
		public boolean works (Guess t) {
			if (!t.valid || !this.valid) return false;
			int [] cnt2 = new int [10];
			int ddif2 = 0;
			for (int i = 0; i<4; ++i) {
				if (n.charAt(i) != t.n.charAt(i)) ++ddif2;
				else cnt2[n.charAt(i)-'0']++;
			}
			if (ddif2 != 4-pos) return false;
			ddif2 = 0;
			for (int i = 0; i<10; ++i) if (cnt2[i] == 0 && cnt[i] == t.cnt[i] && cnt[i] == 1) ddif2++;
			return (ddif2 == num);
		}
	}
}


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

public class Main {
	static ArrayList<String> res = new ArrayList<String>();
	public static void main(String[] args) {
		Scanner r = new Scanner(System.in);

		int n = r.nextInt();
		t[] tries = new t[n];
		for(int i = 0; i < n; i++)
			tries[i] = new t(r.next(), r.nextInt(), r.nextInt());

		dfs(0, new char[4], new boolean[4], tries, n);

		if(res.size() > 1)System.out.println("Need more data");
		else if(res.size() == 1)System.out.println(res.get(0));
		else System.out.println("Incorrect data");
	}

	private static void dfs(int i, char[] p, boolean[] v, t[] tries,int n) {
		if(i == 4){
			boolean valid = true;
			String per = new String(p);
			for(int k = 0; k < n && valid; k++){
				int c = 0;
				int hc = 0;
				for(int l = 0; l < 4; l++)
					hc += per.indexOf(tries[k].i.charAt(l))==-1?0:1;
				for(int l = 0; l < 4; l++)
					if(per.charAt(l) == tries[k].i.charAt(l)){
						hc--;c++;
					}
				if(c != tries[k].c || hc != tries[k].hc)
					valid = false;
			}
			if(valid)res.add(per);
		}else{
			for(int j = 0; j < 10; j++){
				p[i] = (char) (j+'0');
				dfs(i+1, p, v, tries, n);
			}
		}

	}
}
class t{
	String i;
	int c;
	int hc;
	public t(String i, int c, int hc){
		this.i = i;
		this.c = c;
		this.hc = hc;
	}
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

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

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();

            if (m >= n) {
                out.println(n);
            } else {
                int i;
                long ar[] = new long[Integer.MAX_VALUE];
                for (i = 0; i < ar.length; i++) {
                    if (i <= m + 1)
                        ar[i] = n;
                    else {
                        long k = (i - (m + 1));
                        ar[i] = n - (k * (k + 1) / 2);

                    }
                    //  out.println("i="+i+" val="+ar[i]);

                }

                long ans = find(ar, m);

                out.println(ans);

            }
        }

        long find(long ar[], long m) {
            int min = 1;

            int max = ar.length;
            int flag = 0;
            int mid = 0;
            while (min <= max) {
                mid = (min + max) / 2;

                if (ar[mid] == m) {
                    flag = 1;
                    break;
                } else if (ar[mid] > m) {
                    min = mid + 1;
                } else {
                    max = mid - 1;
                }

            }
            if (ar[mid] <= m)
                return mid - 1;
            else
                return mid;

        }

    }
}


import java.util.*;
public class susbus{
   public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      int k =sc.nextInt();
      int [][] result = new int[k-1][k-1];
      for (int i=0;i<k-1;i++){
         for (int j=0;j<k-1;j++){
          result[i][j]=(i+1)*(j+1);

         }
      }
      for (int i=0;i<k-1;i++){
         for (int j=0;j<k-1;j++){
            result[i][j] = convertBase(result[i][j],k);
            System.out.println(result[i][j]);
         }
      }

   }
   public static int convertBase(int n, int base){
      String nibbas = "";
      while(n>0){
         nibbas+=n%base;
         n=n/base;
      }
      String bibba = "";
      for (int i=0;i<nibbas.length();i++){
         bibba+=nibbas.charAt(nibbas.length()-i-1);
      }
      return Integer.parseInt(bibba);
   }
}


import java.util.Scanner;

/**
 * Created by max_b on 2/1/2017.
 */
public class driver {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        for(int i = 1; i<n; i++){

            for(int o = 1; o<n; o++){
                Integer p = i*o;
                String q = Integer.toString(p, n);
                System.out.print(q);
            }
            System.out.println();
        }
    }
}


import java.util.*;
public class petr {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner in = new Scanner(System.in);

		int n = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		int resposta = n-a;
		System.out.println(resposta);
	}

}


    import javax.swing.text.Segment;
    import java.awt.geom.Point2D;
    import java.io.BufferedReader;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.util.*;

    public class Main {

        static int N ;
        static int arr[];
        static boolean can ;
        static int half;
        public static void search(int idx , int s)
        {
            if(idx == N)
                if(s == half)
                    {can = true; return;}
                else return;
            search(idx+1,s+arr[idx]);
            search(idx+1,s);
        }
        public static void main(String[] args) throws Exception {

            Scanner sc = new Scanner(System.in);
            N = sc.nextInt();
            half = 0;
            arr = new int[N];
            for(int i = 0 ; i < N ; ++i)
            {
                arr[i] = sc.nextInt();
                half +=arr[i];
            }
            half/=2;
            can = false;
            search (0,0);
            System.out.println(can?"YES":"NO");
        }
        static class Scanner {
            StringTokenizer st;
            BufferedReader br;

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

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

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

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

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

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

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

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

        }

    }
    class Pair
    {
        int idx , level;
        public Pair(int i , int l )
        {
            idx = i ; level = l;
        }
    }


import java.util.Scanner;

public class CF {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int g[][] = new int[5][5];
        for (int i = 0; i < 5; i++) {
            for (int j = 0; j < 5; j++) {
                g[i][j] = sc.nextInt();
            }
        }
        int perm[] = new int[5];
        for (int i = 0; i < 5; i++) {
            perm[i] = i + 1;
        }
        int n = 5;
        int l, r;
        int ans = 0;
        for (int x = 0; x < 119; x++) {
            for (int i = n - 2; i >= 0; i--) {
                if (perm[i] < perm[i + 1]) {
                    l = i + 1;

                    for (int j = l; j < n; j++) {
                        if ((perm[j] < perm[l]) && (perm[j] > perm[i])) {
                            l = j;
                        }
                    }

                    int temp = perm[l];
                    perm[l] = perm[i];
                    perm[i] = temp;

                    l = i + 1;
                    r = n - 1;

                    for (int j = l; j <= (l + r) / 2; j++) {
                        temp = perm[j];
                        perm[j] = perm[r + l - j];
                        perm[r + l - j] = temp;
                    }

                    break;
                }
            }

            for (int i = 0; i < n; i++) {
                perm[i]--;
            }

            for (int i = 0; i < n; i++) {
                int sum =   g[perm[0]][perm[1]] + g[perm[1]][perm[0]] +
                            g[perm[1]][perm[2]] + g[perm[2]][perm[1]] +
                            g[perm[2]][perm[3]] + g[perm[3]][perm[2]] +
                            g[perm[2]][perm[3]] + g[perm[3]][perm[2]] +
                            g[perm[3]][perm[4]] + g[perm[4]][perm[3]] +
                            g[perm[3]][perm[4]] + g[perm[4]][perm[3]];

                ans = Math.max(ans, sum);
            }

            for (int i = 0; i < n; i++) {
                perm[i]++;
            }
        }

        System.out.println(ans);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
public class B {

	public static void main (String[] args) throws java.lang.Exception {
		try {
			FastScanner fs = new FastScanner();
			int a[][]=new int[3][3];
			for(int i=0;i<3;i++)
			{
				for(int j=0;j<3;j++)
				{
					a[i][j]=fs.nextInt();
				}
			}

			int flag=0;
			for(int i=0;i<100000;i++)
			{

				if(a[0][2]+a[1][2]+i==i+a[2][1]+a[2][0]) {

				for(int j=0;j<100000;j++)
				{

					if(a[0][2]+a[1][2]+i==a[0][1]+j+a[2][1]&&a[1][0]+j+a[1][2]==a[0][2]+a[1][2]+i && j+a[1][0]+a[1][2]==j+a[0][1]+a[2][1])
					{
								int temp =a[0][2]+a[1][2]+i-j-i;
						if(temp+a[0][1]+a[0][2]==temp+a[1][0]+a[2][0] && temp+a[0][1]+a[0][2]==a[0][2]+a[1][2]+i)
						{
							a[2][2]=i;
							a[1][1]=j;
							a[0][0]=temp;
							flag=1;
							break;
						}
					}

				}
				if(flag==1)
					break;
				}
			}

			for(int i=0;i<3;i++)
			{
				for(int j=0;j<3;j++)
				{
					System.out.print(a[i][j]+" ");
				}
				System.out.println();
			}

		}
		catch (Exception e)
		{
			return;
		}

	}
	static class FastScanner
    {
        BufferedReader br;
        StringTokenizer st;
        public FastScanner()
        {
            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.util.*;
public class div354Bnew2
{
	BufferedReader in;
	PrintWriter ob;
	StringTokenizer st;
	double glass[][];
	public static void main(String[] args) throws IOException {
		new div354Bnew2().run();
	}
	void run() throws IOException {
		in=new BufferedReader(new InputStreamReader(System.in));
		ob=new PrintWriter(System.out);
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		int n=ni();
		glass=new double[2500][2500];
		int t=ni();
		while(t-->0)
			fill(1,1,1.0);
		int cnt=0;
		for(int i=1;i<=40;i++)
		{
			for(int j=1;j<=i;j++)
				{
					if(glass[i][j]%1==0 && glass[i][j]==1.0)
						cnt+=1;
				}
		}
		ob.println(cnt);
	}
	void fill(int i, int j, double quantity) {
		if(glass[i][j]+quantity<=1.0)
		{
			glass[i][j]+=quantity;
		}
		else{
			double divide=quantity/2.0;
			fill(i+1,j,divide);
			fill(i+1,j+1,divide);
		}
		return;
	}
	int ni() throws IOException {
		return Integer.parseInt(nextToken());
	}
	String nextToken() throws IOException {
		if(st==null || !st.hasMoreTokens())
			st=new StringTokenizer(in.readLine());
		return st.nextToken();
	}
}


import java.util.Scanner;

public class CF {

	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long cnt=(long) (n/2+n/6+Math.log(n)/Math.log(5)+Math.log(n)/Math.log(7));
		System.out.println(n-cnt);
		sc.close();
	}
}


import java.io.*;
import java.util.*;
public class routine{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();
		int c=sc.nextInt();
		int d=sc.nextInt();
		sc.close();
		if(b>=a)
		{
			int n1=((b*c)-(a*d));
			int n2=b*c;
			int temp1 = n1;
       int temp2 = n2;

       while (n1 != n2){
         if(n1 > n2)
            n1 = n1 - n2;
         else
            n2 = n2 - n1;
       }

      int n3 = temp1 / n1 ;
      int n4 = temp2 / n1 ;

			System.out.println(n3+"/"+n4);

			//System.out.println(g+"/"+p);
		}
		else{
			int n1=((a*d)-(b*c));
			int n2=a*d;
			int temp1 = n1;
       int temp2 = n2;

       while (n1 != n2){
         if(n1 > n2)
            n1 = n1 - n2;
         else
            n2 = n2 - n1;
       }

      int n3 = temp1 / n1 ;
      int n4 = temp2 / n1 ;

			System.out.println(n3+"/"+n4);
		}
	}
}


//package C;

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

public class solver implements Runnable {

	private void solve2(long n,long m,long a,long b) {
		/*long n=nextInt();
		long m=nextInt();
		long a=nextInt();
		long b=nextInt();*/

		if(m==1 || m==n) {out.print(1); return;}

		long to=a/m;
		if(to*m<a) to++;
		long td=b/m;
		if(td*m<b) td++;

		if(to==td) {out.print(1); return;}
		if(a%m==1 && b%m==0 ) {out.print(1); return;}
		if(a%m==1) {out.print(2); return;}
		if(b%m==0) {out.print(2); return;}
		if(b-a<=m) {out.print(2); return;}
		if( (b%m+1)%m==a%m) {out.print(2); return;}
		long tp=b/m;
		if(tp*m<b) tp++;
		long tr=a/m;
		if(tr*m<a) tr++;
		if(tp==tr+1)
			{out.print(2);

			return;
			}

		out.print(3);

	}
	public void solve() throws Exception{
		long n=nextLong();
		long m=nextLong();
		/*long n=49;
		long m=7;
		for(long b=13;b<=49;b++)
			solve2(n,m,13,b);*/
		long a=nextLong();
		long b=nextLong();
		if(n>10) while(true);
		solve2(n,m,a,b);
	}

	public static void main(String[] args) {

		new solver().run();
	}

	BufferedReader in;
	StringTokenizer tokenizer;
	PrintWriter out;

	public void run() {
		try {
			in = new BufferedReader(new InputStreamReader(System.in));
			//in = new BufferedReader(new FileReader("in.txt"));
			tokenizer = null;
			out = new PrintWriter(System.out);
			//out = new PrintWriter(new File("out.txt"));
			solve();
			in.close();
			out.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());
	}

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


import java.io.*;
import java.util.*;
import java.math.BigInteger;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class forces{
    public static void main(String args[])throws IOException{
		//DataInputStream ins=new DataInputStream(System.in);
		Reader sc=new Reader();
		int t=sc.nextInt();
		int arr[]=new int[t];
		int val=0;
		for(int i=0;i<t;i++){
			arr[i]=sc.nextInt();
			val=(val+arr[i])%360;
		}
		if(val==0){
			System.out.println("YES");
		}
		else{
			int sum=0;
			HashMap<Integer, Integer> map=new HashMap<Integer, Integer>();
			for(int i=0;i<t;i++){
				sum+=arr[i];
				if(map.containsKey(arr[i])){
					sum=0;
					map.remove(arr[i]);
					//System.out.println(map);
				}
				else{
					map.put(sum, 1);
				}
			}
			if(sum==0){
				System.out.println("YES");
			}
			else{
				System.out.println("NO");
			}
		}
	}

	/*
	Code for simuntanious sorting...
		Integer[] idxs = new Integer[drag.length];
		for(int i = 0; i < drag.length; i++) idxs[i] = i;
		Arrays.sort(idxs, (o1,o2) -> Integer.compare(drag[o1], drag[o2]));

	*/

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/*

*/


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.InputStream;

/**
 * @author khokharnikunj8
 */

public class Main {
    public static void main(String[] args) {
        new Thread(null, new Runnable() {
            public void run() {
                new Main().solve();
            }
        }, "1", 1 << 26).start();
    }

    void solve() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        ScanReader in = new ScanReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        BNumbers solver = new BNumbers();
        solver.solve(1, in, out);
        out.close();
    }

    static class BNumbers {
        int mod = 1000000007;

        public void solve(int testNumber, ScanReader in, PrintWriter out) {
            int n = in.scanInt();
            int[] ar = new int[10];
            for (int i = 0; i < 10; i++) {
                ar[i] = in.scanInt();
            }
            int[][] nCr = new int[101][];
            for (int i = 0; i <= 100; i++) {
                nCr[i] = new int[i + 2];
                for (int j = 0; j <= i; j++) {
                    if (i == 0 || j == 0) nCr[i][j] = 1;
                    else nCr[i][j] = (nCr[i - 1][j - 1] + nCr[i - 1][j]) % mod;
                }
            }
            long ans = 0;
            for (int i = 1; i <= 9; i++) {
                ar[i]--;
                for (int nn = 1; nn <= n; nn++) {
                    long[][] dp = new long[2][nn];
                    dp[1][0] = 1;
                    for (int j = 0; j <= 9; j++) {
                        Arrays.fill(dp[j & 1], 0);
                        for (int k = 0; k < n; k++) {
                            for (int l = Math.max(0, ar[j]); k + l < nn; l++) {
                                dp[j & 1][k + l] = (dp[j & 1][k + l] + dp[(j - 1) & 1][k] * nCr[nn - 1 - k][l]) % mod;
                            }
                        }
                    }
                    ans = ans + dp[1][nn - 1];
                }
                ar[i]++;
            }
            out.println(ans);

        }

    }

    static class ScanReader {
        private byte[] buf = new byte[4 * 1024];
        private int index;
        private BufferedInputStream in;
        private int total;

        public ScanReader(InputStream inputStream) {
            in = new BufferedInputStream(inputStream);
        }

        private int scan() {
            if (index >= total) {
                index = 0;
                try {
                    total = in.read(buf);
                } catch (Exception e) {
                    e.printStackTrace();
                }
                if (total <= 0) return -1;
            }
            return buf[index++];
        }

        public int scanInt() {
            int integer = 0;
            int n = scan();
            while (isWhiteSpace(n)) n = scan();
            int neg = 1;
            if (n == '-') {
                neg = -1;
                n = scan();
            }
            while (!isWhiteSpace(n)) {
                if (n >= '0' && n <= '9') {
                    integer *= 10;
                    integer += n - '0';
                    n = scan();
                }
            }
            return neg * integer;
        }

        private boolean isWhiteSpace(int n) {
            if (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1) return true;
            else return false;
        }

    }
}


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

public class Main{
    public static void main(String[]args){
        fastSC sc = new fastSC();
        int sum1=0,sum2=0;
        int n = sc.nextInt();
        int x = n;
        while(n--!=0){
            sum1+=sc.nextInt();
        }
        while(x--!=0){
            sum2+=sc.nextInt();
        }
        System.out.println(sum2<sum1?"No":"Yes");
    }
    static class fastSC{
        BufferedReader br;
        StringTokenizer st;
        private fastSC(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next(){
            while(st==null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch(Exception e){
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt(){
            return Integer.parseInt(next());
        }
   }
}


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

public class Main {
    static int[][] cache;

    public static int dp(int a, int b, int[] k) {
        if (cache[a][b] != -2)
            return cache[a][b];
        if (a == b) {
            cache[a][b] = 0;
            return 0;
        }
        boolean found = false;
        for (int i = 0; i < k.length; i++) {
            if (a % k[i] == 0 || b % k[i] == 0) {
                found = true;
                break;
            }
        }
        if (!found) {
            cache[a][b] = -1;
            return -1;
        }
        int res = Integer.MAX_VALUE;
        for (int i = 0; i < k.length; i++) {
            if (a % k[i] == 0) {
                int t = 1 + dp(a / k[i], b, k);
                if (t != 0)
                    res = Math.min(res, t);
            }
            if (b % k[i] == 0) {
                int t = 1 + dp(a, b / k[i], k);
                if (t != 0)
                    res = Math.min(res, t);
            }
        }
        if (res == Integer.MAX_VALUE) {
            cache[a][b] = -1;
            return -1;
        }
        cache[a][b] = res;
        return res;
    }

    public static void main(String args[]) throws Exception {
        BufferedReader reader = new BufferedReader(new InputStreamReader(
                System.in));
        Scanner scanner = new Scanner(reader);
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int[] k = { 2, 3, 5 };
        cache = new int[a + 1][b + 1];
        for (int i = 0; i <= a; i++)
            Arrays.fill(cache[i], -2);
        System.out.println(dp(a, b, k));
        reader.close();
    }
}


import java.io.*;
import java.util.*;
import java.util.stream.IntStream;

public class Solution {

    static MyScanner sc;
    private static PrintWriter out;
    static long M = 1000000007;

    public static void main(String[] s) throws Exception {
        StringBuilder stringBuilder = new StringBuilder();
//
//        stringBuilder.append("250 250 1000000 1 ");
//
//        for (int i = 0; i < 250; i++) {
//            for (int j = 0; j < 250; j++) {
//                stringBuilder.append('Z');
//            }
//            stringBuilder.append('\n');
//        }

        if (stringBuilder.length() == 0) {
            sc = new MyScanner(System.in);
        } else {
            sc = new MyScanner(new BufferedReader(new StringReader(stringBuilder.toString())));
        }

        out = new PrintWriter(new OutputStreamWriter(System.out));

        initData();
        solve2();
        out.flush();
    }

    private static void initData() {
    }

    private static void solve() throws IOException {
        int n = sc.nextInt();
        int l = sc.nextInt();
        int[][] k = new int[l][3];

        int[] ct = new int[n];
        for (int i = 0; i < l; i++) {
            k[i][0] = sc.nextInt() - 1;
            k[i][1] = sc.nextInt() - 1;
            ct[k[i][0]]++;
            ct[k[i][1]]++;
        }
        if (l == 0) {
            out.println(0);
            return;
        }
        int left = 0;
        int right = l;

        while (left + 1 < right) {
            int m = (left + right) / 2;
            if (valid(m, k, n)) {
                right = m;
            } else {
                left = m;
            }
        }
        out.println(right);
        boolean [] vis = new boolean[n];
        for (int i = 0; i < n; i++) {
            int cur = -1;
            for (int rt = 0; rt < n; rt++) {
                if (ct[rt] == 0|| vis[rt]) continue;

                if (cur == -1 || ct[rt] > ct[cur]) cur = rt;
            }

            if (cur == -1) break;
            vis[cur] = true;
            int kk = 0;
            for (int [] p : k) {
                if (kk >= right) break;
                if (p[2] == 1) continue;

                if (p[0] == cur || p[1] == cur) {
                    p[2] = 1;
                    kk++;
                    out.print(cur + 1);
                    out.print(' ');
                    out.print(p[0] + p[1] - cur + 1);
                    out.println();
                }
            }
        }

    }

    private static boolean valid(int m, int[][] k, int n) {
        Node s = new Node();
        Node t = new Node();

        Node[][] tr = new Node[n][2];
        for (int l = 0; l < n; l++) {
            tr[l][0] = new Node();
            tr[l][1] = new Node();
            tr[l][1].next.put(tr[l][0], 1);
            tr[l][1].next.put(t, m);
            s.next.put(tr[l][0], m);
        }

        for (int[] r : k) {
            tr[r[0]][0].next.put(tr[r[1]][1], 1);
            tr[r[1]][0].next.put(tr[r[0]][1], 1);
        }

        return Path.res(s, t) >= k.length;
    }

    private static void solve2() throws IOException {
        int n = sc.nextInt();
        int k = sc.nextInt();
        int m = sc.nextInt();
        int a = sc.nextInt();
        int[][] r = new int[n][3];
        for (int i = 0; i < n; i++) {
            r[i][0] = i;
            r[i][2] = -1;
        }
        for (int p = 0; p < a; p++) {
            int x = sc.nextInt();
            r[x - 1][1]++;
            r[x - 1][2] = p;
        }
        Arrays.sort(r, (t1, t2) -> t1[1] == t2[1] ? t1[2] - t2[2] : t2[1] - t1[1]);

        int[] res = new int[n];
        Arrays.fill(res, 3);
        if (m == a) {
            for (int tt = 0; tt < k; tt++) {
                if (r[tt][1] == 0) break;
                res[r[tt][0]] = 1;
            }
        } else {
            int i = 0;
            for (; i < k; i++) {
                if (r[i][1] == 0)break;
                int x = i + 1;
                int cur = m - a;
                for (; x < n; x++) {
                    cur -= r[i][1] - r[x][1];
                    if (r[i][1] > 0) cur--;
                    if (cur < 0) {
                        break;
                    }
                }
                x--;
                if (x >= k) {
                    break;
                }
                res[r[i][0]] = 1;
            }
            for (; i < n; i++) {
                int x = i - 1;
                int cur = m - a;
                while (x >= 0) {
                    cur -= r[x][1] - r[i][1] ;
                    if (r[x][1] > 0) cur--;
                    if (cur < 0) {
                        break;
                    }
                    x--;
                }
                x++;
                if (x >= k) {
                    break;
                }
                res[r[i][0]] = 2;
            }

        }
        for (int i : res) {
            out.print(i);
            out.print(" ");
        }

//        System.out.println(Arrays.deepToString(r));
    }

    private static final class Path {
        Node to;
        int val = Integer.MAX_VALUE;
        private Path prev;

        public Path() {
        }

        public Path(Path value, Node key, int curVal) {
            val = Math.min(value.val, curVal);
            prev = value;
            to = key;
        }

        static Path find(Node sn, Node tn) {
            Set<Node> visited = new HashSet<>();
            LinkedList<NodePath> toVisit = new LinkedList<>();
            toVisit.add(new NodePath(sn, new Path()));
            while (!toVisit.isEmpty()) {
                NodePath next = toVisit.removeLast();
                for (Map.Entry<Node, Integer> val : next.node.next.entrySet()) {
                    if (val.getKey() == tn) {
                        return new Path(next.path, val.getKey(), val.getValue());
                    }
                    if (visited.contains(val.getKey())) {
                        continue;
                    }
                    visited.add(val.getKey());
                    toVisit.add(new NodePath(val.getKey(), new Path(next.path, val.getKey(), val.getValue())));
                }
            }
            return null;
        }

        private static final class NodePath {
            Node node;
            Path path;

            public NodePath(Node node, Path path) {
                this.node = node;
                this.path = path;
            }
        }

        static int res(Node sn, Node tn) {
            int result = 0;
            Path path = null;
            while ((path = find(sn, tn)) != null) {

                result += path.getValue();
                path.affect(sn);

            }
            return result;
        }

        public int getValue() {
            return val;
        }

        public void affect(Node sn) {
            affect(sn, val);
        }

        private void affect(Node sn, int val) {
            Node prev1 = prev.to;
            if (prev1 == null) {
                prev1 = sn;
            }
            int prevVal = prev1.next.get(to);
            if (prevVal > val) {
                prev1.next.put(to, prevVal - val);
            } else {
                prev1.next.remove(to);
            }
            to.next.put(prev1, to.next.getOrDefault(prev1, 0) + val);

            if (prev.to != null) {
                prev.affect(sn, val);
            }
        }
    }

    private static final class Node {
        private final String name;
        private HashMap<Node, Integer> next = new HashMap<>();

        public Node() {
            this.name = null;
        }

        public Node(String s) {
            this.name = s;
        }
    }

    private static void solveT() throws IOException {
        int t = sc.nextInt();
        while (t-- > 0) {
            solve();
        }
    }

    private static long gcd(long l, long l1) {
        if (l > l1) return gcd(l1, l);
        if (l == 0) return l1;
        return gcd(l1 % l, l);
    }

    private static long pow(long a, long b, long m) {
        if (b == 0) return 1;
        if (b == 1) return a;
        long pp = pow(a, b / 2, m);
        pp *= pp;
        pp %= m;
        return (pp * (b % 2 == 0 ? 1 : a)) % m;
    }

    static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        MyScanner(BufferedReader br) {
            this.br = br;
        }

        public MyScanner(InputStream in) {
            this(new BufferedReader(new InputStreamReader(in)));
        }

        void findToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
        }

        String next() {
            findToken();
            return st.nextToken();
        }

        Integer[] nab(int n) {
            Integer[] k = new Integer[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.fi();
            }
            return k;
        }

        int[] na(int n) {
            int[] k = new int[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.fi();
            }
            return k;
        }

        long[] nl(int n) {
            long[] k = new long[n];
            for (int i = 0; i < n; i++) {
                k[i] = sc.nextLong();
            }
            return k;
        }

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

        int fi() {
            String t = next();
            int cur = 0;
            boolean n = t.charAt(0) == '-';
            for (int a = n ? 1 : 0; a < t.length(); a++) {
                cur = cur * 10 + t.charAt(a) - '0';
            }
            return n ? -cur : cur;
        }

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

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

}


import java.util.Scanner;

public class Expressions {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner s =new Scanner(System.in);
		int a=s.nextInt();
		int b=s.nextInt();
		int c=s.nextInt();
		int ans=0;

		while(true) {
		if(a==1 && b==1 && c==1) {
			ans= a+b+c;
			System.out.println(ans);
			break;
		}

		if(a==1) {
			ans= Math.max( (a+b)*c, (a+c)*b);
		}else if(b==1) {
			ans= Math.max( (a+b)*c, (b+c)*a);
		}else if(c==1) {
			ans= Math.max( (a+c)*b, (b+c)*a);
		}else if(a==1 && b==1){
			ans= (a+b)*c;
		}else if(a==1 && c==1) {
			ans= (a+c)*b;
		}else if(b==1 && c==1) {
			ans= (b+c)*a;
		}else {
			ans= a*b*c;
		}
		System.out.println(ans);
	}
	}

}


import java.util.Scanner;

public class Task1 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		int[] arr = new int[n];
		int ones = 0;
		for (int i = 0; i < n; i++) {
			int x = sc.nextInt();
			if(x == 1) {
				ones++;
			}
			arr[i] = x;
		}
		int nones = n-ones;
		int to;
		if(ones > nones) {
			to = -1;
		} else {
			to = 1;
		}
		int max = 0;
		int max2 = 0;
		for (int i = 1; i <= k; i++) {
			int count = 0;
			int count2 = 0;
			for (int j = i-1; j < n; j += k) {
				if(arr[j] == to) {
					count++;
				} else {
					count2++;
				}
			}
			if(count > max) {
				max = count;
				max2 = count2;
			}
		}

		if(ones > nones) {
			System.out.println(((ones - max2) - (nones - max)));
		} else {
			System.out.println(((nones - max2) - (ones - max)));
		}

		sc.close();
	}

}


import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        //Test String.
        int dummyvar = read.nextInt();
        String myString = read.nextLine()+" ";
        //Initalizing Volume.
        int volume = 0,spaceIndex = 0;
        //Solution.
        for (int x = 0;x<myString.length();++x){
            if(myString.charAt(x) == ' '){
                String thisWord = myString.substring(spaceIndex,x);
                volume = java.lang.Math.max(volume,
                    wordVolumeCount(thisWord));
                spaceIndex = x+1;
            }
        }
        //Result.
        System.out.println(volume);
    }
    //Determining number of Capital Letters in given Word.
    public static int wordVolumeCount(String testWord){
        int count = 0;
        for(int x = 0;x<testWord.length();++x){
            if(isCharUpperCase(testWord.charAt(x))){
                ++count;
            }
        }
        return count;
    }
    //To Determing if given Letter is Upper Case.
    public static boolean isCharUpperCase(char testChar){
        boolean found = false;
        for (int x = 0;!found && x<Main.alphabet.length();++x){
            if(testChar == alphabet.charAt(x)){
                found = true;
            }
        }
        return found;
    }
    //Input.
    static Scanner read = new Scanner(System.in);
    //Storing all Upper Case Characters.
    static String alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}


import java.io.*;
import java.util.*;
import static java.lang.Math.*;
import static java.util.Arrays.fill;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.sort;

public class Main {
	public static void main(String[] args) throws IOException {
		new Thread(null, new Runnable() {
			public void run() {
				try {
					try {
						if (new File("input.txt").exists())
							System.setIn(new FileInputStream("input.txt"));
					} catch (SecurityException e) {}

					long prevTime = System.currentTimeMillis();
					new Main().run();
					System.err.println("Total time: " + (System.currentTimeMillis() - prevTime) + " ms");
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}, "1", 1L << 24).start();
	}

	void run() throws IOException {
		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);
		solve();
		out.close();
	}

	char[] col;
	int ans = 0;
	boolean[] used = new boolean [6];
	int[] perm = new int [6];

	Set<Integer> set = new HashSet<Integer> (100000);

	void solve() throws IOException  {
		col = nextToken().toCharArray();
		rec(0);
		out.println(ans);
	}

	void rec(int n) {
		if (n == 6) {
			check();
		} else {
			for (int i = 0; i < 6; i++) {
				if (!used[i]) {
					used[i] = true;
					perm[n] = i;
					rec(n + 1);
					used[i] = false;
				}
			}
		}
	}

	char[] cube = new char [6];

	void check() {
		for (int i = 0; i < 6; i++)
			cube[i] = col[perm[i]];
		if (!has(cube)) {
			ans++;
			add(cube);
		}
	}

	boolean has(char[] cube) {
		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 4; j++)
				for (int k = 0; k < 4; k++)
					if (set.contains(code(i, j, k, cube)))
						return true;
		return false;
	}

	void add(char[] cube) {
		for (int i = 0; i < 4; i++)
			for (int j = 0; j < 4; j++)
				for (int k = 0; k < 4; k++)
					set.add(code(i, j, k, cube));
	}

	char[] s = new char [6];

	int code(int x, int y, int z, char[] cube) {
		System.arraycopy(cube, 0, s, 0, 6);
		for (int i = 0; i < x; i++)
			rotateX(s);
		for (int i = 0; i < y; i++)
			rotateY(s);
		for (int i = 0; i < z; i++)
			rotateZ(s);
		return code(s);
	}

	int code(char[] s) {
		int ret = 0;
		for (int i = 0; i < 6; i++)
			ret = ret * 6 + s[i];
		return ret;
	}

	char[] t = new char [6];
	int[] xr = { 1, 2, 3, 0, 4, 5 };
	int[] yr = { 0, 5, 2, 4, 1, 3 };
	int[] zr = { 4, 1, 5, 3, 2, 0 };

	void rotateX(char[] s) {
		for (int i = 0; i < 6; i++)
			t[i] = s[xr[i]];
		System.arraycopy(t, 0, s, 0, 6);
	}

	void rotateY(char[] s) {
		for (int i = 0; i < 6; i++)
			t[i] = s[yr[i]];
		System.arraycopy(t, 0, s, 0, 6);
	}

	void rotateZ(char[] s) {
		for (int i = 0; i < 6; i++)
			t[i] = s[zr[i]];
		System.arraycopy(t, 0, s, 0, 6);
	}

	/***************************************************************
	 * Input
	 **************************************************************/
	BufferedReader in;
	PrintWriter out;
	StringTokenizer st = new StringTokenizer("");

	String nextToken() throws IOException {
		while (!st.hasMoreTokens())
			st = new StringTokenizer(in.readLine());
		return st.nextToken();
	}

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

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

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

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

	boolean EOF() throws IOException {
		while (!st.hasMoreTokens()) {
			String s = in.readLine();
			if (s == null)
				return true;
			st = new StringTokenizer(s);
		}
		return false;
	}

	/***************************************************************
	 * Output
	 **************************************************************/
	void printRepeat(String s, int count) {
		for (int i = 0; i < count; i++)
			out.print(s);
	}

	void printArray(int[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(long[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.print(array[i]);
		}
		out.println();
	}

	void printArray(double[] array, String spec) {
		for (int i = 0; i < array.length; i++) {
			if (i > 0) out.print(' ');
			out.printf(Locale.US, spec, array[i]);
		}
		out.println();
	}

	void printArray(Object[] array) {
		boolean blank = false;
		for (Object x : array) {
			if (blank) out.print(' '); else blank = true;
			out.print(x);
		}
		out.println();
	}

	@SuppressWarnings("rawtypes")
	void printCollection(Collection collection) {
		boolean blank = false;
		for (Object x : collection) {
			if (blank) out.print(' '); else blank = true;
			out.print(x);
		}
		out.println();
	}

	/***************************************************************
	 * Utility
	 **************************************************************/
	void checkMemory() {
		System.err.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory() >> 20) + "/" + (Runtime.getRuntime().totalMemory() >> 20) + " MB");
	}

	long prevTimeStamp = Long.MIN_VALUE;

	void updateTimer() {
		prevTimeStamp = System.currentTimeMillis();
	}

	void checkTimer() {
		System.err.println((System.currentTimeMillis() - prevTimeStamp) + " ms");
	}
}


import java.util.*;
public class TripForMeal {

	public static void main(String[] args) {

		int n,a,b,c;
		Scanner src = new Scanner(System.in);

		do
		{
			n = src.nextInt();
		}
		while((n<1)||(n>100));

		do
		{
			a = src.nextInt();
		}
		while((a<1)||(a>100));

		do
		{
			b = src.nextInt();
		}
		while((b<1)||(b>100));

		do
		{
			c = src.nextInt();
		}
		while((c<1)||(c>100));

		src.close();

		int t=0;
		n = n-1;
		while(n!=0)
		{
		if(b<a)
		{
			n=n-1;
			t=t+b;

			if(b<c)
			{
				n=n-1;
				t=t+b;
			}
			else
			{
				n=n-1;
				t=t+c;
			}
		}
		else
		{
			n=n-1;
			t=t+a;

			if(a<c)
			{
				n=n-1;
				t=t+a;
			}
			else
			{
				n=n-1;
				t=t+c;
			}
		}
		}

		System.out.println(t);

	}

}


import java.io.*;
import java.util.*;
import java.math.*;
import java.math.BigInteger;
public final class codeForces
{
    static StringBuilder ans=new StringBuilder();;
    static FastReader in=new FastReader();
    static ArrayList<ArrayList<Integer>> g=new ArrayList<ArrayList<Integer>>();
    static int max=0;

    static boolean set[];
    public static void main(String args[])
    {
        int N=in.nextInt();
        if(N%4==0)
        {
            System.out.println((N/4)+1);
        }
        else System.out.println(0);

    }

    static void DFS(int N,int d)
    {
        set[N]=true;
        d++;
        max=Math.max(max,d);
        for(int i=0; i<g.get(N).size(); i++)
        {
            int c=g.get(N).get(i);
            if(set[c]==false)
            {
                DFS(c,d);
            }
        }
    }

    static int countBits(long a)
    {
        return (int)(Math.log(a)/Math.log(2)+1);
    }
    //fucntions
    //fucntions
    //fucntions
    //fucntions
    static int[] input(int A[]) //input of Int Array
    {
        FastReader in=new FastReader();
        int N=A.length;
        for(int i=0; i<N; i++)
        {
            A[i]=in.nextInt();
        }
        return A;
    }

    static long[] input(long A[]) //Input of long Array
    {
        FastReader in=new FastReader();
        for(int i=0; i<A.length; i++)A[i]=in.nextLong();
        return A;
    }

    static int GCD(int a,int b) //wrong output if a ||b are intially zero
    {
        if(b==0)
        {
            return a;
        }
        else return GCD(b,a%b );
    }

    static boolean isPrime(int N)
    {
        for(int i=2; i*i<N; i++)
            if(N%i==0)return false;
        return true;
    }

}
//Code For FastReader
//Code For FastReader
//Code For FastReader
//Code For FastReader
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.util.Scanner;

public class Businesstrip {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in) ;
		while (sc.hasNext())
		{
			int n = sc.nextInt() ;
			int[] arr = new int[12] ;
			boolean[] bol = new boolean[12] ;
			int counter = 0 ;
			int index = 0 ;
			int max = 0 ;
			for (int i = 0; i < arr.length; i++) {
				arr[i] = sc.nextInt() ;
			}

			while (n > 0) {
				max = 0 ;
				for (int i = 0; i < 12; i++) {
					if (arr[i] > max && !bol[i]) {max = arr[i] ; index = i ;}

				}
				//System.out.println("index : "+arr[index]);
				bol[index] = true ;
				n -= max ;
				counter ++ ;
			}
			System.out.println(counter);
		}
	}

}


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

import static java.lang.Math.*;

public class Main implements Runnable {

    final boolean file = false;

    int dx[] = new int[] {-1,-1,1,1};
    int dy[] = new int[] {-1,1,-1,1};

    void solve() throws Exception {
        int n = sc.nextInt();
        int m = sc.nextInt();
        int need = sc.nextInt();
        int color[][] = new int[n][m];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if ((i + j) % 2 != 0) continue;
                color[i][j] = 0;
            }
        }
        int recolor[] = new int[n * m];
        int w;
        for (int step = 1;; step++) {
            w = 0;
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    if ((i + j) % 2 != 0 || color[i][j] != step - 1) continue;
                    boolean ok = true;
                    for (int k = 0; k < 4; k++) {
                        int x = i + dx[k];
                        int y = j + dy[k];
                        if (x < 0 || x >= n || y < 0 || y >= m || color[x][y] != step - 1) {
                            ok = false;
                            break;
                        }
                    }
                    if (ok) {
                        recolor[w++] = i * m + j;
                    }
                }
            }
            if (w == 0) break;

            for (int i = 0; i < w; i++) {
                int id = recolor[i];
                int x = id / m;
                int y = id % m;
                color[x][y] = step;
            }
        }
        int res = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                if ((i + j) % 2 != 0) continue;
                if (color[i][j] == need - 1) res++;
            }
        }
        out.println(res);
    }

    BufferedReader in;
    PrintWriter out;
    FastScanner sc;

    static Throwable uncaught;

    public void run() {
        try {
            if (file) {
                in = new BufferedReader(new FileReader("strings.in"));
                out = new PrintWriter(new FileWriter("strings.out"));
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            sc = new FastScanner(in);
            solve();
        } catch (Throwable t) {
            Main.uncaught = t;
        } finally {
            out.close();
        }
    }

    public static void main(String[] args) throws Throwable {
        Thread t = new Thread(null, new Main(), "", 128 * 1024 * 1024);
        t.start();
        t.join();
        if (uncaught != null) {
            throw uncaught;
        }
    }

}

class FastScanner {

    BufferedReader reader;
    StringTokenizer strTok;

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

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

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

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

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

}


import java.util.Scanner;

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

		int len = sc.nextInt();

		int noless = sc.nextInt();
		int nomore = sc.nextInt();

		int a = len-noless;

		while(len-a>nomore)
		{
			a--;
		}
		System.out.println(a);
	}
}


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

public class Problems {

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

        new Problems().runMain();
    }

    void runMain() {
		Scanner sc = new Scanner(System.in);

        int n = sc.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        float max = 0;
        for (int i = 0; i < n; i++) {
        	a[i] = sc.nextInt();
        	if (i > 0) {
        		max = lcm(a[i], a[i-1]);
        	} else {
        		max = a[0];
        	}
        }
        for (int i = 0; i < n; i++) {
        	b[i] = sc.nextInt();
        }

        float counter = 0;
        for (int i = 1; i <= max; i++) {
        	for (int j = 0; j < n; j++) {
        		if (i % a[j] == b[j]) {
        			counter++;
        			break;
        		}
        	}
        }
        System.out.printf("%.5f", counter/max);
    }

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

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


import java.util.Scanner;
public class problemC {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        int start = 0;
        boolean sIndex = true;
        boolean eIndex = true;
        int ctr=0;
        int max = s.nextInt();
        int end = max - 1;
        int n = s.nextInt();

        int nums[] = new int[max];

        for(int i=0;i<max;i++)
        {
            nums[i]=s.nextInt();
        }
         int c = 0;
         for(int i = start; (sIndex || eIndex) && start <= end && end >= start;) {
            if(i == start) {

                if(nums[i] <= n) {
                     start++;
                    ctr++;
                }
                else {
                    sIndex = false;
                }
                i = end;
            }
            else {

                if(nums[i] <= n) {
                    end--;
                    ctr++;
                }
                else {
                    eIndex = false;
                }
                i = start;
            }
        }

        System.out.println(ctr);
        s.close();
    }

}


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

public class P12B {
    P12B (){
        Scanner sc = new Scanner(System.in);
        int number = sc.nextInt();
        int result = sc.nextInt();
        sc.close();

        ArrayList<Integer> digits = new ArrayList<>();
        int zeros = 1;
        int digit = number % 10;
        if (digit == 0){
            zeros*=10;
        }
        else {
            digits.add(digit);
        }
        number /= 10;
        while (number > 0){
            digit = number % 10;
            number /= 10;
            if (digit == 0){
                zeros *= 10;
            }
            else if (digits.isEmpty()){
                digits.add(digit);
            }
            else if (digits.get(0) >= digit){
                digits.add(0, digit);
            }
            else if (digits.get(digits.size()-1) <= digit){
                digits.add(digit);
            }
            else {
                for (int i = 1; i < digits.size(); i++){
                    if (digits.get(i) > digit){
                        digits.add(i-1, digit);
                    }
                }
            }
        }

        int min = digits.get(0);
        min = min * zeros;
        for (int i = 1; i < digits.size(); i++){
            min = min * 10 + digits.get(i);
        }

        if (min == result){
            System.out.println("OK");
        }
        else {
            System.out.println("WRONG_ANSWER");
        }
    }

    public static void main (String []args){
        new P12B();
    }
}


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

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;

public class  Main  {

	//ArrayList<Integer> lis = new ArrayList<Integer>();
	//ArrayList<String> lis = new ArrayList<String>();
	//ArrayList<test> lis = new ArrayList<test>();
	static long sum=0;
//	static boolean f=false;
	//static String s[],r="";
	static int dx[]={1,-1,0,0};
	static int dy[]={0,0,1,-1};

public  static void main(String[] args) throws IOException {
   //googlein.txt C-small-attempt0.in
//	Scanner sc =new Scanner(new File("file.txt"));
	 Scanner sc =new Scanner(System.in);
	  //File file = new File("file.txt");
	//	PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(file)));
	//	sc.useDelimiter("(\\s)+|[,]");

	  while(sc.hasNext()){
		   //long sum=0;
	//	  int n=sc.nextInt(),m=sc.nextInt(),k=sc.nextInt();
		double a=sc.nextDouble(),b=sc.nextDouble(),m=sc.nextDouble();
		double x=sc.nextDouble(),y=abs(sc.nextDouble()),z=sc.nextDouble();
		double ax=0,az=0;
		double t=m/abs(y);
		double xx=(abs(x)*t-a/2);

		if(xx<1)ax=x*t+a/2;
		else{
		 if((int)(xx/a)%2==0){ if(0<x)ax=a-(xx-(int)(xx/a)*a);else ax=xx-(int)(xx/a)*a; }
		 else 	{ if(x<0)ax=a-(xx-(int)(xx/a)*a);else ax=xx-(int)(xx/a)*a; }
		}
		double zz=t*z;
		if( (int)(zz/b)%2==0 ){ az=zz-(int)(zz/b)*b; }
		else az=b-(zz-(int)(zz/b)*b);
		//db(t,xx,zz);
		System.out.println(ax+" "+az);

	  }

}

	// db("Case #"+(k)+": "+c);
	 //	pw.println("Case #"+(k)+": "+c);

	 	//pw.flush();
	 	//pw.close();

    static void db(Object... os){
	         System.err.println(Arrays.deepToString(os));

	}

}

/*class P implements Comparable<P>{
    int v,vv,t;
	P(int v,int vv,int t){
		this.v=v;
	    this.vv=vv;
	    this.t=t;
	}
	  public int compareTo(P x){
          return t-x.t;
	   }

}*/


import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;
import java.util.Stack;

public class Main {
    static char[][] g = new char[8][8];
    static int[][] s = new int[8][8];
    static int[] di = { 1, -1, 1, -1, 1, -1, 0, 0, 0 };
    static int[] dj = { 0, 0, -1, 1, 1, -1, 1, -1, 0 };

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        for (int i = 0; i < 8; i++)
            g[i] = in.next().toCharArray();
        for (int i = 0; i < g.length; i++)
            for (int j = 0; j < g.length; j++)
                if (g[i][j] == 'S')
                    s[i][j] = 1;
        if (solve())
            System.out.println("WIN");
        else
            System.out.println("LOSE");
    }

    public static boolean solve() {
        for (int i = 0; i < g.length; i++)
            for (int j = 0; j < g.length; j++)
                if (s[i][j] == 1)
                    for (int x = 1; x < 8 - i; x++)
                        if (s[i + x][j] == 0)
                            s[i + x][j] = x + 1;
                        else
                            break;
        boolean[][] v = new boolean[8][8];
        Stack<state> q = new Stack<state>();
        q.add(new state(7, 0, 1));
        int i, j, cur;
        state n;
        while (!q.isEmpty()) {
            n = q.pop();
            i = n.i;
            j = n.j;
            cur = n.c;
            if (i < 0 || i > 7 || j < 0 || j > 7
                    || (s[i][j] + 1 == cur && s[i][j] != 0)
                    || (s[i][j] == cur && s[i][j] != 0) || v[i][j])
                continue;
            if (i == 0 && j == 7)
                return true;
            if (s[i][j] == 0)
                v[i][j] = true;
            for (int x = 0; x < di.length; x++)
                q.push(new state(i + di[x], j + dj[x], cur + 1));
        }
        return false;
    }

    static class state {
        int i, j, c;

        public state(int ii, int jj, int cc) {
            i = ii;
            j = jj;
            c = cc;
        }
    }
}


import java.util.Scanner;
public class  Main{
public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        long n=input.nextLong();
        if(n>=3){
          if(n%2==0){
            if(n%3==0){
              n-=1;
            System.out.println(LCM(n,LCM(n-1, n-2)));}
            else
               System.out.println(LCM(n,LCM(n-1, n-3)));

          }
          else
           System.out.println(LCM(n,LCM(n-1, n-2)));

          }

     else if(n==2)
            System.out.println(LCM(n,n-1));
        else
            System.out.println(n);
}

public static long LCM(long a,long b){
      long temp1=a;
      long temp2=b;
      while(a!=b){
         if(b<a)
           b+=temp2;
         else if(a<b)
             a+=temp1;
        }
      return a;
  }
}


import java.io.*;
public class AmityAssessment {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
		int x = -1;
		String s = br.readLine();
		String [] B1 = new String[2];
		B1[0] = s.charAt(0)+"";
		B1[1] = s.charAt(1)+"";
		if(B1[0].equals("X")){
			x=0;
		}else if(B1[1].equals("X")){
			x=1;
		}
		s = br.readLine();
		String [] B2 = new String[2];
		B2[0] = s.charAt(0)+"";
		B2[1] = s.charAt(1)+"";
		if(B2[0].equals("X")){
			x=2;
		}else if(B2[1].equals("X")){
			x=3;
		}
		s = br.readLine();
		String [] A1 = new String[2];
		A1[0] = s.charAt(0)+"";
		A1[1] = s.charAt(1)+"";
		s = br.readLine();
		String [] A2 = new String[2];
		A2[0] = s.charAt(0)+"";
		A2[1] = s.charAt(1)+"";
		int count =1;
		boolean flag = false;
		while(count <= 12){
			count++;
			if(x==0){
				B1[0] = B1[1];

				B1[1] = "X";
			}else if(x==1){
				B1[1] = B2[1];

				B2[1] = "X";
			}else if(x==2){

				B2[0] = B1[0];
				B1[0] = "X";
			}else if(x==3){
				B2[1] = B2[0];
				B2[0] = "X";
			}
			if(B1[0].equals(A1[0]) && B1[1].equals(A1[1]) && B2[0].equals(A2[0]) && B2[1].equals(A2[1])){
				flag = true;
				break;
			}
			if(B1[0].equals("X")){
				x=0;
			}else if(B1[1].equals("X")){
				x=1;
			}else if(B1[0].equals("X")){
				x=0;
			}else if(B1[1].equals("X")){
				x=1;
			}
		}
		if(flag){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

}


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

public class Duff_In_Love {

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader t = new FastReader();
		PrintWriter o = new PrintWriter(System.out);
		long n = t.nextLong();
		long m = n / 2, k = n;
		boolean a[] = new boolean[(int) m], flag = false;

		for (int i = 1; i < m; i++) {
			int j = i, p = (i + 1) * (i + 1);

			if (!a[i]) {
				j = p - 1;

				while (j < m) {
					a[j] = true;
					j += p;
				}
			}
		}

		for (int i = 1; i < m; i++) {
			if ((a[i] && n % (i + 1) == 0) || (i + 1) * (i + 1) == n) {
				flag = true;
				break;
			}
		}

		if (flag) {
			for (int i = (int) m - 1; i >= 1; i--) {
				if (!a[i] && (n % (i + 1)) == 0) {
					o.println(i + 1);
					break;
				}
			}
		} else
			o.println(n);

		o.flush();
		o.close();
	}
}


import java.io.*;
import java.util.Deque;
import java.util.StringTokenizer;
import java.util.concurrent.LinkedBlockingDeque;

public class Main {
    public static void main(String args[]) {
        InputStream inputStream;
        OutputStream outputStream;
        try {
            inputStream = System.in;
            outputStream = System.out;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        InputReader inputReader = new InputReader(inputStream);
        PrintWriter printWriter = new PrintWriter(outputStream);
        TaskSolver solver = new TaskSolver(inputReader, printWriter);
        solver.solve();
        printWriter.close();
    }
}

class TaskSolver {
    private InputReader in;
    private PrintWriter out;

    public TaskSolver(InputReader inputReader, PrintWriter printWriter) {
        in = inputReader;
        out = printWriter;
    }

    private int[] dx = {1, -1, 0, 0, 1, -1, -1, 1, 0};
    private int[] dy = {0, 0, 1, -1, 1, -1, 1, -1, 0};

    private boolean isEmptyBit(int x, int y, long table) {
        return (table & (1L << (8 * x + y))) == 0;
    }

    private boolean bfs(int x, int y, long table) {
        Deque<Integer> q = new LinkedBlockingDeque<Integer>();
        Deque<Long> qTables = new LinkedBlockingDeque<Long>();
        q.addLast(x);
        q.addLast(y);
        qTables.addFirst(table);
        while (!q.isEmpty()) {
            x = q.pollFirst();
            y = q.pollFirst();
            table = qTables.pollFirst();
            if (!isEmptyBit(x, y, table))
                continue;
            for (int i = 0; i < dx.length; i++) {
                int x1 = x + dx[i], y1 = y + dy[i];
                if (x1 < 0 || x1 >= 8 || y1 < 0 || y1 >= 8)
                    continue;
                if (!isEmptyBit(x1, y1, table))
                    continue;
                if (x1 == 0 && y1 == 7)
                    return true;
                if (x == x1 && y == y1 && (table != table << 8)) {
                    q.addLast(x1);
                    q.addLast(y1);
                    qTables.addLast(table << 8);
                } else if (x != x1 || y != y1) {
                    q.addFirst(y1);
                    q.addFirst(x1);
                    qTables.addFirst(table << 8);
                }
            }
        }
        return false;
    }

    public void solve() {
        String s = null;
        long table = 0;
        for (int i = 0; i < 8; i++) {
            s = in.next();
            for (int j = 0; j < 8; j++) {
                if (s.charAt(j) == 'S') {
                    table |= (1L << (8 * i + j));
                }
            }
        }
        if (bfs(7, 0, table)) {
            out.println("WIN");
        } else {
            out.println("LOSE");
        }
    }
}

class InputReader {
    private BufferedReader reader;
    private StringTokenizer tokenizer;

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

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

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

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

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

    public char nextChar() {
        try {
            return (char) reader.read();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public String nextLine() {
        try {
            return reader.readLine();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public boolean ready() {
        try {
            return reader.ready() || tokenizer != null && tokenizer.hasMoreTokens();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}


import java.util.Scanner;

/**
 *
 */

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

	int x;
	int y;
	/**
	 *
	 */
	public TaskA() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner scanObj = new Scanner(System.in);
		String objstr = scanObj.nextLine();
		TaskA a = new TaskA();
		TaskA c = new TaskA();
		TaskA b = new TaskA();
		String[] pnt = objstr.split(" ");
		a.x = Integer.valueOf(pnt[0]);
		a.y = Integer.valueOf(pnt[1]);

		objstr = scanObj.nextLine();
		pnt = objstr.split(" ");
		b.x = Integer.valueOf(pnt[0]);
		b.y = Integer.valueOf(pnt[1]);

		objstr = scanObj.nextLine();
		pnt = objstr.split(" ");
		c.x = Integer.valueOf(pnt[0]);
		c.y = Integer.valueOf(pnt[1]);
		//System.out.print(a.x + " " + a.y + " " + b.x + " " + b.y + " " + c.x + " " + c.y);
		long ma = (b.x-a.x)*(c.y-b.y);
		long mb = (b.y-a.y)*(c.x-b.x);
		float mc = ma-mb;
		if(mc==0){
			System.out.println("TOWARDS");
		}else if(mc>0){
			System.out.println("LEFT");
		}else{
			System.out.println("RIGHT");
		}
	}

}


//package pkg195a;

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

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a,b,n,z=1;
        a=sc.nextInt();
        b=sc.nextInt();
        n=sc.nextInt();
        while(true)
        {
            int Sum1=z*b;
            int Sum2=0;
            boolean f=true;
            while(Sum1<n*a)
            {
                if(Sum1<Sum2) f=false;
                Sum1+=b;
                Sum2+=a;
                if(Sum1<Sum2) f=false;
            }
            if(f) break;
            z++;
        }
        System.out.print(z);
    }
}


import java.util.*;
public class dubstep{
  static Scanner reader=new Scanner (System.in);
  public static void main (String[]args){
    String s=reader.next(),s1;
    int i=0;
    char b='W';
    while (i>-1) {
        i=s.indexOf(b);
        if (i==-1) {break;}
        else {
          s1=s.substring(i,i+2);
          if (s1=="WUB") {
          //if ((s[i+1]="U")&&(s[i+2]="B")) {
            s=s.substring(0,i-1)+s.substring(i+3);
          }
        }
     }
    System.out.println(s);
}}


import java.util.Scanner;

public class A208 {
	private static final String EMPTY = "WUB";
	private static final String SPACE = " ";
	private static final String DOUBLE_SPACE = "  ";
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		String words = scanner.next();
		words = words.replace(EMPTY, SPACE).trim();
		int index = words.indexOf(DOUBLE_SPACE);
		String temp = "";
		while(index != -1){
			temp += words.substring(0, index);
			temp += words.substring(index+1, words.length());
			words = temp;
			index = words.indexOf(DOUBLE_SPACE);
		}
		System.out.println(words);
	}
}


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

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

	      int totalA = 0, totalB = 0 , n;

		for(int i=0; i<3; i++)
		      totalA += Integer.parseInt(st.nextToken());

	      st = new StringTokenizer(br.readLine());
	      for(int i=0; i<3; i++)
	            totalB += Integer.parseInt(st.nextToken());

            st = new StringTokenizer(br.readLine());
            n = Integer.parseInt(st.nextToken());

            while(n > 0 || (totalA > 0 && totalB > 0))
            {
		      if(totalA > 0){
		            totalA -= 5;
		            n--;
		      }
		      if(totalB > 0){
		            totalB -= 10;
		            n--;
		      }
		      //System.out.println(totalA + " " + totalB + " " + n);
		}
		if(n >= 0) System.out.println("YES");
		else System.out.println("NO");

	}
}


import java.io.InputStreamReader;
import java.util.Scanner;

public class Prob30 {

	public static boolean generer(int x1,int y1,int x2,int y2,int x3,int y3)
	{
		double s12=Math.pow(x1-x2,2)+Math.pow(y1-y2,2);
		double s13=Math.pow(x1-x3,2)+Math.pow(y1-y3,2);
		double s23=Math.pow(x2-x3,2)+Math.pow(y2-y3,2);

		if(s12+s13==s23 || s12+s23==s13 || s13+s23==s12)
			return true;
		else
		return false;
	}

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);
		int x1=sc.nextInt();
		int y1=sc.nextInt();
		int x2=sc.nextInt();
		int y2=sc.nextInt();
		int x3=sc.nextInt();
		int y3=sc.nextInt();

		if(generer(x1, y1, x2, y2, x3, y3))
			System.out.println("RIGHT");
		else if(generer(x1-1, y1, x2, y2, x3, y3) || generer(x1+1, y1, x2, y2, x3, y3) || generer(x1, y1-1, x2, y2, x3, y3) || generer(x1, y1+1, x2, y2, x3, y3))
			System.out.println("ALMOST");
		else if(generer(x1, y1, x2-1, y2, x3, y3) || generer(x1, y1, x2+1, y2, x3, y3) || generer(x1, y1, x2, y2-1, x3, y3) || generer(x1, y1, x2, y2+1, x3, y3))
			System.out.println("ALMOST");
		else if(generer(x1, y1, x2, y2, x3-1, y3) || generer(x1, y1, x2, y2, x3+1, y3) || generer(x1, y1, x2, y2, x3, y3-1) || generer(x1, y1, x2, y2, x3, y3+1))
			System.out.println("ALMOST");
		else
			System.out.println("NEITHER");

	}
}


import java.util.*;

public class Maths{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int[] n = new int[(s.length()/2)+1];
        int i = 0;

        for(char c: s.toCharArray()){
            if(c!='+'){
                n[i] = Character.getNumericValue(c);
                i++;
            }
        }
        Arrays.sort(n);
        for(int j=0; j<n.length-1; i++){
            System.out.print(n[j]+"+");
        }
        System.out.print(n[n.length-1]);
    }
}


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

public class Main {

    static final int mod = (int) (1e9 + 7), max = (int) (1e9 + 7);

    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        PrintWriter out = new PrintWriter(System.out);
        int n = sc.nextInt(), m = sc.nextInt(), kk = sc.nextInt();
        int[][] dp1 = new int[kk + 1][max], dp2 = new int[kk + 1][max];
        dp1[0][0] = 1;
        dp2[0][0] = 1;
        for (int i = 1; i < max; i++) {
            dp1[0][i] = 1 + dp1[0][i - 1];
            dp2[0][i] = dp2[0][i - 1] + i;
        }

        for (int k = 1; k <= kk; k++) {
            for (int len = max - 1; len >= 2; len--) {
                dp1[k][len] = add(mult(len - 1, dp1[k - 1][len - 2] - dp1[k - 1][0]), -dp2[k - 1][len - 2] + dp2[k - 1][0]);
                dp2[k][len] = mult(len, dp1[k][len]);
            }
            for (int i = 1; i < max; i++) {
                dp1[k][i] = add(dp1[k][i], dp1[k][i - 1]);
                dp2[k][i] = add(dp2[k][i], dp2[k][i - 1]);
            }
        }
        out.println(mult(add(dp1[kk][n], -dp1[kk][n - 1]), add(dp1[kk][m], -dp1[kk][m - 1])));
        out.flush();
        out.close();
    }

    static int add(int a, int b) {
        long ans = a + b;
        if (ans >= mod) ans -= mod;
        if (ans < 0) ans += mod;
        return (int) ans;
    }

    static int mult(long a, int b) {
        return (int) ((a * b) % mod);
    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

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

        public Scanner(String s) throws FileNotFoundException {

            br = new BufferedReader(new FileReader(new File(s)));
        }

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

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

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

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

        public char nextChar() throws IOException {
            return next().charAt(0);
        }

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

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

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

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

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

        public double[] nextDoubleArray(int n) throws IOException {
            double[] ans = new double[n];
            for (int i = 0; i < n; i++)
                ans[i] = nextDouble();
            return ans;
        }

        public short nextShort() throws IOException {
            return Short.parseShort(next());
        }

    }

}


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

public class JavaApplication1 {

    static class Reader {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    public static void main(String[] args) throws IOException {
        Reader s = new Reader();
        int a=s.nextInt();
        int b=s.nextInt();
        if(a>b){
            int sum=0,count=1;
            while(a!=b){
                if(a-1==b){
                    sum+=count;
                    break;
                }
                else{
                    a--;
                    b++;
                    sum+=count*2;
                    count++;
                }
            }
            System.out.println(sum);
        }
        else{
            int sum=0,count=1;
            while(a!=b){
                if(b-1==a){
                    sum+=count;
                    break;
                }
                else{
                    a--;
                    b++;
                    sum+=count*2;
                    count++;
                }
            }
            System.out.println(sum);
        }
        }
    }