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

public class RubiksCubeColoringHard {

    static int mod = 1000000007;

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

        FastReader reader = new FastReader();
        FastWriter writer = new FastWriter();
        int K = reader.readSingleInt();
        int N = reader.readSingleInt();

        ArrayList<long[]> fixed = new ArrayList<>();
        //1 r, 2 = g, 3 = b, 4 = o, 5 = w, 6 = y
        for(int i = 0; i<N; i++){
            StringTokenizer st = new StringTokenizer(reader.readString());
            int n = Integer.parseInt(st.nextToken());
            int c = 1;
            String color = st.nextToken();
            if(color.equals("red")){
                c = 1;
            } else if(color.equals("green")){
                c = 2;
            } else if(color.equals("blue")){
                c = 3;
            } else if(color.equals("orange")){
                c = 4;
            } else if(color.equals("white")){
                c = 5;
            } else if(color.equals("yellow")){
                c = 6;
            }
            fixed.add(new long[]{n, c});
        }

        Collections.sort(fixed, new Comparator<long[]>() {
            @Override
            public int compare(long[] a, long[] b) {
                if(a[0] <= b[0]){
                    return -1;
                }
                return 1;
            }
        });

        //2^(k-1)

        //6 * 4^((2^(k-1))-1))

        long target = 1;
        for(int i = 0; i<K-1; i++){
            target = target*2;
        }
        target--;

        long power = 1;
        long psum = 4;

        long exponent = 1;
        long value = 4;

        while(exponent < target){

            psum *= psum;
            if(psum > mod){
                psum %= mod;
            }
            power += power;

            if(exponent + power <= target){
                exponent = exponent + power;
                value = value * psum;
                if(value > mod){
                    value %= mod;
                }
            } else {
                power = 1;
                psum = 4;
            }
        }

        value *= 6*value;
        if(value > mod){
            value %= mod;
        }

        writer.writeSingleLong(value);

    }

    public static void mergeSort(int[] a, int n) {
        if (n < 2) {
            return;
        }
        int mid = n / 2;
        int[] l = new int[mid];
        int[] r = new int[n - mid];

        for (int i = 0; i < mid; i++) {
            l[i] = a[i];
        }
        for (int i = mid; i < n; i++) {
            r[i - mid] = a[i];
        }
        mergeSort(l, mid);
        mergeSort(r, n - mid);

        merge(a, l, r, mid, n - mid);
    }

    public static void merge(int[] a, int[] l, int[] r, int left, int right) {

        int i = 0, j = 0, k = 0;
        while (i < left && j < right) {
            if (l[i] <= r[j]) {
                a[k++] = l[i++];
            }
            else {
                a[k++] = r[j++];
            }
        }
        while (i < left) {
            a[k++] = l[i++];
        }
        while (j < right) {
            a[k++] = r[j++];
        }
    }

    public static class FastReader {

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

        public int readSingleInt() throws IOException {
            return Integer.parseInt(reader.readLine());
        }

        public int[] readIntArray(int numInts) throws IOException {
            int[] nums = new int[numInts];
            tokenizer = new StringTokenizer(reader.readLine());
            for(int i = 0; i<numInts; i++){
                nums[i] = Integer.parseInt(tokenizer.nextToken());
            }
            return nums;
        }

        public String readString() throws IOException {
            return reader.readLine();
        }

    }

    public static class FastWriter {

        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

        public void writeSingleInteger(int i) throws IOException {
            writer.write(Integer.toString(i));
            writer.newLine();
            writer.flush();
        }

        public void writeSingleLong(long i) throws IOException {
            writer.write(Long.toString(i));
            writer.newLine();
            writer.flush();
        }

        public void writeIntArrayWithSpaces(int[] nums) throws IOException {
            for(int i = 0; i<nums.length; i++){
                writer.write(nums[i] + " ");
            }
            writer.newLine();
            writer.flush();
        }

        public void writeIntArrayListWithSpaces(ArrayList<Integer> nums) throws IOException {
            for(int i = 0; i<nums.size(); i++){
                writer.write(nums.get(i) + " ");
            }
            writer.newLine();
            writer.flush();
        }

        public void writeIntArrayWithoutSpaces(int[] nums) throws IOException {
            for(int i = 0; i<nums.length; i++){
                writer.write(Integer.toString(nums[i]));
            }
            writer.newLine();
            writer.flush();
        }

        public void writeString(String s) throws IOException {
            writer.write(s);
            writer.newLine();
            writer.flush();
        }

    }

}


import java.util.StringTokenizer;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.lang.reflect.Array;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import java.util.ArrayList;

public class p5
{
	BufferedReader br;
	StringTokenizer st;
	BufferedWriter bw;
	public static void main(String[] args)throws Exception
	{
		new p5().run();
	}

	void run()throws IOException
	{
		br = new BufferedReader(new InputStreamReader(System.in));
		bw=new BufferedWriter(new OutputStreamWriter(System.out));

		solve();
	}
	void solve() throws IOException
	{
		byte k=nb();
		short n=ns();
		data[] d=new data[n];

		for(int i=-1;++i<n;)
			d[i]=new data(ni(),next().charAt(0));

		Arrays.sort(d, (x,y) -> x.v-y.v);
		int nodes=(int)Math.pow(2,k)-2;

		int mod=1000000007;
		long ans=4;
		int a[]=new int[62];
		// a[0]=1;

		for(int i=-1;++i<62;)
		{
			a[i]=(int)ans;
			ans*=ans;
			ans%=mod;
		}

		if(d[0].v==1)
			nodes-=n-1;
		else
			nodes-=n;

		ans=1L;
		int bit=0;
		while(nodes!=0)
		{
			if(nodes%2==1)
			{
				ans*=a[bit];
				ans%=mod;
			}
			nodes/=2;
			bit++;
		}

		ans*=6;
		ans%=mod;
		System.out.println(ans);

	}

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

	int[] nai(int n) { int a[]=new int[n]; for(int i=-1;++i<n;)a[i]=ni();	return a;}

	long[] nal(int n) { long a[]=new long[n]; for(int i=-1;++i<n;)a[i]=nl();	return a;}

	char[] nac()	{char c[]=nextLine().toCharArray();	return c;}

	char [][] nmc(int n)	{char c[][]=new char[n][]; for(int i=-1;++i<n;)c[i]=nac();	return c;}

	int[][] nmi(int r, int c)	{int a[][]=new int[r][c]; for(int i=-1;++i<r;)a[i]=nai(c);	return a;}

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

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

	byte nb() { return Byte.parseByte(next()); }

	short ns() { return Short.parseShort(next()); }

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

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

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

	int countDigits(int l)	{
		if (l >= 1000000000) return 10;
		if (l >= 100000000) return 9;
		if (l >= 10000000) return 8;
		if (l >= 1000000) return 7;
		if (l >= 100000) return 6;
		if (l >= 10000) return 5;
		if (l >= 1000) return 4;
		if (l >= 100) return 3;
		if (l >= 10) return 2;
		return 1;
	}
	int countDigits(long l) {
		if (l >= 1000000000000000000L) return 19;
		if (l >= 100000000000000000L) return 18;
		if (l >= 10000000000000000L) return 17;
		if (l >= 1000000000000000L) return 16;
		if (l >= 100000000000000L) return 15;
		if (l >= 10000000000000L) return 14;
		if (l >= 1000000000000L) return 13;
		if (l >= 100000000000L) return 12;
		if (l >= 10000000000L) return 11;
		if (l >= 1000000000L) return 10;
		if (l >= 100000000L) return 9;
		if (l >= 10000000L) return 8;
		if (l >= 1000000L) return 7;
		if (l >= 100000L) return 6;
		if (l >= 10000L) return 5;
		if (l >= 1000L) return 4;
		if (l >= 100L) return 3;
		if (l >= 10L) return 2;
		return 1;
	}

	public static class data
	{
		int v;
		char c;

		public data(int v, char c)
		{
			this.v=v;
			this.c=c;
		}
	}
}


// Generated by Code Flattener.
// https://plugins.jetbrains.com/plugin/9979-idea-code-flattener

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

public class ASolution extends Solution {
    @Override
    protected boolean isMultiTest() {
        return false;
    }

    public void solve() {
        int n = in.nextInt();
        ModInt MOD_16 = new ModInt(16);
        ModInt ans = ModInt.ONE;
        for (int i = 2; i <= n; i++) {
            ans = MOD_16.multiply(ans).multiply(ans);
        }
        out.println(new ModInt(6).multiply(ans).intValue());
    }

    private abstract static class Solution {
        public MyScanner in;
        public MyWriter out;

        public abstract void solve();

        protected boolean isMultiTest() {
            return true;
        }
    }

    private static class ModInt {
        static int MOD = 1000000007;
        public static final ModInt ONE = new ModInt(1);
        private final int value;

        public ModInt(int value) {
            if (value < 0) {
                throw new IllegalArgumentException();
            }
            this.value = value;
        }

        public ModInt multiply(ModInt other) {
            return new ModInt((int) (((long) this.value * other.value) % MOD));
        }

        public int intValue() {
            return value;
        }
    }

    private static class MyScanner {
        private final BufferedReader br;
        private StringTokenizer st;

        public String next() {
            while (st == null || !st.hasMoreElements()) {
                st = new StringTokenizer(nextLine());
            }
            return st.nextToken();
        }

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

        public String nextLine() {
            try {
                String line = br.readLine();
                if (line == null) {
                    throw new RuntimeException("empty line");
                }
                st = null;
                return line;
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

    private static class MyWriter extends PrintWriter {
        public MyWriter(Writer writer) {
            super(writer);
        }

        public MyWriter(OutputStream out) {
            super(out);
        }
    }
}


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

public class Test {
	static BufferedReader reader;
	static StringTokenizer tokenizer;
	static PrintWriter writer;

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

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

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

	static String nextToken() throws IOException {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			tokenizer = new StringTokenizer(reader.readLine());
		}
		return tokenizer.nextToken();
	}
	public static int gcd(int x, int y){
		if (y == 0) return x; else return gcd(y, x % y);
	}
	 static class R implements Comparable<R>{
	        int x, y;
	        public  R(int x, int y) {
	            this.x = x;
	            this.y = y;
	        }
	        public int compareTo(R o) {
            		return x-o.x;     //Increasing order(Which is usually required)
        		}
	    }

	public static void main(String[] args) throws IOException {
		reader = new BufferedReader(new InputStreamReader(System.in));
		tokenizer = null;
		writer = new PrintWriter(System.out);
		solve();
		reader.close();
		writer.close();
	}

	private static void solve() throws IOException {
		int n = nextInt();
		int[] a=new int[n];
		for(int i=0;i<n;i++){
			a[i]=nextInt();
		}
		int b=0;
		for(int i=0;i<n-2;i++){
		    for(int j=i+1;j<n-1;j++){
		        int A = min(a[i], a[i + 1]), B = max(a[i], a[i + 1]);
		    	int C = min(a[j], a[j + 1]), D = max(a[j], a[j + 1]);
		    	if (A < C && C < B && B < D) b = 1;
		    	if (C < A && A < D && D < B) b = 1;
		    }
		}
		if(b==1){
		    writer.println("yes");
		}
		else{
		    writer.println("no");
		}

	}
}


import java.security.AllPermission;
import java.util.Arrays;
import java.util.Scanner;

public class Young {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int tab[] = new int[n];
		int dif[] = new int[n-1];

		for(int i =0; i<n; i++)
		{
			tab[i] = sc.nextInt();
		}
		for(int i = 0; i<n-1; i++)
		{
			dif[i] = tab[i] - tab[i+1];
		}
		for(int i = 0; i<n-1; i++)
		{
			dif[i] = Math.abs(dif[i]);
		}
		int max = dif[0];
		for(int i = 0; i<dif.length; i++)
		{
			max = Math.max(max, dif[i]);
		}
		boolean res = false;
		if(AreAllSame(dif)) res = true;

		else 	for(int i = 1; i<dif.length; i++)
		{
			if(max == dif[0] && max != dif[i]) res = true;
			else res = false;

		}
		System.out.println(res ? "no" : "yes");

	}
	public static boolean AreAllSame(int[] array)
	{

	    for(int i = 1; i < array.length; i++)
	    {
	            if(array[0]!=(array[i])) return false;
	    }

	    return true;
	}
}

import java.security.AllPermission;
import java.util.Arrays;
import java.util.Scanner;

public class Young {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int tab[] = new int[n];
		int dif[] = new int[n-1];

		for(int i =0; i<n; i++)
		{
			tab[i] = sc.nextInt();
		}
		for(int i = 0; i<n-1; i++)
		{
			dif[i] = tab[i] - tab[i+1];
		}
		for(int i = 0; i<n-1; i++)
		{
			dif[i] = Math.abs(dif[i]);
		}
		int max = dif[0];
		for(int i = 0; i<dif.length; i++)
		{
			max = Math.max(max, dif[i]);
		}
		boolean res = false;
		if(AreAllSame(dif)) res = true;

		else 	for(int i = 1; i<dif.length; i++)
		{
			if(max == dif[0] && max != dif[i]) res = true;
			else res = false;

		}
		System.out.println(res ? "no" : "yes");

	}
	public static boolean AreAllSame(int[] array)
	{

	    for(int i = 1; i < array.length; i++)
	    {
	            if(array[0]!=(array[i])) return false;
	    }

	    return true;
	}
}


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

public class DimaAndLines{
    public static void main(Strings args[]){
        Scanner inp = new Scanner(System.in);
        int n = inp.nextInt();
        int arr[] = new int[n];
        for(int i=0;i<n;++i){
            arr[i] = inp.nextInt()
        }
        int flag = 0;
        for(int i=0;i<n-1;i++){
            if(flag == 1){
                break;
            }
            for(int j=0;j<n-1;j++){
                if(Math.min(arr[i], arr[i+1])<Math.min(arr[j], arr[j+1]) && Math.min(arr[j], arr[j+1])<Math.max(arr[i], arr[i+1]) &&
                Math.max(arr[i], arr[i+1])<Math.max(arr[j], arr[j+1]) || Math.min(arr[j], arr[j+1])<Math.min(arr[i], arr[i+1]) && Math.min(arr[i], arr[i+1])<Math.max(arr[j], arr[j+1]) &&
                Math.max(arr[j], arr[j+1])<Math.max(arr[i], arr[i+1])){
                    System.out.print("Yes");
                    flag = 1;
                    break;
                }
            }
        }

        if(flag == 0){
            System.out.print("No");
        }

    }
}


public class A538b {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int N = input.nextInt();
        int[] A = new int[N];
        for (int n=0; n<N; n++) {
            A[n] = input.nextInt();
        }
        boolean intersects = false;
        for (int i=1; i<N; i++) {
            int a1 = A[i];
            int a2 = A[i-1];
            if (a2 < a1) {
                int temp = a1;
                a1 = a2;
                a2 = temp;
            }
            for (int j=i+1; j<N; j++) {
                int b1 = A[j];
                int b2 = A[j-1];
                if (b2 < b1) {
                    int temp = b1;
                    b1 = b2;
                    b2 = temp;
                }
                if ((a1 < b1 && b1 < a2 && a2 < b2) || (b1 < a1 && a1 < b2 && b2 < a2)) {
                    intersects = true;
                }
            }
        }
        System.out.println(intersects ? "yes" : "no");
    }

}


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

public class Codeforces{
	boolean multipleTC=false;
	int INF=(int)1e9+7;

	void solve( int tc )throws Exception{
		int n=ni(), m=ni();
		char[]c1 = n().toCharArray();
		char[]c2 = n().toCharArray();
		int pos=0;
		boolean ans = true;
		int i;
		for( i=0; i<n; i++ ){
			if( c1[i]=='*' ) break;
			if( c1[i]!=c2[i] )ans = false;
		}
		for( int j=0; j<m-i+1; j++ ){
			if( c1[n-j-1]!=c2[m-j-1] ) ans = false;
		}
		pn( ans?"YES":"NO" );
	}

	void run() throws Exception{
		in = new FastReader();
		out = new PrintWriter( System.out );
		for( int i=1, t=(multipleTC)?ni():1 ; i<=t; i++ )solve(i);
		out.flush();
		out.close();
	}

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

	FastReader in;
	PrintWriter out;

	long[]la( int n )throws Exception{ long[]a=new long[n]; for( int i=0; i<n; i++ )a[i]=nl(); return a; }
	int[]ia( int n )throws Exception{ int[]a=new int[n]; for( int i=0; i<n; i++ )a[i]=ni(); return a; }
	int gcd( int a, int b ){ return (b==0)?a:gcd(b,a%b); }
	void p(Object o){ out.print(o); }
	void pn(Object o){ out.println(o); }
	void pni(Object o){ out.println(o); out.flush(); }
	String n(){ return in.next(); }
	int ni() throws Exception{ return Integer.parseInt(in.next()); }
	long nl() throws Exception{ return Long.parseLong(in.next()); }

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


/*package whatever //do not write package name here */

import java.util.*;

public class GFG {
	public static void main (String[] args) {
	    Scanner sc=new Scanner(System.in);
	    long int n=sc.nextInt();
	    long int k=sc.nextInt();
	    int a[]=new int[n];
		for(long int i=0;i<n;i++)
		{
		    a[i]=i+1;
		}
		int count=0;
		for(long int i=0;i<n;i++)
		{
		    for(long int j=n-1;j>i;j--)
		    {

		        int x=a[i]+a[j];
		        if(x==k)
		        {
		            count++;
		            break;
		     }

		    }
		}
		System.out.println(+count);
	}
}


import java.util.*;
public class Pair
{
public static void main(String args[])
{
	long n,s;
	Scanner in=new Scanner(System.in);
	long count=0;
	n=in.nextLong();
	s=in.nextLong();
	for(long i=1;i<=n-1;i++)
	{
		for(long j=i+1;j<=n;j++)
		{
			if(s==(i+j))
			{
				count++;
			}
		}
	}
	System.out.println(count);
}


import java.util.*;
public class codeforces{
	public static void main(String[] args){
		Scanner s=new Scanner(System.in);
		long n=s.nextLong();
		long k=s.nextLong();
		if(n==1||n+(n-1)<k) System.out.println("0");
		else{
			if(k<=n+1) System.out.println((k-1)/2);
			else System.out.println(n-(k+22/2+1);
		}
	}
}


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

public class P172D {

  final int MAX_VALUE = 10_000_000;
  final int SHIFT = (int)(Math.log(Math.sqrt(MAX_VALUE)) / Math.log(2)) + 1;
  final int AND = (1 << SHIFT) - 1;

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    int a = nextInt();
    int n = nextInt();
    long total = 0;
long start = new Date().getTime();
    long [] vpa = new long [MAX_VALUE];
    int [] vi = new int [MAX_VALUE + 1];
    Arrays.fill(vi, -1);
    int vpai = 0;

long count = 0;
    for (int p = (int)Math.sqrt(MAX_VALUE); p >= 2; p--) {
count++;
      int p2 = p * p;
      int fk = (a / p2 != 0) ? (a / p2) : 1;
      int tk = MAX_VALUE / p2;
      for (int k = fk; k <= tk; k++) {
count++;
        int v = p2 * k;
        if (v >= a) {
          if (vi[v] == -1) {
            vi[v] = vpai;
            vpa[vpai++] = ((long)v << SHIFT) | p;
          } else {
            vpa[vi[v]] = ((long)v << SHIFT) | p;
          }
        }
      }
    }

//System.out.println("size = " + al.size());
//if (al.size() < 100) System.out.println(al);
/*
    for (int i = 0; i < vpai; i++) {
      System.out.print("[" + (vpa[i] >> SHIFT) + ", " + (vpa[i] & AND) + "] ");
    }
*/
    Arrays.sort(vpa, 0, vpai);
long finish = new Date().getTime();
//for (int i = 0; i < vpai; i++) System.out.print("[" + (vpa[i] >> SHIFT) + ", " + (vpa[i] & AND) + "] ");
System.out.println();
System.out.println("time = " + (finish - start));
System.out.println("count = " + count);
System.out.println("vpai = " + vpai);
//  println(total);
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P172D().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { println("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(""); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}


import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.ArrayList;
import java.util.Arrays;

public class Main {
    static class Assert {
        static void check(boolean e) {
            if (!e) {
                throw new Error();
            }
        }
    }

    class Scanner {

        StreamTokenizer in;

        Scanner(InputStream is) {
            in = new StreamTokenizer(new InputStreamReader(is));
            in.resetSyntax();
            in.whitespaceChars(0, 32);
            in.wordChars(33, 255);
        }

        String next() {
            try {
                in.nextToken();
                Assert.check(in.ttype == in.TT_WORD);
                return in.sval;
            } catch (IOException e) {
                throw new Error(e);
            }
        }

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

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

    Scanner in;
    PrintWriter out;

    void run() {
        in = new Scanner(System.in);
        out = new PrintWriter(System.out);
        try {
            solve();
        } finally {
            out.close();
        }
    }

    void fillPrime(int n) {
        boolean[] boolPrime = new boolean[n + 1];
        ArrayList<Integer> a[] = new ArrayList[n + 1];
        for (int i = 0; i <= n; i++) {
            a[i] = new ArrayList<Integer>();
        }

        Arrays.fill(boolPrime, true);
        for (int i = 2; i <= n; i++) {
            if (boolPrime[i]) {
                a[i].add(i);
                for (int j = 2 * i; j <= n; j += i) {
                    a[j].add(i);
                    boolPrime[j] = false;
                }
            }
        }
    }

    void solve() {
        fillPrime(10000000);

    }
}


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

public class P172D {

  final int MAX_VALUE = 10_000_000;
  final int MAX_P = (int)Math.sqrt(MAX_VALUE);
/*
  class Pair implements Comparable {
    public int p, k;
    private long val;

    Pair(int k, int p) {
      this.p = p;
      this.k = k;
      val = p * p * k;
    }

    @Override
    public int compareTo(Object o) {
      return (val - r)o).(
    }

    @Override
    public String toString() {
      return ("<" + k + ", " + p + ">");
    }
  }
*/

  @SuppressWarnings("unchecked")
  public void run() throws Exception {
    int a = nextInt();
    int n = nextInt();
    long total = 0;

long s = new Date().getTime();
    HashMap<Integer, Integer> hm = new HashMap();
    for (int p = 2; p <= MAX_P; p++) {
      int p2 = p * p;
      int kf = MAX_VALUE / p2;
      for (int k = kf; k >= 1; k--) {
        hm.put(k * p2, p);
      }
    }

    System.out.println(hm.size());
//    System.out.println(hm);
    System.out.println((new Date().getTime() - s));

//  println(total);
  }

  public static void main(String... args) throws Exception {
    br = new BufferedReader(new InputStreamReader(System.in));
    pw = new PrintWriter(new BufferedOutputStream(System.out));
    new P172D().run();
    br.close();
    pw.close();
  }

  static BufferedReader br;
  static PrintWriter pw;
  StringTokenizer stok;

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

  void print(byte b) { print("" + b); }
  void print(int i) { print("" + i); }
  void print(long l) { print("" + l); }
  void print(double d) { print("" + d); }
  void print(char c) { print("" + c); }
  void print(Object o) {
    if (o instanceof int[]) { print(Arrays.toString((int [])o));
    } else if (o instanceof long[]) { print(Arrays.toString((long [])o));
    } else if (o instanceof char[]) { print(Arrays.toString((char [])o));
    } else if (o instanceof byte[]) { print(Arrays.toString((byte [])o));
    } else if (o instanceof short[]) { print(Arrays.toString((short [])o));
    } else if (o instanceof boolean[]) { print(Arrays.toString((boolean [])o));
    } else if (o instanceof float[]) { print(Arrays.toString((float [])o));
    } else if (o instanceof double[]) { print(Arrays.toString((double [])o));
    } else if (o instanceof Object[]) { print(Arrays.toString((Object [])o));
    } else { println("" + o); }
  }
  void print(String s) { pw.print(s); }
  void println() { println(""); }
  void println(byte b) { println("" + b); }
  void println(int i) { println("" + i); }
  void println(long l) { println("" + l); }
  void println(double d) { println("" + d); }
  void println(char c) { println("" + c); }
  void println(Object o) { print(o); println(""); }
  void println(String s) { pw.println(s); }
  int nextInt() throws IOException { return Integer.parseInt(nextToken()); }
  long nextLong() throws IOException { return Long.parseLong(nextToken()); }
  double nextDouble() throws IOException { return Double.parseDouble(nextToken()); }
  char nextChar() throws IOException { return (char) (br.read()); }
  String next() throws IOException { return nextToken(); }
  String nextLine() throws IOException { return br.readLine(); }
  int [] readInt(int size) throws IOException {
    int [] array = new int [size];
    for (int i = 0; i < size; i++) { array[i] = nextInt(); }
    return array;
  }
  long [] readLong(int size) throws IOException {
    long [] array = new long [size];
    for (int i = 0; i < size; i++) { array[i] = nextLong(); }
    return array;
  }
  double [] readDouble(int size) throws IOException {
    double [] array = new double [size];
    for (int i = 0; i < size; i++) { array[i] = nextDouble(); }
    return array;
  }
  String [] readLines(int size) throws IOException {
    String [] array = new String [size];
    for (int i = 0; i < size; i++) { array[i] = nextLine(); }
    return array;
  }
}


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

/**
 * @author Roman Elizarov
 */
public class Round_103_D {
	public static void main(String[] args) {
		new Round_103_D().go();
	}

	private final List<List<Road>> adj = new ArrayList<List<Road>>();

	int[] dist;
	int[] q;
	int[] p;
	int qs;

	private void go() {
		Scanner in = new Scanner(System.in);
		PrintStream out = System.out;
		int n = in.nextInt();
		int m = in.nextInt();
		int s = in.nextInt() - 1;
		for (int i = 0; i < n; i++)
			adj.add(new ArrayList<Road>());
		for (int i = 0; i < m; i++) {
			int v = in.nextInt() - 1;
			int u = in.nextInt() - 1;
			int w = in.nextInt();
			add(v, u, w);
			add(u, v, w);
		}
		int l = in.nextInt();
		dist = new int[n];
		Arrays.fill(dist, Integer.MAX_VALUE);
		dist[s] = 0;
		q = new int[n];
		p = new int[n];
		qs = 0;
		enqueue(s);
		while (qs > 0) {
			int v = remove();
			int dv = dist[v];
			for (Road road : adj.get(v)) {
				int u = road.u;
				int du = dist[u];
				if (dv + road.w < du) {
					if (du == Integer.MAX_VALUE)
						enqueue(u);
					dist[u] = dv + road.w;
					siftDown(p[u]);
				}
			}
		}
		int result1 = 0;
		int result2 = 0;
		for (int v = 0; v < n; v++) {
			int dv = dist[v];
			if (dv == l)
				result1++;
			else if (dv < l) {
				for (Road road : adj.get(v)) {
					int u = road.u;
					int du = dist[u];
					if (dv + road.w > l) {
						int d = l - dv;
						int alt = road.w - d + du;
						if (alt == l)
							result2++;
						else if (alt > l)
							result1++;
					}
				}
			}
		}
		out.println(result1 + result2 / 2);
	}

	private int remove() {
		int v = q[0];
		qs--;
		if (qs > 0) {
			swap(0, qs);
			siftUp(0);
		}
		return v;
	}

	private void swap(int i, int j) {
		int vi = q[i];
		int vj = q[j];
		q[i] = vj;
		p[vj] = i;
		q[j] = vi;
		p[vi] = j;
	}

	private void siftUp(int i) {
		while (true) {
			int j = i * 2 + 1;
			int k = i * 2 + 2;
			if (k < qs && dist[p[k]] < dist[p[j]])
				j = k;
			if (j < qs && dist[p[j]] < dist[p[i]]) {
				swap(i, j);
				i = j;
			} else
				break;
		}
	}

	private void siftDown(int i) {
		while (i > 0) {
			int j = (i - 1) / 2;
			if (dist[p[i]] < dist[p[j]]) {
				swap(i, j);
				i = j;
			} else
				break;
		}
	}

	private void enqueue(int v) {
		q[qs] = v;
		p[v] = qs;
		qs++;
	}

	private void add(int v, int u, int w) {
		adj.get(v).add(new Road(u, w));
	}

	private static class Road {
		final int u;
		final int w;

		private Road(int u, int w) {
			this.u = u;
			this.w = w;
		}
	}
}


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

/**
 * Created by fengp on 10/10/17.
 */
public class CF869B {
    public static int solve(long a, long b){
        if (b-a>=5)return 0;
        int ans=1;
        for (long c=a+1;c<=b;++c){
            ans*=(c%10);
        }
        return ans%10 ;
    }

    public static void main(String[] args) {

        InputStream input = System.in;
        PrintStream output = System.out;
        if (args.length == 2) {
            try {
                input = CF867A.class.getClassLoader().getResourceAsStream(args[0]);
                output = new PrintStream(args[1]);
            } catch (IOException e) {
                e.printStackTrace();
                return;
            }
        }
        Scanner in = new Scanner(input);
        while (in.hasNextLong()) {
            long a;
            a = in.nextLong();
            long b;
            b = in.nextLong();
            output.println(String.format("%d", solve(a,b)));
        }
    }
}


import java.util.Scanner;

public class HelloWorld{

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

        System.out.println((b*(b-1))%10);
}


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

Scanner sc = new Scanner(System.in);
		long a;
		long b;
		long i;
		long d;
		long s=1;
		a = sc.nextLong();
		b = sc.nextLong();
		for(i=a;i<=b;i++){
			d=i/10;
			s*=d;
			if(s==0)
				break;
		}
		System.out.println(s%10);
    }
}


import java.io.*;

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

        if(b-a>5)
        {
            System.out.println(0);
            return;
        }
        else
        {
            for(int i=a+1;i<=b;i++)
            {
                c = c*i;
                c = c%10;
            }
            System.out.println(c);
        }
    }
}


import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigInteger;

public class JavaApplication9 {

//***************************************************************************************
    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();
        }
    }
//****************************************************************************************
/*static boolean isp(long n)
{

   if(n==3||n==2)
   return true;
   if(n%2==0||n%3==0||n==1)
   return false;
   for(int i=5;i*i<=n;i=i+6)
   {
       if(n%i==0||n%(i+2)==0)
       return false;
   }
   return true;
}*/
//********************************************************
   /* static int factorial(int n)
    {
        if (n == 0)
          return 1;

        return n*factorial(n-1);
    } */
    /*  public int BinaryToDecimal(int binaryNumber){

    int decimal = 0;
    int p = 0;
    while(true){
      if(binaryNumber == 0){
        break;
      } else {
          int temp = binaryNumber%10;
          decimal += temp*Math.pow(2, p);
          binaryNumber = binaryNumber/10;
          p++;
       }
    }
    return decimal;
   }*/

/*-**********************  Start   *********************************-*/

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

Reader st=new Reader();
Scanner in=new Scanner(System.in);
//HashMap dp = new HashMap();
int n=in.nextInt();
boolean f=true;

int j=in.nextByte();
int p=in.nextByte();

Vector <Integer>v1=new Vector(j);

int o;
for(int i=0;i<j+p;i++)
{
      o=in.nextInt();
      if(i==j)f=false;
      if(f)v1.add(o);

}
System.out.println(v1);
for(int i=1;i<=n;i++)
{
 if(v1.contains(i))System.out.print(1);
 else
     System.out.print(2);
}
    //
}}


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

	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		int n = Integer.parseInt(st.nextToken());
		int a = Integer.parseInt(st.nextToken());
		int b = Integer.parseInt(st.nextToken());
		ArrayList<Integer> aApples = new ArrayList<Integer>();
		ArrayList<Integer> bApples = new ArrayList<Integer>();
		st = new StringTokenizer(br.readLine());
		for(int i = 0; i < a; i++) {
			aApples.add(Integer.parseInt(st.nextToken()));
			System.out.print(1+" ");
		}
		st = new StringTokenizer(br.readLine());
		for(int i = 0; i < b; i++) {
			bApples.add(Integer.parseInt(st.nextToken()));
		}
		bApples.removeAll(aApples);
		for(int i = 0; i < bApples.size(); i++) {
			System.out.print(2+" ");
		}
	}

}


import java.util.Scanner;
public class Ds_gfg{
    public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();
        int []m=new int[n];

        for(int i=0;i<a;i++){
            int temp=sc.nextInt();
            m[temp-1]=1;
        }
        for(int i=0;i<b;i++){
            int temp=sc.nextInt();
            if(m[temp-1]!=1)m[temp-1]=2;
        }
        for(int i=0;i<n;i++){
            System.out.print(m[i]+" ");
        }

    }
}


public class Ds_gfg{
    public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();
        int []m=new int[n];

        for(int i=0;i<a;i++){
            int temp=sc.nextInt();
            m[temp-1]=1;
        }
        for(int i=0;i<b;i++){
            int temp=sc.nextInt();
            if(m[temp-1]!=1)m[temp-1]=2;
        }
        for(int i=0;i<n;i++){
            System.out.print(m[i]+" ");
        }

    }
}


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

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

public class A {

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

		new A().solveProblem();

		out.close();
	}

	static Scanner in = new Scanner(new InputStreamReader(System.in));
	static BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
	static PrintStream out = new PrintStream(new BufferedOutputStream(System.out));

	static final long MOD = 1000000007 ;
	static final long d = 26 ;

	int k ;
	char[] cs ;
	int n ;
	static long[] macht ;
	public void solveProblem() throws IOException {

		k = Int() ;
		cs = Line().toCharArray() ;
		n = cs.length ;

		macht = new long[n] ;
		macht[0] = 1 ;
		for( int i = 1 ; i < n ; i++ )
			macht[i] = (macht[i-1]*d) % MOD ;

		voor = new Fenwick(n) ;
		achter = new Fenwick(n) ;

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

			int v = cs[i] - 'a' ;
			voor.adjust(1+i, (v*macht[i])%MOD ) ;

			v = cs[n-i-1] - 'a' ;
			achter.adjust(n-i, (v*macht[i])%MOD ) ;
		}

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

			if( pa(i)){
				z = i ;
				break ;
			}
		}

		boolean ok = false ;

		while( ! ok ){

			while( cs[z] == 'z'){
				voor.adjust(z+1, (macht[z]*-25) % MOD ) ;
				achter.adjust(z+1, (macht[n-z-1]*-25) % MOD ) ;
				cs[z--] = 'a' ;
				if( z < 0 ){
					out.println("Impossible") ;
					return ;
				}
			}

			cs[z]++ ;
			voor.adjust(z+1, (macht[z]) % MOD ) ;
			achter.adjust(z+1, (macht[n-z-1]) % MOD ) ;
			ok = !pa(z) ;
		}

		for( int i = z + 1 ; i < n ; i++ ){

			for( char c = 'a' ; c <= 'c' ; c++){
				voor.adjust(i+1, (macht[i]*(-cs[i]+c)) % MOD ) ;
				achter.adjust(i+1, (macht[n-i-1]*(-cs[i]+c)) % MOD ) ;
				cs[i] = c ;

				if( !pa(i))
					break ;
			}
		}

		out.println(new String(cs)) ;

	}

	static boolean deb = false ;
	boolean pa(int i){
		return (i - k + 1 >= 0 && palin(i-k+1,i)) || ( i - k >= 0 && palin(i-k,i)) ;
	}
	private boolean palin(int van, int tot) {

		int l = tot - van + 1 ;

		if( deb )
			p(voor.rsq(van+1,van+l/2) , achter.rsq(van+l/2+1,tot+1) ) ;
		if( l % 2 == 0 )
			return (voor.rsq(van+1,van+l/2) * macht[n-1-van] ) % MOD == (achter.rsq(van+l/2+1,tot+1) * macht[tot] ) % MOD ;
		else
			return ( voor.rsq(van+1,van+l/2) * macht[n-1-van] ) % MOD == (achter.rsq(van+l/2+2,tot+1)* macht[tot] ) % MOD ;

	}

	Fenwick voor ;
	Fenwick achter ;

	class Fenwick{

		public Fenwick( int n ){
			fenwick = new long[n+1] ;
			this.n = n ;
		}
		int n ;
		long[] fenwick ; // aanmaken met n + 1 !!!!!!

		long rsq( int k ){
			long som = 0 ;

			while( k > 0 ){
				som = (som+fenwick[k])%A.MOD ;
				k -= (k & (-k)) ;
			}

			return som ;

		}

		long rsq( int l, int h){
			if( l > h )
				return 0 ;
			if( l == 0 )
				return rsq( h ) ;
			return (MOD+(rsq( h ) - rsq( l-1 )) % MOD) % MOD ;
		}

		void adjust( int k, long v){
			while( k < fenwick.length ){
				fenwick[k] += v ;
				k += (k & (-k)) ;
			}
		}

	}

	static String Line() throws IOException{
		return buf.readLine() ;
	}

	static int bufI = 0 ;
	static int[] bufInts = new int[0] ;

	static int Int() throws IOException{
		if( bufI == bufInts.length )
			bufReaderNInts() ;
		return bufInts[bufI++] ;
	}

	static int[] Int( int n ) throws IOException{
		int[] res = new int[n] ;
		for( int i = 0 ; i < n ; i++ )
			res[i] = Int() ;
		return res ;
	}

	static void bufReaderNInts() throws IOException{
		String[] ss = buf.readLine().split(" ") ;
		bufInts = new int[ss.length] ;
		for( int i = 0 ; i < ss.length ; i++ ){
			bufInts[i] = Integer.parseInt(ss[i]) ;
		}
		bufI = 0 ;
	}

	static int bufL = 0 ;
	static long[] bufLongs = new long[0] ;

	static long Long() throws IOException{
		if( bufL == bufLongs.length )
			bufReaderNLongs() ;
		return bufLongs[bufL++] ;
	}

	static long[] Long( int n ) throws IOException{
		long[] res = new long[n] ;
		for( int i = 0 ; i < n ; i++ )
			res[i] = Long() ;
		return res ;
	}

	static void bufReaderNLongs() throws IOException{
		String[] ss = buf.readLine().split(" ") ;
		bufLongs = new long[ss.length] ;
		for( int i = 0 ; i < ss.length ; i++ ){
			bufLongs[i] = Long.parseLong(ss[i]) ;
		}
		bufL = 0 ;
	}

	static int[] toArray( ArrayList<Integer> lijst ){
		int[] res = new int[lijst.size()] ;
		int t = 0 ;
		for( int i : lijst)
			res[t++] = i;
		return res ;
	}

	static void p( Object ...p){
		System.out.println(Arrays.deepToString(p));
	}

	static void wr( int[] rij ){
		for( int i = 0 ; i < rij.length - 1 ; i++ )
			out.print(rij[i] + " ") ;
		out.println(rij[rij.length-1]);

	}

	static void wr( long[] rij ){
		for( int i = 0 ; i < rij.length - 1 ; i++ )
			out.print(rij[i] + " ") ;
		out.println(rij[rij.length-1]);

	}

}


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

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

class TaskD {
    static final long BASE = 31371;

    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int d1 = in.nextInt();
        int d2 = d1 + 1;
        String s = in.next();
        int n = s.length();
        StringBuilder res = new StringBuilder();
        res.append(s);
        long[] hash = new long[n + 1];
        long[] hashRev = new long[n + 1];
        long[] basePow = new long[n + 1];
        basePow[0] = 1;
        for (int i = 0; i < n; ++i)
            basePow[i + 1] = basePow[i] * BASE;
        boolean bigger = false;
        int i = 0;
        while (i < n) {
            char min = res.charAt(i);
            int oldi = i;
            for (char ch = min; ch <= 'z'; ++ch) {
                if (!bigger && ch > min) {
                    bigger = true;
                    for (int ii = i + 1; ii < n; ++ii)
                        res.setCharAt(ii, 'a');
                }
                res.setCharAt(i, ch);
                hash[i + 1] = hash[i] * BASE + ch;
                hashRev[i + 1] = hashRev[i] + ch * basePow[i];
                boolean ok = true;
                if (i + 1 >= d1) {
                    if ((hash[i + 1] - hash[i + 1 - d1] * basePow[d1]) * basePow[i + 1 - d1] == (hashRev[i + 1] - hashRev[i + 1 - d1])) {
                        ok = false;
                    }
                }
                if (i + 1 >= d2) {
                    if ((hash[i + 1] - hash[i + 1 - d2] * basePow[d2]) * basePow[i + 1 - d2] == (hashRev[i + 1] - hashRev[i + 1 - d2])) {
                        ok = false;
                    }
                }
                if (ok && (bigger || i + 1 < n)) {
                    ++i;
                    break;
                }
            }
            if (i == oldi) {
                if (!bigger) {
                    for (int ii = i; ii < n; ++ii) res.setCharAt(ii, 'a');
                }
                res.setCharAt(i, 'a');
                --i;
                while (i >= 0 && res.charAt(i) == 'z') {
                    res.setCharAt(i, 'a');
                    --i;
                }
                if (i < 0) {
                    out.println("Impossible");
                    return;
                }
                res.setCharAt(i, (char) (res.charAt(i) + 1));
                bigger = true;
            }
        }
        out.println(res.toString());
    }
}

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 (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

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

    }


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

public class Main {

	public static void main(String[] args) {
		try {
			BufferedReader questionreader = new BufferedReader(new InputStreamReader(System.in));
			PrintWriter answerwriter = new PrintWriter(System.out);

			int D = Integer.parseInt(questionreader.readLine());
			char[] S = questionreader.readLine().toCharArray();

			answerwriter.println(analyze(D, S));

			answerwriter.close();
			questionreader.close();

		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return;
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}
	}

	public static int[] l = null;
	public static int[] n = null;
	public static int[] o = null;
	public static int[] u = null;

	public static String analyze(final int D, final char[] S) {
		S[S.length-1]++;
		int i = S.length-1;
		while (S[i] > 'z') {
			if (i == 0) return "Impossible";
			S[i] = 'a';
			S[--i]++;
		}
		l = new int[S.length+1];
		n = new int[S.length+1];
		o = new int[S.length+1];
		u = new int[S.length+1];
		int[] t = new int[S.length+1];
		t[0] = D-1;
		i = 0;
		while (i < S.length) {
			if (S[i] == '0') {
				S[i] = 'a';
				if (i+1 < S.length) S[i+1] = '0';
			}
			u[i+1] = u[i]+S[i];
			if (i>0) {
				if (S[i]==S[i-1]) { l[i]=l[i-1]; n[l[i]]++; o[i]=o[i-1]+1; }
				else { l[i]=l[i-1]+1; n[l[i]]=0; o[i]=0; }
			} else { l[i]=0; n[l[i]]=0; o[i]=0; }

			if (i >= t[i]) {
				if (check(i-D, i, S) || check(i-D+1, i, S)) {
					if (i+1 < S.length) S[i+1] = '0';
					S[i]++;
					n[l[i]]--;
					while (S[i] > 'z') {
						if (i == 0) return "Impossible";
						S[i] = '0';
						S[--i]++;
						n[l[i]]--;
					}
					continue;
				}
			}
			int j = i;
			i++;
			t[i] = Math.max(i, t[i-1]);
			int k = j-D+1+(t[i]-j)*2;
			while (t[i] < S.length && k < j) {
				if (k < 0) { t[i]++; k+=2; continue; }
				if (k == 0) {
					if (S[j]!=S[k]) { t[i]++; k+=2; continue; }
				} else {
					if (S[j]!=S[k] && S[j]!=S[k-1]) { t[i]++; k+=2; continue; }
				}
				break;
			}
		}
		return String.valueOf(S);
	}

	public static boolean check(int p, int q, char[] S) {
		if (p < 0) return false;
		int m = (q-p)/2;
		if (u[q+1]-u[q-m] != u[p+m+1]-u[p]) return false;
		while (S[p]==S[q]) {
			m = Math.min(n[l[p]]-o[p],o[q])+1;
			p+=m;
			q-=m;
			if (p>q) return true;
		}
		return false;
	}
}


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

public class Main {

	public static void main(String[] args) {
		try {
			BufferedReader questionreader = new BufferedReader(new InputStreamReader(System.in));
			PrintWriter answerwriter = new PrintWriter(System.out);

			int D = Integer.parseInt(questionreader.readLine());
			char[] S = questionreader.readLine().toCharArray();

			answerwriter.println(analyze(D, S));

			answerwriter.close();
			questionreader.close();

		} catch (FileNotFoundException e) {
			e.printStackTrace();
			return;
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}
	}

	public static String analyze(final int D, final char[] S) {
		S[S.length-1]++;
		int i = S.length-1;
		while (S[i] > 'z') {
			if (i == 0) return "Impossible";
			S[i] = 'a';
			S[--i]++;
		}
		boolean[][] table = new boolean[S.length][D+2];
		for (i = 0; i < S.length; i++) { table[i][0] = true; table[i][1] = true; }
		i = 0;
		while (i < S.length) {
			if (S[i] == '0') {
				S[i] = 'a';
				if (i+1 < S.length) S[i+1] = '0';
			}
			for (int j = 0; j < D; j++) {
				if (i-j <= 0) break;
				if (table[i-1][j] && S[i-j-1]==S[i]) table[i][j+2] = true;
				else table[i][j+2] = false;
			}
			if (table[i][D] || table[i][D+1]) {
				if (i+1 < S.length) S[i+1] = '0';
				S[i]++;
				while (S[i] > 'z') {
					if (i == 0) return "Impossible";
					S[i] = '0';
					S[--i]++;
				}
				continue;
			}
			i++;
		}
		return String.valueOf(S);
	}
}


mport java.util.*;
public class A {
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		System.out.println(sc.nextInt()==2?2:1);
		sc.close();
	}
}


import java.util.Scanner;

public class Solution {

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

		long num = sc.nextLong();

		while (num > 1) {
			for(int i=num-1; i > 1; i--) {
				if (num % i != 0) {
					break;
				}
			}
			num = num - i;
		}

		System.out.println(num);
	}

}


import java.util.Scanner;
public class A546{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int a = scan.nextInt();
        for(int i=2;i<a;i++) {
        if(n%i==0)
            System.out.println(1);
                 System.exit(0);
    }
     System.out.println(a);

    }
}


import java.io.*;
public class game {
    public static void main(String args[]){
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        String n=br.readLine();
        if(n=="2")
            System.out.print("2");
        else
            System.out.print("1");
    }
}


public class VasyatheHipster{
public static int Diferentes(int a, int b)
        {
            if (a<=b)
                    return a;
            else
                return b;

        }
    public static int Iguales(int a, int b)
    {
        int Aux=a-b;
        return Aux/2;
    }
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner a=new Scanner(System.in);
        int b=a.nextInt();
        int c=a.nextInt();
        System.out.print(Diferentes(b, c));
        System.out.print(" "+Iguales(b, c));
    }
}


    import java.util.*;
    public class Main{
        public static void main(String[] args){
            Scanner scan=new Scanner(System.in);
            int[]a=new int[2];
            for(int i:a){
                a=scan.nextInt();
            }
            int min=0;
            int max=0;
            if(a[0]!=a[1]){
            if(a[0]>=a[1]){
            min=a[1];
            max=a[0];
            }
            else{
                min=a[0];
                max=a[1];
            }
            System.out.println(min+" "+max/2);
        }
            else{
                System.out.println(a[0]+" "+0);
            }
        }
    }


public class main {

    public static void main(String args[]){ //method header

        //System.out.println("hello world !!"); //method type ... the both create the method we need .

        Scanner haha=new Scanner(System.in);
        int h, g;
        h=haha.nextInt();
        g=haha.nextInt();
        int a=0 , b=0;
        if(h>g){

            b=(h-g)/2;
            a=g;}
        else{
            b=(g-h)/2;
            a=h;}
        System.out.print(a);
        System.out.print(" ");
        System.out.print(b);

    }


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

public class Solution {
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str = br.readLine();
        StringTokenizer st = new StringTokenizer(str);
        int red = Integer.parseInt(st.nextToken());
        int blue = Integer.parseInt(st.nextToken());
        String res = findNoOfDaysSocksCanbeWorn(red, blue);
        System.out.println(res);
    }
    private String findNoOfDaysSocksCanbeWorn(int red, int blue) {
        StringBuffer sb = new StringBuffer("");
        int temp;
        sb.append(String.valueOf(Integer.min(red, blue)));
        temp = Math.abs(red - blue) / 2;
        sb.append(" ");
        sb.append(String.valueOf(temp));
        return sb.toString();
    }
}


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

public class ProblemD {

    public static void main(String[] args) throws IOException {
        BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
        String line = s.readLine();
        int len = line.length();
        int[] countA = new int[10];
        int[] countB = new int[10];
        for (int i = 0 ; i < len ; i++) {
            int c = line.charAt(i) - '0';
            countA[c]++;
        }
        countB = countA.clone();

        int maxzero = 0;
        int maxstart = -1;
        for (int start = 1 ; start <= 5 ; start++) {
            if (countA[start] >= 1 && countB[10-start] >= 1) {
                int zero = 1;
                countA[start]--;
                countB[10-start]--;
                for (int pair = 0; pair <= 4 ; pair++) {
                    zero += Math.min(countA[pair], countB[9-pair]);
                }
                if (maxzero < zero) {
                    maxzero = zero;
                    maxstart = start;
                }
                countA[start]++;
                countB[10-start]++;
            }
        }
        if (maxstart == -1) {
            for (int times = 0 ; times <= 1 ; times++) {
                for (int ct = 1 ; ct <= 10 ; ct++) {
                    int cx = ct % 10;
                    for (int x = 0 ; x < countA[cx] ; x++) {
                        System.out.print(cx);
                    }
                }
                System.out.println();
            }
            return;
        }
        countA[maxstart]--;
        countB[10-maxstart]--;

        String an = "";
        String bn = "";
        int fzero = countA[0] - countA[9];
        if (fzero >= 1) {
            for (int i = 0 ; i < fzero ; i++) {
                an = "0" + an;
                bn = "0" + bn;
            }
            countA[0] -= fzero;
            countB[0] -= fzero;
        }

        an = maxstart + an;
        bn = (10-maxstart) + bn;
        for (int pair = 0; pair <= 9 ; pair++) {
            int t = Math.min(countA[pair], countB[9-pair]);
            for (int times = 0 ; times < t ; times++) {
                an = pair + an;
                bn = (9-pair) + bn;
            }
            countA[pair] -= t;
            countB[9-pair] -= t;
        }

        for (int ct = 1 ; ct <= 10 ; ct++) {
            int cx = ct % 10;
            for (int x = 0 ; x < countA[cx] ; x++) {
                System.out.print(cx);
            }
        }
        System.out.println(an);

        for (int ct = 1 ; ct <= 10 ; ct++) {
            int cx = ct % 10;
            for (int x = 0 ; x < countB[cx] ; x++) {
                System.out.print(cx);
            }
        }
        System.out.println(bn);

    }

}


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

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

        String s = in.readLine();
        int[] a = new int[s.length()];
        for (int i = 0; i < s.length(); i++)
            a[i] = s.charAt(i) - '0';

        int[] count = new int[10];

        for (int i = 0; i < a.length; i++)
            count[a[i]]++;

        int max = Integer.MIN_VALUE;
        String max1 = "";
        String max2 = "";
        for (int i = 1; i <= 5; i++) {
            if (count[i] == 0 || count[10 - i] == 0)
                continue;
            int[] tmpCount1 = Arrays.copyOf(count, count.length);
            int[] tmpCount2 = Arrays.copyOf(count, count.length);
            tmpCount1[i]--;
            tmpCount2[10 - i]--;
            Ans ans = getPerms(tmpCount1, tmpCount2);

            if (ans.len > max) {
                max = ans.len;
                max1 = ans.s1 + Integer.valueOf(i).toString() + ans.z1;
                max2 = ans.s2 + Integer.valueOf(10 - i).toString() + ans.z2;
            }
        }

        if (max == Integer.MIN_VALUE) {
            int[] tmpCount1 = Arrays.copyOf(count, count.length);
            int[] tmpCount2 = Arrays.copyOf(count, count.length);

            String tmp1 = "";
            String tmp2 = "";
            while (tmpCount1[0] > 0 && tmpCount2[0] > 0) {
                tmp1 += 0;
                tmp2 += 0;
                tmpCount1[0]--;
                tmpCount2[0]--;
            }

            for (int i = 0; i <= 9; i++) {
                while (tmpCount1[i] > 0) {
                    max1 += i;
                    tmpCount1[i]--;
                }
                while (tmpCount2[i] > 0) {
                    max2 += i;
                    tmpCount2[i]--;
                }
            }

            max1 += tmp1;
            max2 += tmp2;
        }

        out.println(max1);
        out.println(max2);
        out.close();
    }

    static class Ans {
        public String s1;
        public String s2;
        public String z1;
        public String z2;
        public int len;

        public Ans() {
            s1 = "";
            s2 = "";
            z1 = "";
            z2 = "";
            len = 0;
        }
    }

    private static Ans getPerms(int[] count1, int[] count2) {
        Ans ans = new Ans();
        String tmp1 = "";
        String tmp2 = "";
        for (int i = 0; i <= 9; i++)
            while (count1[i] > 0 && count2[10 - i - 1] > 0) {
                tmp1 += i;
                tmp2 += 10 - i - 1;
                count1[i]--;
                count2[10 - i - 1]--;
            }

        while (count1[0] > 0 && count2[0] > 0) {
            ans.z1 += 0;
            ans.z2 += 0;
            count1[0]--;
            count2[0]--;
        }

        ans.len = tmp1.length() + ans.z1.length();

        for (int i = 0; i <= 9; i++) {
            while (count1[i] > 0) {
                ans.s1 += i;
                count1[i]--;
            }
            while (count2[i] > 0) {
                ans.s2 += i;
                count2[i]--;
            }
        }

        ans.s1 += tmp1;
        ans.s2 += tmp2;

        return ans;
    }
}


import sun.plugin.javascript.navig.Array;

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

public class B {
	static Scanner in; static int next() throws Exception {return in.nextInt();};
//	static StreamTokenizer in; static long next() throws Exception {in.nextToken(); return (long) in.nval;}
//	static BufferedReader in;
	static PrintWriter out;

	public static void main(String[] args) throws Exception {
		in = new Scanner(System.in);
//		in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
//		in = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

        String s = new String(in.next());

        int a[] = new int[10];
        Arrays.fill(a,0);
        int n = s.length();
        for (int i = 0;i < n;i++) a[s.charAt(i)-'0']++;
        int res = 0, best = 0;
        for (int i = 1;i <=5;i++) {
            int counter = 0;
            int b[] = a.clone();
            int c[] = a.clone();
            if (b[i] > 0 && c[10-i] > 0) {
                b[i]--;
                c[10-i]--;
                counter++;
                for (int j = 0;j < 10;j++) {
                    counter += Math.min(b[j],c[9-j]);
                    b[j] -= Math.min(b[j],c[9-j]);
                    c[9-j] -= Math.min(b[j],c[9-j]);
                }
            }
            counter += Math.min(b[0], c[0]);
            if (counter > res) {
                res = counter;
                best = i;
            }
        }

        int pairA[] = new int[n];
        int pairB[] = new int[n];
        int z = n-1;

        int b[] = a.clone();
        int c[] = a.clone();
        if (b[best] > 0 && c[10-best] > 0) {
            b[best]--;
            c[10-best]--;
            pairA[z] = best;
            pairB[z] = 10-best;
            z--;
            for (int j = 0;j < 10;j++) {
                for (int u = 0;b[j]>0&&c[9-j]>0;u++){
                    pairA[z] = j;
                    b[j]--;
                    pairB[z] = 9-j;
                    c[9-j]--;
                    z--;
                }
            }
            int sum1 = 0;
            for (int i = 1;i < 10;i++) {
                sum1 += b[i];
            }
            int sum2 = 0;

            for (int i = 1;i < 10;i++) {
                sum2+=c[i];
            }
            for (int i = 1;i < 10;i++) {
                while (b[i] > 0) {
                    out.print(i);
                    b[i]--;
                }
            }
            if (sum1 < sum2) {
                for (int i = sum1;i < sum2;i++)
                    c[0]--;
                out.print(0);
            }
            for (int i = z+1;i < n;i++) out.print(pairA[i]);
            for (int i = 0;i < b[0];i++) out.print(0);
            out.println();

            for (int i = 1;i < 10;i++) {
                while (c[i] > 0) {
                    out.print(i);
                    c[i]--;
                }
            }

            if (sum1 > sum2) {
                for (int i = sum2;i < sum1;i++)
                    b[0]--;
                out.print(0);
            }
            for (int i = z+1;i < n;i++) out.print(pairB[i]);
            for (int i = 0;i < c[0];i++) out.print(0);
            out.println();
        } else {
            char g[] = s.toCharArray();
            Arrays.sort(g);
            for (int i = n-1;i >= 0;i--) out.print(g[i]);
            out.println();

            for (int i = n-1;i >= 0;i--) out.print(g[i]);
        }

     //   out.println(res);

        out.println();
		out.close();
	}
}


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

public class CF139D {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] cc = br.readLine().toCharArray();
		int[] aa = new int[10];
		for (int i = 0; i < cc.length; i++) {
			int d = cc[i] - '0';
			aa[d]++;
		}
		int[] a0 = new int[10];
		int[] a1 = new int[10];
		int[] a2 = new int[10];
		int max = 0, z_ = 0, x_ = 0;
		for (int z = 0; z <= aa[0]; z++) {
			for (int d = 0; d <= 9; d++)
				a0[d] = aa[d];
			a0[0] -= z;
			for (int x = 1; x <= 5; x++)
				if (a0[x] > 0 && a0[10 - x] > 0) {
					for (int d = 0; d <= 9; d++)
						a1[d] = a2[d] = a0[d];
					a1[x]--;
					a2[10 - x]--;
					int cnt = 0;
					for (int d = 0; d <= 9; d++)
						cnt += Math.min(a1[d], a2[9 - d]);
					if (max < cnt + 1 + z) {
						max = cnt + 1 + z;
						z_ = z;
						x_ = x;
					}
				}
		}
		StringBuilder s1 = new StringBuilder();
		StringBuilder s2 = new StringBuilder();
		for (int d = 0; d <= 9; d++)
			a0[d] = aa[d];
		a0[0] -= z_;
		for (int i = 0; i < z_; i++) {
			s1.append('0');
			s2.append('0');
		}
		for (int d = 0; d <= 9; d++)
			a1[d] = a2[d] = a0[d];
		a1[x_]--;
		a2[10 - x_]--;
		s1.append(x_);
		s2.append(10 - x_);
		for (int d = 0; d <= 9; d++)
			while (a1[d] > 0 && a2[9 - d] > 0) {
				a1[d]--;
				a2[9 - d]--;
				s1.append(d);
				s2.append(9 - d);
			}
		for (int d = 0; d <= 9; d++) {
			for (int i = 0; i < a1[d]; i++)
				s1.append(d);
			for (int i = 0; i < a2[d]; i++)
				s2.append(d);
		}
		System.out.println(s1.reverse());
		System.out.println(s2.reverse());
	}
}


import java.util.Scanner;
import java.util.Vector;
import java.util.Arrays;
import java.util.Comparator;

public class A{
	public static void main(String[] args){
		Scanner in = new Scanner(System.in);
		long r = in.nextLong();
		for(int i = 1;i*i<=r;++i){
			long k = r - i*i - i - 1;
			if(k > 0 && k % (2*i) == 0){
				System.out.println(i + " " + k/(2*i));
				return;
			}

		}
		System.out.println("NO");
	}
}


import java.io.*;
import java.util.*;
public class HeidiLearnsHashing
{
	public static void main(String[] s)
	{
		int j,count=0;
		long r,x=0,y=0;
		Scanner sc=new Scanner(System.in);
		r=sc.nextLong();
		r--;
		if(r!=0)
		{
		for(j=1;j<=(1000000);j++)
		{
			if(count==1)
				{
					break;
				}
			if(r%j==0)
			{
				if(((r/j)-(j+1))>0 && ((r/j)-(j+1))%2==0)
				{
					count=1;
					x=j;
					y=(((r/j)-(j+1))/2);
				}
			}
		}
		}
		else
		{
			count==1;
			x=0;
			y=0;
		}
		if(count==1)
		System.out.println(x+" "+y);
		else
        System.out.println("NO");
	}
}


import java.util.*;
import java.io.*;
public class hele{
	public static void main(String s[]){
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		long sqrt = 1000000;
		boolean b=false;
		for(int i=1;i<=sqrt;i++){
			long y = (long)((long)k-(long)(i*i)-(long)i-(long)1)%(long)(2*(long)i);
			if(y==0){
				long df = (long)((k-(long)(i*i)-(long)i-(long)1)/(long)(2*(long)i);
				if(df>0){
				System.out.println(i+" "+df);
				b=true;
				break;}
			}
		}
		if(b==false)
			System.out.println("NO");
	}
}


//1184A1
import java.util.*;
public class heidiA1{
  public static void main(String[] args) {
    int r=sc.nextInt();
    if(r%2==0||r<=3)
    System.out.println("NO");
    else{
      System.out.println("1"+" "+((r-3)/2));
    }
  }
}


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

//********************************************************K.S.J_@@@@@@@@@@@@@@@@@@@@@@@@@****************************

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

	static void init(InputStream input) {reader = new BufferedReader(new InputStreamReader(input) );
        tokenizer = new StringTokenizer("");
    }
	static String next() throws IOException {
        while (!tokenizer.hasMoreTokens() ) { tokenizer = new StringTokenizer(reader.readLine() );}
        return tokenizer.nextToken();
    }
	static String nextLine() throws IOException { return  next();}
	static int nextInt() throws IOException {return Integer.parseInt( next() );}
	static double nextDouble() throws IOException {return Double.parseDouble( next() );}
	static long nextLong() throws IOException {return Long.parseLong( next() );}
	static BigInteger nextBigInteger() throws IOException {return new BigInteger(next()) ;}

	public static void main(String args[]) throws IOException{
		init(System.in);
			int T=nextInt();
			int k=nextInt();
			int c=0;
				if(k%2==1){System.out.println("1");exit(0);}
				while(k>0 && k%2==0){k/=2;c++;}System.out.println(c+1);

			}

}


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

public class spoj
{
	static class FastReader
	{
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	public static void main(String args[]) throws IOException
	{
		FastReader fr = new FastReader();
		long low,high,mid,m;
		long n = fr.nextLong();
		long k = fr.nextLong();
		k--;
		if(k==(Math.pow(2,n)-1)/2)
		{
			System.out.println(n);
		}
		else if(k%2==0)
		{
			System.out.println(1);
		}
		else
		{
			while(low<high)
			{
				low = 0L;
				high = (long)Math.pow(2,n)-1;
				mid  = (low+high)/2;
				if(k>mid)
				{
					low = mid + 1;
				}
				else if(k<mid)
				{
					high = mid;
				}
				else
				{
					break;
				}
				n--;
			}
			System.out.println(n);
		}

 	}
}


/**
 *
 * @author steph
 */
public class Main {

public static String sequence(int num,int pos){
    String sequence="1";
    for (int i = 1; i < num; i++) {
        sequence=sequence+(i+1)+sequence;
        if (sequence.length()>pos) {
            break;
        }
    }
    return sequence;
}

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int sequen=sc.nextInt();
        int pos=sc.nextInt();
        System.out.println(sequence(sequen,pos).charAt(pos-1));
    }

}


import java.io.*;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Locale;
import java.util.StringTokenizer;

public class Solution743B implements Runnable {

    public static final double LOG2 = Math.log(2);
    public static final int NIL = Integer.MIN_VALUE;
    BufferedReader in;
    PrintWriter out;
    StringTokenizer tok = new StringTokenizer("");

    public static void main(String[] args) {
        new Thread(null, new Solution734B(), "", 256 * (1L << 20)).start();
    }

    public void run() {
        try {
            long t1 = System.currentTimeMillis();
            if (System.getProperty("ONLINE_JUDGE") == null
                    && Files.exists(Paths.get("input.txt"))) {
                in = new BufferedReader(new FileReader("input.txt"));
                out = new PrintWriter("output.txt");
            } else {
                in = new BufferedReader(new InputStreamReader(System.in));
                out = new PrintWriter(System.out);
            }
            Locale.setDefault(Locale.US);
            solve();
            in.close();
            out.close();
            long t2 = System.currentTimeMillis();
            System.err.println("Time = " + (t2 - t1));
        } catch (Throwable t) {
            t.printStackTrace(System.err);
            System.exit(-1);
        }
    }

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

    int readInt() throws IOException {
        return Integer.parseInt(readString());
    }

    long readLong() throws IOException {
        return Long.parseLong(readString());
    }

    double readDouble() throws IOException {
        return Double.parseDouble(readString());
    }

    // solution

    void solve() throws IOException {
        long n = readInt(),
                k = readLong();
        long mask = 0;

        for (int i = 0; i < k; i++) {
            mask <<= 1;
            mask ++;
        }
        long tail = k & mask;

        System.out.println(Long.numberOfTrailingZeros(tail));
    }
}


import java.util.*;
public class Main{
    publis static void main(String args[]){
        Scanner scn=new Scanner(System.in);
        int n=scn.nextInt();
        int ans=0;
        for(int i=1;i<=n/2;i++){
            if(n%i==0){
                ans++;
            }
        }
        System.out.println(ans);
    }
}


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

               boolean has=false;
               Scanner sc=new Scanner(System.in);
               n = sc.nextInt();
               int ans=0;
               int result=0;
               int l=0;
               for(int i=1;i<n;++i){
                         if(!has){
                                   if((n-i)%i==0){
                                            has=true;
                                            result++;
                                            has=false;
                                   }
                         }
               }
               ans=l;
               System.out.print(l);
               return ;
          }
}


import java.util.*;
public class Main{
    public static void main(String[]args)
    {
        Scanner SC = new Scanner(System.in);
        int N=SC.nextInt();
        int j=0;

            for(j=1;j<=N;i++)
            {
               if((N-i)%2==0)
                  j++;
            }
        System.out.println(j);
    }
}


import java.util.Scanner;
public class 935A {
    public static void main (String[] args) {
        Scanner sc = new Scanner (System.in);
        int num = sc.nextInt();
        int count = 0;
        for (int i = 1; i < num/2; i++)
            if (num%i==0)
                count++;
        System.out.println(count);
    }
}


import java.io.*;
public class NicholasandPermutation throws IOException{
	public static void main(String[] args) {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine().trim());
		String a[] = br.readLine();.trim().split(" ");
		int min, max;
		min = max = Integer.parseInt(a[0]);
		int minI, maxI;
		minI = maxI = 0;
		int arr[] = new int[n];
		for(int i = 0; i < n; i++){
			arr[i] = Integer.parseInt(a[i]);
			if(arr[i] < min) {
				minI = i;
				max = arr[i];
			}
			else if(arr[i] > max) {
				maxI = i;
				max = arr[i];
			}
		}

		if(minI > maxI){
			System.out.println(n - maxI - 1);
		}
		else{
			System.out.println(n - minI - 1);
		}

	}
}


mport java.util.*;
public class mrje {
	public static void main(String args[]) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int a=0,b=0;
		for(int i=1;i<=n;i++) {
			int t=sc.nextInt();
			if(t==1)
				a=i;
			if(t==n)
				b=i;
		}
		if(a<b) {
			System.out.println(Math.max(b-1,n-a));
		}else {
			System.out.println(Math.max(a-1, n-b));
		}
	}
}


public class NicholasPermutation {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		List<Integer> myList = new ArrayList<Integer>();
		Scanner sc= new Scanner(System.in);
	int n=sc.nextInt();
	for(int i=1;i<=n;i++){
		myList.add(sc.nextInt());
//		System.out.println(myList);
		}

	 int imax = 0;
		  for ( int i = 1; i < n; i++ )
		  {
		      if ( myList.get(i) > myList.get(imax) ) imax= i;
		  }
		  //System.out.println(imax);
		  int imin = 0;
		  for ( int i = 1; i < n; i++ )
		  {
		      if ( myList.get(i) < myList.get(imin) ) imin= i;
		  }

		  if (imax == 0 || imax == n - 1 || imin == 0 || imin == n - 1) {
				System.out.println( n - 1);
			} else {
				System.out.println(Math.max(Math.max(imax, imin), Math.max(n - 1 - imin, n - 1 - imax)));
			}

		  //System.out.println(largest);
		 // System.out.println(smallest);

	}
}


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

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] arr = new int[n];
        int min=0;
        int max=0;
        for ( int i=0 ;i < n ; i++)
        {
            int t = in.nextInt();
            arr[i] = t;
            if(t==1) min = i+1;
            if(t==n) max = i+1;
        }
        if( Math.abs(max - min) == n System.out.println(n);
        else
        {
            int val1 = maxi(min , n);
            int val2 = maxi(1 , max);
            int val3 = maxi(min , 1);
            int val4 = maxi(n , max);
            return Math.max(Math.max(Math.max(val1,val2),Math.max(val3,val4)))
        }
    }
    public static int maxi (int a , int b)
    {
       return Maths.abs(a-b);
    }
}

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

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

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

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

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

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

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

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

class OutputWriter {
    private final PrintWriter writer;

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

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

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

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

}


import java.util.*;
public class Main{
        public static void main(String[] args){
              Scanner sc=new Scanner(System.in);
              long n=sc.nextLong();
              HashSet<Long> s=new  HashSet<Long>();

              while(!s.contains(n)){
                      while(n%10==0){
                              n=n/10;
                      }
                      s.add(n);
                      n=n+1;
              }

        }
        int ans=s.size();
        System.out.println(ans);
}


public class Main{

        public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        HashMap<Integer,Integer> mp=new HashMap<Integer,Integer>();
        while(mp.get(n)!=1)
        {
            mp.put(n, 1);
            n=n+1;
            while(n%10==0) n/=10;
        }
        Syste.out.println(mp.size()) ;

    }
}


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

import static java.lang.Math.*;

public class Main implements Runnable {
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private SpaceCharFilter filter;
        private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

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

        public int read() {
            if (numChars==-1)
                throw new InputMismatchException();

            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                }
                catch (IOException e) {
                    throw new InputMismatchException();
                }

                if(numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
        public int nextInt() {
            int c = read();

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

            int sgn = 1;

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

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

            return res * sgn;
        }

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

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

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

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

            return res.toString();
        }

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

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

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);
        }
    }
    public static void main(String args[]) throws Exception {
        new Thread(null, new Main(),"Main",1<<26).start();
    }

    static void merge(int arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        int L[] = new int [n1];
        int R[] = new int [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2){
            if (L[i] <= R[j]){
                arr[k] = L[i];
                i++;
            }
            else{
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1){
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sort(int arr[], int l, int r) {
        if (l < r)
        {
            int m = (l+r)/2;
            sort(arr, l, m);
            sort(arr , m+1, r);
            merge(arr, l, m, r);
        }
    }

    static void mergel(long arr[], int l, int m, int r) {
        int n1 = m - l + 1;
        int n2 = r - m;
        long L[] = new long [n1];
        long R[] = new long [n2];
        for (int i=0; i<n1; ++i)
            L[i] = arr[l + i];
        for (int j=0; j<n2; ++j)
            R[j] = arr[m + 1+ j];
        int i = 0, j = 0;
        int k = l;
        while (i < n1 && j < n2){
            if (L[i] <= R[j]){
                arr[k] = L[i];
                i++;
            }
            else{
                arr[k] = R[j];
                j++;
            }
            k++;
        }
        while (i < n1){
            arr[k] = L[i];
            i++;
            k++;
        }
        while (j < n2)
        {
            arr[k] = R[j];
            j++;
            k++;
        }
    }
    static void sortl(long arr[], int l, int r) {
        if (l < r)
        {
            int m = (l+r)/2;
            sortl(arr, l, m);
            sortl(arr , m+1, r);
            mergel(arr, l, m, r);
        }
    }

    public void run() {
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);

        long n=in.nextLong();
        int cnt=0;
        if(n==1)
            cnt--;
        while(true){
            n++;
            cnt++;


import java.util.ArrayList;
import java.util.Scanner;
public class ReachableNumbers {

public static int Main(int n)
{
    int z;
    StringBuilder s = new StringBuilder();

    ArrayList<Integer> nums = new ArrayList<>();
    ++n;
    while(n > 0)
    {
        nums.add(n%10);
        n /= 10;
    }
    while(nums.get(0) == 0)
    {
        nums.remove(0);
    }

    for(int i = nums.size()-1; i>=0; i--)
    {
        s.append(nums.get(i));
    }

    z = Integer.parseInt(s.toString());

    return z;
}

public static int ReachableNums(int n)
{
    ArrayList<Integer> Rnums = new ArrayList<>();
    int count = 1;
    Rnums.add(n);
    int x = removeZero(n);

    while(!Rnums.contains(x))
    {

        count++;
        Rnums.add(x);
        x = removeZero(x);
    }

    return count;
}

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = input.nextInt();
        System.out.println ReachableNums(x));
    }

}


import java.util.Scanner;

/**
 *
 * @author marwa
 */
public class Main {

    public static void main(String[] args) throws java.lang.Exception {
        /*------------------------------------A. Sereja and Coat Rack----------------------------------------------------**/
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int d = sc.nextInt();
        int[] visitors = new int[n];
        int total = 0;

        for (int i = 0; i < visitors.length; i++) {
            visitors[i] = sc.nextInt();

        }
        Arrays.sort(visitors);
        int m = sc.nextInt();
        for (int i = 0; i < m; i++) {
            total += visitors[i];
        }
        int ppl, penalty;
        if (m > n) {
            ppl = m - n;
            penalty = ppl * d;
        }else
            penalty=0;
        int cost = total - penalty;
        System.out.println(cost);
    }

}


import java.io.PrintWriter;

public class A implements Runnable {
	static String Y = "YES", N = "NO";
	static long inf = (long) 1e16;

	public static void main(String[] args) {
		new Thread(null, new A(), "Solver", 1L << 26).start();
	}

	private Scanner scan;
	private PrintWriter out;

	public A() {
		scan = new Scanner(System.in);
		out = new PrintWriter(System.out);
	}

	public void run() {
		try {
			solve();
			out.close();
		} catch (Exception e) {
			System.out.println(1 / 0);
			e.printStackTrace();
		}
	}

	void solve() {
		int n = scan.nextInt(), d = scan.nextInt();
		int[] costs = new int[n];
		for(int i=0;i<n;i++) {
			costs[i] = scan.nextInt();
		}
		int m = scan.nextInt();
		int ans = 0;
		for(int i=0;i<m;i++) {
			if(i < n)
				ans += costs[i];
			else
				ans -= d;
		}
		out.println(ans);

	}
	static class Pair implements Comparable<Pair>{
		long a,b;
		public Pair(long a, long b) {
			this.a = a;
			this.b = b;
		}
		@Override
		public int compareTo(Pair o) {
			if(a == o.a)
				return Long.compare(b, o.b);
			return Long.compare(a,o.a);
		}
	}

	static long max(long... ls) {
		long max = ls[0];
		for (long l : ls) {
			if (l > max)
				max = l;
		}
		return max;
	}

	static int max(int... ls) {
		int max = ls[0];
		for (int l : ls) {
			if (l > max)
				max = l;
		}
		return max;
	}

	static long min(long... ls) {
		long min = ls[0];
		for (long l : ls) {
			if (l < min)
				min = l;
		}
		return min;
	}

	static int min(int... ls) {
		int min = ls[0];
		for (int l : ls) {
			if (l < min)
				min = l;
		}
		return min;
	}

	static void yes(boolean a) {
		System.out.println(a ? Y : N);
	}

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


public class solution{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int sum=0;
		int n = scan.nextInt();
		int d = scan.nextInt();
		int arr[] = new int[n];
		for(int i=0;i<n;i++){
			arr[i] = scan.nextInt();
		}
		int m = scan.nextInt();
		int jum = n>m?m:n;
		for(int i = 0;i<jum;i++){
			sum += arr[i];
		}
		sum -= m>n?(m-n)*d:0;
		System.out.println(sum);
	}
}


import java.util.Scanner;
/**
 *
 * @author Rawan Ali
 */
public class SerejaAndCoatRack {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
`Scanner input = new Scanner(System.in);
int n =input.nextInt();
int d= input.nextInt();
int a=0;
  int arr[] = new int[n];
  if(n>=1&&d<=100){
        for(int j = 0 ; j < arr.length ;j++){

            arr[j] = input.nextInt();
            if ( arr[j]<=100 && arr[j]>=1){
            a= a+ arr[j];}
        }

        int m = input.nextInt();
        if (m<=100&&m>=1){
        int l = n-m;
        int s=l*d;
       int total = a+s;

              System.out.println(total);

    }
  }
}
}


import java.util.Scanner;

import org.aspectj.lang.reflect.CatchClauseSignature;

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

		String str;
		Scanner scanner= new Scanner(System.in);

			int i=0,j=0;
			str = scanner.nextLine();

		for(int k=0;k<str.length();k++) {
			if (str.charAt(k)=='o') {
				i++;
			}
			else if(str.charAt(k)=='-')
				j++;
		}
		try {
		if(j%i==0) {
			System.out.println("yes");
		}
		else
			System.out.println("no");
	}
	catch(ArithmeticException e){
	System.out.println("no");
	}
	}
}


import java.util.*;

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

		String s = sc.nextLine();

		int balls = 0;
		int lines = 0;
		for(int i=0; i<s.length(); i++){
			char thing = s.charAt(i);

			if(thing.equals('-')){
				lines++;
			}
			else if(thing.equals('o')){
				balls++;
			}
		}

		if(lines%balls==0){
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}
}


package main;

import IO.FastScanner;
import java.io.PrintWriter;

public class TaskA {
    public void solve(int testNumber, FastScanner in, PrintWriter out) {
        String str = in.next();

        int dash = 0;
        int circ = 0;
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == '-') {
                dash++;
            }
            else {
                circ++;
            }
        }
        if (dash % circ == 0) {
            out.println("YES");
        }
        else {
            out.println("NO");
        }
    }
}


import java.util.Scanner;
public class CF980A {
    public static void main(String[] args){
        Scanner s = new Scanner(System.in);
        char[] c = sc.next().toCharArray();
        int o = 0;
        int t = 0;
        for(char ch : c){
            if (ch == 'o') {
                o++;
            } else {
                t++;
            }
        }
        System.out.println((o==0 || t%o==0)?"YES":"NO");
    }

}