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

public class C {

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

		int n = sc.nextInt();
		int m = sc.nextInt();
		long k = sc.nextLong();
		int x = sc.nextInt()-1;
		int y = sc.nextInt()-1;

		long[][] arr= new long[n][m];

		if(n!=1 || m!=1)
		{
			if(n!=1)
			{
				long periods = k/(1l*n*m+1l*m*(n-2));
				//System.out.println(periods);
				long remain = k%(1l*n*m+1l*m*(n-2));
				//for()
				//int j = 0;
				for(int i=0;i<n;i++)
					if(i == 0 || i == n-1)
						Arrays.fill(arr[i], periods);
					else
						Arrays.fill(arr[i], 2*periods);

				k = remain;
			}
			int i = 0;
			boolean up = true;
			while(k>0)
			{
				//System.out.println(k);
				for(int j=0;j<m && k>0;j++,k--)
					arr[i][j]++;
				if(i==0)
				{
					i=Math.min(1, n-1);
					up = true;
				}
				else
					if(i==n-1)
					{
						i=n-2;
						up = false;
					}
					else
						if(up)
							i++;
						else
							i--;
			}

			long min = Long.MAX_VALUE;
			long max = 0;
			for(i=0;i<n;i++)
				for(int j=0;j<m;j++)
				{
					min = Math.min(min, arr[i][j]);
					max = Math.max(max, arr[i][j]);
				}

			System.out.println(max + " " + min + " " + arr[x][y]);
		}
		else
		{
			System.out.println(k +" " + k + " " + k);
		}
	}

	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

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

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

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

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

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

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

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

}


// package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class AT2 {
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int t=scan.nextInt();
        StringBuilder print=new StringBuilder();
        while(t-->0){
            int n=scan.nextInt();
            int k=scan.nextInt();
            int d=scan.nextInt();
            int[] arr=new int[n];
            for (int i = 0; i <n ; i++) {
                arr[i]=scan.nextInt();
            }
            Map<Integer,Integer> m=new HashMap<>();
            for(int i=0;i<d;i++){
                m.putIfAbsent(arr[i],0);
                m.put(arr[i],m.get(arr[i])+1);
            }
            int min=m.keySet().size();
            for(int i=d;i<n;i++){
                int rem=arr[i-d];
                m.put(rem,m.get(rem)-1);
                if(m.get(rem)==0){
                    m.remove(rem);
                }
                m.putIfAbsent(arr[i],0);
                m.put(arr[i],m.get(arr[i])+1);
                min=Math.min(min,m.keySet().size());
            }
            print.append(min+"\n");
        }
        System.out.println(print);
    }
    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;
        }
    }

}


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

import Contest596.A.FastReader;

public class B1 {

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

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

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

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

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

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

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

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FastReader scn = new FastReader();
		int tc = scn.nextInt();
		while (tc-- > 0) {
			int n = scn.nextInt();
			int arr[] = new int[n];
			int k = scn.nextInt();
			int d = scn.nextInt();
			for (int i = 0; i < n; i++) {
				arr[i] = scn.nextInt();
			}
			int cout = Integer.MAX_VALUE;
//			int res[]=new int[n];
//			if (n == d) {
//				int c = 0;
//				int hash[] = new int[k + 1];
//				for (int j = 0; j < n; j++) {
//					hash[arr[j]]++;
////					res[j]
//				}
//				for (int val : hash) {
//					if (val != 0)
//						c++;
//				}
//				cout=Math.min(cout, c);
//			} else {
				for (int i = 0; i <= n - d; i++) {
					int c = 0;
					int hash[] = new int[k + 1];
					for (int j = i; j < i + d && j < n; j++) {
						hash[arr[j]]++;
//					res[j]
					}
					for (int val : hash) {
						if (val != 0)
							c++;
					}
//				res[i]=c;
					cout = Math.min(c, cout);
				}
//			}
			System.out.println(cout);
		}
	}
}


import java.util.*;
public class roun{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
String s = input.next();
int size = s.length() , n1 , n2 , n3 , sum=-1;
for(int i = 1 ; i < size-1 ; i++)
if((n1=check(s.substring(0 , i ))) != -1)
for(int j = i+1 ; j < size ; j++)
if((n2=check(s.substring(i , j ))) != -1)
if((n3=check(s.substring(j , size ))) != -1) sum = max(sum , n1+n2+n3);
System.out.println(sum);

}
public static int check(String v){
if(v.startsWith("0") && v.length() > 1) return -1;
int i = Integer.parseInt(v);
return (i > (int)1e6)? -1 : i;
}
public static int max(int a , int b){return a>b ? a : b;}
}


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

public class Main {

   void solve(){
       long n=nl();
        int k=ni();
        if(n==1){
            pw.println("1");
            return;
        }
        precompute(k+2);
        sz=k+1+k+1+1;
        long Mat[][]=new long[sz][sz];
        for(int i=0;i<=k;i++){
            Mat[k+1+i][i]=1;
        }
        for(int c=0;c<=k;c++){
            for(int r=0;r<=c;r++){
                Mat[r][k+1+c]=mul(ncr(c,r),pow[c-r],M);
                Mat[k+1+r][k+1+c]=ncr(c,r);
            }
        }
        for(int i=0;i<=2*k+1;i++) Mat[i][2*k+2]=Mat[i][2*k+1];
        Mat[sz-1][sz-1]=1;

        Mat=pow(Mat,n-2);
        long arr[]=new long[sz];
        for(int i=0;i<=k;i++) arr[i]=1;
        for(int i=k+1;i<=2*k+1;i++) arr[i]=pow[i-k];
        arr[sz-1]=1;
        arr[sz-1]=add(arr[sz-1],pow[k+1],M);
//        for(int i=0;i<sz;i++){
//            for(int j=0;j<sz;j++) pw.print(Mat[i][j]+" ");
//            pw.println("");
//        }
        long ans=0;
        for(int i=0;i<sz;i++){
            ans=add(ans,mul(arr[i],Mat[i][sz-1],M),M);
        }
        pw.println(ans);

    }
    int sz;
    long [][] pow(long A[][],long x){
        if(x==0){
            long C[][]=new long[sz][sz];
            for(int i=0;i<sz;i++) C[i][i]=1;
            return C;
        }else if(x==1){
            return A;
        }
        long C[][]=pow(A,x/2);
        C=mul(C,C);
        if((x&1)>0) return mul(A,C);
        return C;

    }
    long [][] mul(long A[][],long B[][]){
        long C[][]=new long[sz][sz];
        for(int i=0;i<sz;i++){
            for(int j=0;j<sz;j++){
                for(int k=0;k<sz;k++){
                    C[i][j]=(C[i][j]+(A[i][k]%M * B[k][j]%M)%M)%M;
                }
            }
        }
        return C;
    }

    long ncr(int n,int r) {
        long ans = fact[n];
        ans=mul(ans,inv[n-r],M);
        ans=mul(ans,inv[r],M);
        return ans;
    }
    long fact[];
    long inv[];
    long pow[];
    void precompute(int n){
       fact=new long[n+1];
       inv=new long[n+1];
       pow=new long[n+1];
       pow[0]=1;
       fact[0]=1;
       for(int i=1;i<=n;i++){
           pow[i]=(pow[i-1]*2)%M;
           fact[i]=(fact[i-1]*i)%M;
       }
       inv[n]=modInverse(fact[n],M);
        for(int i=n-1;i>=0;i--) inv[i]=(inv[i+1]*(i+1))%M;

    }
    long add(long x,long y,long M){
        x+=y;
        if(x>=M) x-=M;
        return x;
    }
    long sub(long x,long y,long M){
        x-=y;
        if(x<0) x+=M;
        return x;
    }
    long mul(long x,long y,long M){
        x*=y;
        if(x>=M) x%=M;
        return x;
    }
    long modpow(long a, long b,long M)
    {
        long r=1;
        while(b>0)
        {
            if((b&1)>0) r=mul(r,a,M);
            a=mul(a,a,M);
            b>>=1;
        }
        return r;
    }

    long modInverse(long A, long M)
    {

        return modpow(A,M-2,M);
    }

    long M= (long)1e9+7;
    InputStream is;
    PrintWriter pw;
    String INPUT = "";
    void run() throws Exception {
        is = INPUT.isEmpty() ? System.in : new ByteArrayInputStream(INPUT.getBytes());
        pw = new PrintWriter(System.out);
        long s = System.currentTimeMillis();
        solve();
        pw.flush();
        if(!INPUT.isEmpty())tr(System.currentTimeMillis()-s+"ms");

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

    private byte[] inbuf = new byte[1024];
    public int lenbuf = 0, ptrbuf = 0;

    private int readByte() {
        if(lenbuf == -1)throw new InputMismatchException();
        if(ptrbuf >= lenbuf){
            ptrbuf = 0;
            try { lenbuf = is.read(inbuf); } catch (IOException e) { throw new InputMismatchException(); }
            if(lenbuf <= 0)return -1;
        }
        return inbuf[ptrbuf++];
    }

    private boolean isSpaceChar(int c) { return !(c >= 33 && c <= 126); }
    private int skip() { int b; while((b = readByte()) != -1 && isSpaceChar(b)); return b; }

    private double nd() { return Double.parseDouble(ns()); }
    private char nc() { return (char)skip(); }

    private String ns() {
        int b = skip();
        StringBuilder sb = new StringBuilder();
        while(!(isSpaceChar(b))){ // when nextLine, (isSpaceChar(b) && b != ' ')
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    private char[] ns(int n) {
        char[] buf = new char[n];
        int b = skip(), p = 0;
        while(p < n && !(isSpaceChar(b))){
            buf[p++] = (char)b;
            b = readByte();
        }
        return n == p ? buf : Arrays.copyOf(buf, p);
    }

    private char[][] nm(int n, int m) {
        char[][] map = new char[n][];
        for(int i = 0;i < n;i++)map[i] = ns(m);
        return map;
    }

    private int[] na(int n) {
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = ni();
        return a;
    }

    private int ni() {
        int num = 0, b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }

    private long nl() {
        long num = 0;
        int b;
        boolean minus = false;
        while((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-'));
        if(b == '-'){
            minus = true;
            b = readByte();
        }

        while(true){
            if(b >= '0' && b <= '9'){
                num = num * 10 + (b - '0');
            }else{
                return minus ? -num : num;
            }
            b = readByte();
        }
    }
    private boolean oj = System.getProperty("ONLINE_JUDGE") != null;
    private void tr(Object... o) { if(INPUT.length() > 0)System.out.println(Arrays.deepToString(o)); }

}


/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
    public static void main (String[] args) throws java.lang.Exception
    {
        Scanner sc = new Scanner(System.in);
        int mod = 1000000007;
        int n = sc.nextInt();
        int a = sc.nextInt()-1;
        int b = sc.nextInt()-1;
        int k = sc.nextInt();
        if(a<b){
            n=b;
            a=b-a;
        }
        else{
            n=n-1-b;
            a=a-b;
        }
        int dp[][] = new int[k+1][n+1];//dp[i][j] is the number of ways to get from a to j in i steps
        int dpsum[][] = new int[k+1][n+1];//dpsum[i][j]=dp[i][j]+dp[i][j-1]+...+dp[i][1]
        for(int j = 0;j<=n;j++){
            dp[0][j]=0;
        }
        dp[0][a]=1;
        dpsum[0][0]=0;
        for(int j =1;j<=n;j++){
            dpsum[0][j]=(dpsum[0][j-1]%mod+dp[0][j]%mod)%mod;
        }
        for(int i = 1;i<=k;i++){
            dp[i][0]=0;
            dpsum[i][0]=0;
            for(int j = 1;j<=n;j++){
                dp[i][j]=(dpsum[i-1][n]%mod+mod-(dpsum[i-1][j/2]%mod+dp[i-1][j]%mod)%mod)%mod;
                dpsum[i][j]=(dpsum[i][j-1]%mod+dp[i][j]%mod)%mod;
            }
        }
        /*System.out.println(n);
        System.out.println(a);
        for(int i = 0;i<=k;i++){
            for(int j = 0;j<=n;j++){
                System.out.print(dp[i][j]);
            }
            System.out.println();
        }*/
        System.out.println(dpsum[k][n]);
    }
}


import java.util.Scanner;

public class E {
    static final int MODNUM = 1000000007;
    static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {
        int n = scanner.nextInt(), a = scanner.nextInt(), b = scanner.nextInt(), k = scanner.nextInt();
        int[][] dp = new int[k + 1][], sum = new int[k + 1][];
        for (int i = 0; i < k + 1; i++) {
            dp[i] = new int[n + 1];
            sum[i] = new int[n + 1];
        }
        dp[0][a] = 1;
        for (int i = a; i <= n; i++)
            sum[0][i] = 1;

        for (int i = 1; i <= k; i++) {
            for (int j = 1; j <= n; j++) {
                if (j == b)
                    dp[i][j] = 0;
                else if (j > b) {
                    dp[i][j] = (sum[i - 1][n] - sum[i - 1][(j + b) / 2] - dp[i - 1][j]) % MODNUM;
                } else {
                    dp[i][j] = (sum[i - 1][(j + b - 1) / 2] - dp[i - 1][j]) % MODNUM;
                }

                sum[i][j] = ((sum[i][j-1] + dp[i][j]) % MODNUM + MODNUM) % MODNUM;
            }
        }

        System.out.println(sum[k][n]);
    }
}


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

/*
 * Codeforces Round #274 (Div. 2)
 * http://codeforces.ru/contest/479
 */

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

	public static void A() {
		int a = IO.readInt();
		int b = IO.readInt();
		int c = IO.readInt();

		int max = a + b + c;
		if (a + b * c > max) {
			max = a + b * c;
		}
		if (a * b + c > max) {
			max = a * b + c;
		}
		if (a * b * c > max) {
			max = a * b * c;
		}
		if ((a + b) * c > max) {
			max = (a + b) * c;
		}
		if (a * (b + c) > max) {
			max = a * (b + c);
		}

		IO.println(max);
	}

	public static void B() {
		int n = IO.readInt();
		int k = IO.readInt();

		Castle[] a1 = new Castle[n];
		Castle[] a2 = new Castle[n];

		for (int index = 0; index < n; ++index) {
			a1[index] = new Castle();
			a1[index].i = index + 1;
			a1[index].n = IO.readInt();
		}

		Arrays.sort(a1);

		for (int index = 0; index < n; ++index) {
			a2[index] = new Castle();
			a2[index].i = a1[index].i;
			a2[index].n = a1[index].n;
		}

		int d = a1[n - 1].n - a1[0].n;
		int l = k;
		int minStep = 0;
		while (d > 0 && l > 0) {
			if (a1[n - 1].n - 1 < a1[0].n + 1) {
				break;
			}

			a1[n - 1].n--;
			a1[0].n++;

			l--;

			Arrays.sort(a1);

			int newD = a1[n - 1].n - a1[0].n;
			if (newD < d) {
				d = newD;
				minStep = k - l;
			}
		}

		IO.println(d + " " + minStep);

		while (minStep > 0) {
			if (a2[n - 1].n - 1 < a2[0].n + 1) {
				break;
			}

			IO.println(a2[n - 1].i + " " + a2[0].i);

			a2[n - 1].n--;
			a2[0].n++;

			minStep--;

			Arrays.sort(a2);
		}
	}

	private static class Castle implements Comparable<Castle>{
		private int n;
		private int i;

		@Override
		public int compareTo(Castle o) {
			return Integer.compare(n, o.n);
		}
	}

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

	public static void C() {
		int n = IO.readInt();

		Exam[] a = new Exam[n];
		for (int index = 0; index < n; ++index) {
			a[index] = new Exam();
			a[index].a = IO.readInt();
			a[index].b = IO.readInt();
		}

		Arrays.sort(a);

		int minGroup = -1;
		int minPrevGroup = -1;

		for (int index = 0; index < n; ++index) {
			if (index > 0 && a[index].a != a[index - 1].a) {
				minPrevGroup = minGroup;
				minGroup = -1;
			}

			if (a[index].b < minPrevGroup) {
				minGroup = a[index].a;
			}
			else if (a[index].b > minGroup){
				minGroup = a[index].b;
			}
		}

		IO.println(minGroup);
	}

	private static class Exam implements Comparable<Exam>{
		int a;
		int b;

		@Override
		public int compareTo(Exam o) {
			return Integer.compare(a, o.a);
		}

	}

	public static void D() {
		int n = IO.readInt();
		int l = IO.readInt();
		int y = IO.readInt();
		int x = IO.readInt();

		int[] a = new int[n];
		for (int i = 0; i < n; ++i) {
			a[i] = IO.readInt();
		}

		int measureX = find(a, x);
		int measureY = find(a, y);

		if (measureX > -1 && measureY > -1) {
			IO.println(0);
			return;
		}
		else if (measureX > -1) {
			IO.println(1);
			IO.println(y);
			return;
		}
		else if (measureY > -1) {
			IO.println(1);
			IO.println(x);
			return;
		}

		int measure = find(a, x - y, y);
		if (measure > -1) {
			IO.println(1);
			if (measure >= y) {
				IO.println(measure - y);
			}
			else {
				IO.println(measure + x);
			}
			return;
		}

		if (((long) x) + y <= (long) l) {
			measure = find(a, x + y);
			if (measure > -1) {
				IO.println(1);
				IO.println(measure + y);
				return;
			}
		}

		IO.println(2);
		IO.println(y + " " + x);
	}

	private static int find(int[] a, int x) {
		int i = 0;
		int j = 1;
		while (true) {
			int d = a[j] - a[i];
			if (d == x) {
				return a[i];
			}
			else if (d > x){
				if (i + 1 < j) {
					i++;
				}
				else if (j < a.length - 1) {
					j++;
				}
				else {
					break;
				}
			}
			else {
				if (j < a.length - 1) {
					j++;
				}
				else {
					break;
				}
			}

		}

		return -1;
	}

	private static int find(int[] a, int x, int margin) {
		int i = 0;
		int j = 1;
		while (true) {
			int d = a[j] - a[i];
			if (d == x && (a[i] >= margin || (a[a.length - 1] - a[j]) >= margin)) {
				return a[i];
			}
			else if (d > x){
				if (i + 1 < j) {
					i++;
				}
				else if (j < a.length - 1) {
					j++;
				}
				else {
					break;
				}
			}
			else {
				if (j < a.length - 1) {
					j++;
				}
				else {
					break;
				}
			}

		}

		return -1;
	}

	public static void E() {
		int mod = 1000000007;

		int n = IO.readInt();
		int a = IO.readInt();
		int b = IO.readInt();
		int k = IO.readInt();

		int h = a > b ? n - b : b - 1;
		int s = a > b ? a - b - 1 : b - a - 1;

		long[][] t = new long[k + 1][h];
		for (int i = 0; i <= k; ++i) {
			for (int j = 0; j < h; ++j) {
				if (i == 0) {
					t[i][j] = 1L;
				}
				else if (j == 0) {
					t[i][j] = 0L;
				}
				else {
					t[i][j] = t[i][j - 1] + t[i - 1][j - 1];
					t[i][j] %= mod;
					if (2 * j < h) {
						t[i][j] += t[i - 1][2 * j];
						t[i][j] %= mod;
						t[i][j] += t[i - 1][2 * j - 1];
						t[i][j] %= mod;
					}
					else if (2 * j - 1 < h) {
						t[i][j] += t[i - 1][2 * j - 1];
						t[i][j] %= mod;
					}
					if (t[i][j] < t[i - 1][j]) {
						t[i][j] += mod;
					}
					t[i][j] -= t[i - 1][j];
				}
			}
		}

		IO.println(t[k][s]);
	}

	//************* Input/Output *************//

	private static class IO {
		static {
			setUpScanner();
		}

		private static Scanner scanner;

		private static void setUpScanner() {
			scanner = new Scanner(new java.io.BufferedInputStream(System.in));
		};

		public static boolean isEmpty() {
			return !scanner.hasNext();
		}

		public static boolean hasNextLine() {
			return scanner.hasNextLine();
		}

		public static String readLine() {
			String line;
			try {
				line = scanner.nextLine();
			} catch (Exception e) {
				line = null;
			}
			return line;
		}

		public static String readString() {
			return scanner.next();
		}

		public static int readInt() {
			return scanner.nextInt();
		}

		public static double readDouble() {
			return scanner.nextDouble();
		}

		public static float readFloat() {
			return scanner.nextFloat();
		}

		public static long readLong() {
			return scanner.nextLong();
		}

		public static void print(Object o) {
			System.out.print(o.toString());
		}

		public static void println(Object o) {
			System.out.println(o);
		}
	}

	//************* Algorithms *************//

	private static class Algo {

		public static int binSearch(int[] array, int n, int lo, int hi) {
			if (lo > hi) {
				return lo;
			}

			int mid = lo + (hi - lo) /2;
			int cmp = (int) Math.signum(n - array[mid]);
			if (cmp < 0) {
				return binSearch(array, n, lo, mid - 1);
			}
			else if (cmp == 0) {
				return mid;
			}
			else {
				return binSearch(array, n, mid + 1, hi);
			}
		}

	}
}


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

public class RidingInALift479E {
    static long P = 1000000007;

    static void go() {
        int n = in.nextInt();
        int a = in.nextInt();
        int b = in.nextInt();
        int k = in.nextInt();
        int max = n;
        if (b > a) {
            a = b - a;
            max = b;
        } else {
            max -= b - 1;
            a -= b;
        }
        long[][] dp = new long[max][k + 1];
        for (int i = 1; i < max; i++) {
            dp[i][0] = 1;
        }

        for (int j = 1; j <= k; j++) {
            long subtotal = dp[1][j - 1];
            for (int i = 2; i < max; i++) {
                if (i * 2 - 2 < max) {
                    subtotal += dp[i * 2 - 2][j - 1];
                    if (i * 2 - 1 < max) {
                        subtotal += dp[i * 2 - 1][j - 1];
                    }
                }
                subtotal %= P;
                dp[i][j] = subtotal - dp[i][j - 1];
                if (dp[i][j] < 0)
                    dp[i][j] += P;
            }
        }
        out.println(dp[a][k]);
    }

    static InputReader in;
    static PrintWriter out;

    public static void main(String[] args) {
        in = new InputReader(System.in);
        out = new PrintWriter(System.out);

        go();

        out.close();
    }

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

        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[] nextIntArray(int len) {
            int[] ret = new int[len];
            for (int i = 0; i < len; i++)
                ret[i] = nextInt();
            return ret;
        }

        public long[] nextLongArray(int len) {
            long[] ret = new long[len];
            for (int i = 0; i < len; i++)
                ret[i] = nextLong();
            return ret;
        }

        public int nextInt() {
            return (int) nextLong();
        }

        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 String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder sb = new StringBuilder(1024);
            do {
                sb.append((char) c);
                c = read();
            } while (!isSpaceChar(c));
            return sb.toString();
        }

        public static boolean isSpaceChar(int c) {
            switch (c) {
                case -1:
                case ' ':
                case '\n':
                case '\r':
                case '\t':
                    return true;
                default:
                    return false;
            }
        }
    }
}


import java.util.Scanner;

public class Solution {
    private static final int MOD = 1000000007;

    static long[][] dp;
    private static int start, end;
    private static long sum;

    private static int n, a, b, k;

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

        dp = new long[k + 1][n + 1];

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

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

            for (int j = 1; j <= n; j++) {
                if (j != b) {
                    if (sum == -1) {
                        initSum(n, i, j, b);
                    } else {
                        updateSum(n, i, j, b);
                    }

                    dp[i][j] = (MOD + sum - dp[i-1][j]) % MOD;
                }
            }
        }

        System.out.println(dp[k][a]);
    }

    private static void updateSum(int n, int k, int x, int b){
        int left = calcLeft(x, Math.abs(x - b));
        int right = calcRight(x, Math.abs(x - b));

        while (start < left){
            sum = (MOD + sum - dp[k-1][start]) % MOD;
            start++;
        }

        int j = end + 1;
        while (j <= right){
            sum = (sum + dp[k-1][j]) % MOD;
            j++;
        }

        start = left;
        end = right;
    }

    private static void initSum(int n, int k, int x, int b) {
        int left = calcLeft(x, Math.abs(x - b));
        int right = calcRight(x, Math.abs(x - b));

        sum = 0;

        for (int i = left; i <= right; i++) {
            sum = (sum + dp[k - 1][i]) % MOD;
        }

        start = left;
        end = right;
    }

    private static int calcRight(int x, int diff) {
        return Math.min(n, x + diff - 1);
    }

    private static int calcLeft(int x, int diff) {
        return Math.max(1, x - diff + 1);
    }
}


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

public class con274_E_Quick {

	static final int MOD = 1000_000_007;

	static long[][] cache;
	static long[] sum;
	static int n, b;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader( new InputStreamReader(System.in), 10*1024*1024 );
		StringTokenizer tok = new StringTokenizer(br.readLine());
		// n, a, b, k (2 <= n <= 5000, 1 <= k <= 5000, 1 <= a, b <= n, a != b).
		int a, k;
		n = Integer.parseInt(tok.nextToken());
		a = Integer.parseInt(tok.nextToken());
		b = Integer.parseInt(tok.nextToken());
		k = Integer.parseInt(tok.nextToken());

		cache = new long[n+1][k+1];
		sum = new long[n+1];
		sum[0] = 0;
		for (int ni = 1; ni <= n; ni++) {
			cache[ni][0] = count2(ni);
			sum[ni] = sum[ni - 1] + cache[ni][0];
		}
//		StringBuilder sb = new StringBuilder();
		for (int ki = 1; ki <= k; ki++) {
//			sb.setLength(0);
			for (int ni = 1; ni <= n; ni++) {
				cache[ni][ki] = count(ni, ki);
//				sb.append(cache[ni][ki]).append(' ');
			}
			for (int ni = 1; ni <= n; ni++) {
				sum[ni] = sum[ni-1] + cache[ni][ki];
			}
//			System.out.println(sb);
		}
		System.out.println( cache[a][k] );
	}

	private static int count2(int x) {
		return x == b ? 0 : 1;
	}

	private static int count(int x, int k) {
		assert(k > 0);

		// we have x -> [x-b+1, x+b-1]
		// from = Math.max(1, x - b + 1)
		// to = min(x+b-1, n)
		int d = Math.abs(x-b) - 1;
		if (d == 0) return 0;
		int f = Math.max(1, x-d);
		int t = Math.min(n, x+d);
		//System.out.printf("a=%d, b=%d, f=%d, t=%d, sum[%d]=%d, sum[%d]=%d, cache[%d][%d]=%d\n", x, b, f, t, f-1, sum[f-1], t, sum[t], x, k-1, cache[x][k-1]);
		return (int) ( (sum[t] - sum[f-1] - cache[x][k-1] ) % MOD );
	}

}


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

public class Codeforces479E
{
	private static final long MOD = 1000000007;
	public static void main(String[] args)
	{
		try
		{
			BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
			StringTokenizer st = new StringTokenizer(f.readLine());
			int n = Integer.parseInt(st.nextToken());
			int a = Integer.parseInt(st.nextToken());
			int b = Integer.parseInt(st.nextToken());
			int k = Integer.parseInt(st.nextToken());
			f.close();
			long[][] paths = new long[n+1][k+1]; //number of steps from 1 to i after j steps
			paths[a][0] = 1;
			long start = System.currentTimeMillis();
			boolean below = false;
			if(a < b)
				below = true;
			if(below)
			{
				for(int i = 1; i <= k; i++)
				{
					long[] partialSums = new long[n + 1];
					for(int j = 1; j < b; j++)
					{
						partialSums[j] = (partialSums[j - 1] + paths[j][i - 1])%MOD;
						/*for(int l = Math.max(1, 2*j - b + 1); l < j; l++)
						{
							//if(j == l)
							//	continue;
							paths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;
						}
						for(int l = j + 1; l < b; l++)
						{
							paths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;
						}*/
					}
					for(int l = 1; l < b; l++)
					{
						paths[l][i] = (MOD + paths[l][i] + partialSums[(b + l - 1)/2] - paths[l][i - 1])%MOD;
					}
				}
			}
			else
			{
				for(int i = 1; i <= k; i++)
				{
					long[] partialSums = new long[n + 1];
					for(int j = b + 1; j <= n; j++)
					{
						partialSums[j] = (partialSums[j - 1] + paths[j][i - 1])%MOD;
						/*for(int l = b + 1; l < j; l++)
						{
							//if(j == l)
							//	continue;
							paths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;
						}
						for(int l = j + 1; l <= Math.min(2*j - b - 1, n); l++)
						{
							paths[l][i] = (paths[l][i] + paths[j][i - 1])%MOD;
						}*/
					}
					for(int l = b + 1; l <= n; l++)
					{
						paths[l][i] = (MOD + paths[l][i] + partialSums[n] - partialSums[(b + l)/2] - paths[l][i - 1])%MOD;
					}
				}
			}
			//for(int i = 0; i <= n; i++)
			//	System.out.println(Arrays.toString(paths[i]));
			long count = 0;
			for(int i = 1; i <= n; i++)
			{
				count = (count + paths[i][k])%MOD;
			}
			System.out.println(count);
			long end = System.currentTimeMillis();
			//System.out.println(end - start);
		}
		catch(IOException e)
		{
			System.out.println(e);
		}
	}
}


/**
 * Created with IntelliJ IDEA.
 * User: baba26
 * Date: 10/20/14
 * Time: 5:08 PM
 * To change this template use File | Settings | File Templates.
 */

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

public class Main {

    final static long MOD = 1000000007;

    public static void main(String[] args) {

        MyScanner sc = new MyScanner();
        MyWriter mw = new MyWriter();

        int n , a ,b , k;
        n = sc.nextInt();
        a = sc.nextInt() -1 ;
        b = sc.nextInt() - 1;
        k = sc.nextInt();

        int[][] original  = new int[n][n];
        int [][] ans = new int [n][1] ;
        int difference ;

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

            if( i == b ) continue ;

            difference = Math.abs( b - i ) ;
            difference -- ;

            for( int j =  Math.max( 0 , i- difference ) ; j <= Math.min( n-1 , i + difference ) ; ++j  )
            {
                if(  j == i ) continue ;

                original[j][i] = 1 ;

            }

        }

        difference = Math.abs( b - a ) ;
        difference -- ;

        for( int j =  Math.max( 0 , a - difference ) ; j <= Math.min( n-1 , a + difference ) ; ++j  )
        {
            if(  j == a ) continue ;

            ans[j][0] = 1 ;

        }

        /*

        System.out.println("Before multiplication:");

        for( int i = 0 ; i < n; ++i )
        {
            System.out.println();

            for( int j = 0 ; j < n;  ++j)
                System.out.print( original[i][j] + " " );
        }

        */

        int[][] temp = pow( original , k -1 );

        /*

        System.out.println("After multiplication:");

        for( int i = 0 ; i < n; ++i )
        {
            System.out.println();

            for( int j = 0 ; j < n;  ++j)
                System.out.print( temp[i][j] + " " );
        }

        */

        int[][] tut = multiply( temp , ans );

        long xxx = 0 ;

        for( int i = 0; i < n ; ++i )
            xxx += tut[i][0] ;

        System.out.println( xxx%MOD );

    }

    static int[][] pow( int[][] base , int exp )
    {
        //System.out.println( exp ) ;
        int[][] result ;
        int n = base.length;
        int m = base[0].length;

        result = new int[n][m];

        if( exp == 0  )
        {
            for( int i = 0 ; i < m ; ++i)
                result[i][i] = 1 ;
        }

        else if( exp == 1 )
        {
            for( int i = 0 ; i < n ; ++i)
                for( int j = 0 ; j < m ; ++j )
                    result[i][j] = base[i][j];

        }

        else
        {
            result = pow( base , exp/2 ) ;
            result = multiply( result , result );

            if( exp%2 == 1 )
                result = multiply( result , base ) ;
        }

        return result;
    }

    static int[][] multiply( int[][]  l , int[][] r )
    {
        int n , k , m ;
        n = l.length;
        k = l[0].length;
        m = r[0].length;

        int[][] result = new int[n][m];

        for( int i = 0 ; i < n ; ++i)
            for( int j = 0 ; j < m ; ++j )
            {
                long temp = 0 ;

                for( int z = 0 ; z < k ; ++z)
                {
                    temp = ( temp + ((long)l[i][z])*r[z][j])%MOD;
                }

                result[i][j] = (int )(temp);

            }

        return result ;
    }

    static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in),8*1024);
        }

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

    }

    static class MyWriter {
        BufferedWriter bw;

        public  MyWriter() {
            bw = new BufferedWriter(new OutputStreamWriter(System.out),8*1024);
        }

        void print(String s)
        {
            try {
                bw.write( s , 0 , s.length() );

            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        void println(String s)
        {
            try {
                bw.write( s , 0 , s.length() );
                bw.newLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        void close()
        {
            try {
                bw.close();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }

}


import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.io.InputStream;

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

class TaskE {
    int n, a, b, k;

    int[][][] dp;

    final int MOD = (int)1e9 + 7;

    public void solve(int testNumber, InputReader jin, OutputWriter jout) {
        n = jin.int32();
        a = jin.int32();
        b = jin.int32();
        k = jin.int32();

        dp = new int[k + 1][n + 1][2];
        for(int i = 1; i <= n; i++)
            if(i != b) dp[0][i][0] = 1;

        for(int r = 1; r <= k; r++) {
            for(int i = 1; i <= n; i++) {
                dp[r - 1][i][1] = (dp[r - 1][i][0] + dp[r - 1][i - 1][1]) % MOD;
            }
            for(int i = 1; i <= n; i++) {
                int diff = Math.abs(i - b) - 1;
                int f = Math.max(1, i - diff);
                int l = Math.min(n, i + diff);
                dp[r][i][0] = (dp[r - 1][l][1] - dp[r - 1][f - 1][1]) % MOD;
                dp[r][i][0] = (dp[r][i][0] + MOD) % MOD;
                dp[r][i][0] = (dp[r][i][0] - dp[r - 1][i][0]) % MOD;
                dp[r][i][0] = (dp[r][i][0] + MOD) % MOD;
            }
        }

        jout.println(dp[k][a][0]);
    }
}

class InputReader {
    private static final int bufferMaxLength = 1024;
    private InputStream in;
    private byte[] buffer;
    private int currentBufferSize;
    private int currentBufferTop;
    private static final String tokenizers = " \t\r\f\n";

    public InputReader(InputStream stream) {
        this.in = stream;
        buffer = new byte[bufferMaxLength];
        currentBufferSize = 0;
        currentBufferTop = 0;
    }

    private boolean refill() {
        try {
            this.currentBufferSize = this.in.read(this.buffer);
            this.currentBufferTop = 0;
        } catch(Exception e) {}
        return this.currentBufferSize > 0;
    }

    private Byte readChar() {
        if(currentBufferTop < currentBufferSize) {
            return this.buffer[this.currentBufferTop++];
        } else {
            if(!this.refill()) {
                return null;
            } else {
                return readChar();
            }
        }
    }

    public String token()  {
        StringBuffer tok = new StringBuffer();
        Byte first;
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) != -1));
        if(first == null) return null;
        tok.append((char)first.byteValue());
        while((first = readChar()) != null && (tokenizers.indexOf((char) first.byteValue()) == -1)) {
            tok.append((char)first.byteValue());
        }
        return tok.toString();
    }

    public Integer int32() throws NumberFormatException {
        String tok = token();
        return tok == null? null : Integer.parseInt(tok);
    }

    }

class OutputWriter {
    private final int bufferMaxOut = 1024;
    private PrintWriter out;
    private StringBuilder output;
    private boolean forceFlush = false;

    public OutputWriter(OutputStream outStream) {
        out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outStream)));
        output = new StringBuilder(2 * bufferMaxOut);
    }

    public OutputWriter(Writer writer) {
        forceFlush = true;
        out = new PrintWriter(writer);
        output = new StringBuilder(2 * bufferMaxOut);
    }

    private void autoFlush() {
        if(forceFlush || output.length() >= bufferMaxOut) {
            flush();
        }
    }

    public void print(Object... tokens) {
        for(int i = 0; i < tokens.length; i++) {
            if(i != 0) output.append(' ');
            output.append(tokens[i]);
        }
        autoFlush();
    }

    public void println(Object... tokens) {
        print(tokens);
        output.append('\n');
        autoFlush();
    }

    public void flush() {
        out.print(output);
        output.setLength(0);
    }

    public void close() {
        flush();
        out.close();
    }
}


import java.io*
import static java.util.Arrays.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import static java.lang.Long.*;
import static java.lang.Short.*;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import static java.util.Collections.*;

public class C {
    static int[][] dp;
    static final int mod = 1000_000_000 + 7;

    public static void main(String[] a) {
        try (Scanner sc = new Scanner(new BufferedInputStream(System.in));
                PrintWriter out = new PrintWriter(new BufferedWriter(
                        new OutputStreamWriter(System.out)))) {

            int n = sc.nextInt();
            int k = sc.nextInt();
            int d = sc.nextInt();
            dp = new int[n + 1][2];
            for (int[] x : dp) {
                fill(x, 0);
            }
            dp[0][0] = 1;
            dp[0][1] = 0;
            for (int i = 0; i <= n; i++) {
                for (int nextEdge = 1; nextEdge <= k; nextEdge++) {
                    int nextWeight = i + nextEdge;
                    if (nextWeight > n)
                        continue;
                    if (nextEdge >= d) {
                        dp[nextWeight][1] = add(dp[i][0] + dp[i][1],
                                dp[nextWeight][1]);
                    } else if (nextEdge < d) {
                        dp[nextWeight][0] = add(dp[i][0], dp[nextWeight][0]);
                        dp[nextWeight][1] = add(dp[i][1], dp[nextWeight][1]);
                    }
                }
            }
            out.println(dp[n][1]);
            out.flush();
            out.close();
        }
    }

    private static int add(int i, int j) {
        return ((i % mod) + (j % mod)) % mod;
    }

}


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

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

      String s[] = br.readLine().trim().split(" ");

      int n = Integer.parseInt(s[0]);
      int k = Integer.parseInt(s[1]);

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

      int l = 0, h = n-1;
      int ans = -1;
      while(l <= h)
      {
          int mid = (l+h) >>> 1;
        //   System.out.println(mid);
          if(arr[mid] == k + (n - mid - 1)) {ans = n - mid - 1;break;}
          if(arr[mid] > k + (n - mid - 1)) h = mid - 1;
          else l = mid + 1;
      }

      System.out.println(ans);

    }
}


import java.io.*;
public class _290_C {
	boolean testOutput=true;
	public void runTestCases() throws Exception{
//		Case 0
		input=
		"3 "+
		"0 "+
		"1 "+
		"1 ";
		runTest(input,
		"0.666667 ");

	}

	public void compare(String rcAnswer, String realAnswer){
		realAnswer=realAnswer.trim();
		rcAnswer=rcAnswer.trim();
		if(realAnswer.equals(rcAnswer)){
			System.out.println("[Passed] Case "+nroCases);
		}else{
			failed=true;
			System.out.println("rChi "+rcAnswer);
			System.out.println("Expected "+realAnswer);
			System.out.println("[Failed] Case "+nroCases);
//			System.exit(0);
		}
		nroCases++;
	}

	public void runTest(String input, String output) throws Exception{
		r.in= new ByteArrayInputStream(input.getBytes());
		r.run();
		if(testOutput){
			compare(baos.toString(), output);
		}else{
			System.out.println(baos.toString());
		}
		baos.reset();
//		r.in.
	}
	_290_C_WTF r;
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	private void init() throws Exception{
		r = new _290_C_WTF();
		r.out = new PrintWriter(baos);
		runTestCases();
		if(testOutput && !failed){
			System.out.println("All test cases [Passed]");
		}
	}
	private String input;
	private int nroCases=1;
	private boolean failed=false;
	public static void main(String[] args) throws Exception {
		new _290_C().init();
	}

}


package com.arthur.gazizov.main;

import com.arthur.gazizov.io.InputReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;

public class TaskB {
//    i := (s div 50) mod 475
//    repeat 25 times:
//    i := (i * 96 + 42) mod 475
//    print (26 + i)
    List<Integer> generate(int s){
        List<Integer> ret = new ArrayList<>(25);
        int i = (s / 50) % 475;
        for (int j = 0; j < 25; j++) {
            i = (i * 96 + 42) % 475;
            ret.add(i + 26);
        }
        return ret;
    }
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        int p = in.readInt();
        int points = in.readInt();
        int toWin = in.readInt();
        int min = Integer.MAX_VALUE;
        for (int i = toWin; i <= 200000; i++) {
            List<Integer> generate = generate(i);
            if (generate.contains(p)){
                int diff = Math.abs(i - points);
                int tmp = Integer.MAX_VALUE;
                if (diff % 50 == 0){
                    if (i > points){
                        tmp = (i - points + 50) / 100;
                    } else {
                        tmp = 0;
                    }
                }
                min = Math.min(min, tmp);
            }
        }
        out.print(min);
    }
}


imp
import java.util.*;

public class Main_731A {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.next();
        char[] c = new char[s.length()];
        for (int i = 0; i < s.length(); i++) {
            c[i] = (char) s.charAt(i);
        }
        char a = 'a';
        int sum=0;
        for (int i =0 ; i< c.length ; i++){
            int b= Math.abs(a - c[i]);
            if (b<=12){
                sum+=b;
            }
            else{
                sum+=26;
                sum-=b;
                a=c[i];
            }
        }
        System.out.println(sum);ort java.util.*;

public class Main_731A {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        String s = input.next();
        char[] c = new char[s.length()];
        for (int i = 0; i < s.length(); i++) {
            c[i] = (char) s.charAt(i);
        }
        char a = 'a';
        int sum=0;
        for (int i =0 ; i< c.length ; i++){
            int b= Math.abs(a - c[i]);
            if (b<=12){
                sum+=b;
            }
            else{
                sum+=26;
                sum-=b;
                a=c[i];
            }
        }
        System.out.println(sum);


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

public class Factory {

	public static boolean factory(long a,long m){
		if (a>m){
			a=a%m;
		}
		while(a<=m){
			if(a==m){
				return false;
			}
			a+=a%m;
		}
		return true;
	}

    public static void main (String[] args) throws IOException {
    	BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
    	StringTokenizer s=new StringTokenizer(in.readLine());
    	long a=Long.parseLong(s.nextToken());
    	long m=Long.parseLong(s.nextToken());
    	System.out.println((factory(a,m))? "No":"Yes");
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.StringTokenizer;
import java.util.TreeMap;

public class zizo {
	public static void main(String[]args) throws IOException {
		Scanner zizo=new Scanner(System.in);
		PrintWriter wr=new PrintWriter(System.out);

		int n=zizo.nextInt();
		String s=zizo.nextLine();
		TreeMap<String,Integer>map=new TreeMap<>();
		int max=0;
		String r="";
		for(int i=0;i<n-1;i++) {
			String x;
			if(i<=n-2)
				x=s.substring(i);
			x=s.substring(i,i+2);
			//System.out.println(x+" "+i);
			if(!map.containsKey(s)) {

				map.put(x,1);
				if(map.get(x)>max) {
					max=map.get(x);r=x;
				}
			}
			else {
				map.put(x,map.get(x)+1);
				if(map.get(x)>max) {
					max=map.get(x);r=x;
				}
			}
		}
		wr.println(r);

		wr.close();
	}
}
class Edge implements Comparable<Edge>{
	int i,l,r;
	Edge(int a,int b,int c){i=a;l=b;r=c;}
	@Override
	public int compareTo(Edge o) {
		// TODO Auto-generated method stub
		if(l!=o.l)return l-o.l;
		else return r-o.r;
	}
}
class Scanner
{
	StringTokenizer st;
	BufferedReader br;

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

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

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

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

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

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

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

}


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

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		try
		{
			String s[]=br.readLine().split(" ");
			long a=Long.parseLong(s[0]);
			long b=Long.parseLong(s[1]);
			long c=Long.parseLong(s[2]);
			StringBuilder sb1=new StringBuilder();
			StringBuilder sb2=new StringBuilder();
			StringBuilder sb3=new StringBuilder();
			long ca=0,cb=0,res=0;
			for(long i=1;i<=a;i++)
			{
				sb1.append('a');
			}
			for(long i=1;i<=b;i++)
			{
				sb2.append('b');
			}
			for(long i=1;i<=c;i++)
			{
				sb3.append('a');
				sb3.append('b');
			}
			ca=sb1.length()+sb3.length()/2;
			cb=sb2.length()+sb3.length()/2;
			if(ca==0||cb==0)
			{
				res=0;
			}
			else
			{
				if((long)Math.abs(ca-cb)<=1)
				{
					res=ca+cb;
				}
				else{
					if(ca>cb)
					{
						res=cb+(cb+1);
					}
					else if(cb>ca)
					{
						res=ca+(ca+1);
					}
				}
			}
			System.out.println(res);
		}
		catch(Exception e)
		{

		}
	}
}


//package school1;

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Scanner;

public class E {
	Scanner in;
	PrintWriter out;
//	String INPUT = "2 2 10";
//	String INPUT = "5 5 16808";
//	String INPUT = "3 1 4";
//	String INPUT = "1 4 10";
//	String INPUT = "2 1 1000000000";
//	String INPUT = "2 29 1000000000";
//	String INPUT = "1 1 3";
//	String INPUT = "1 1 5";
//	String INPUT = "1 2 6";
//	String INPUT = "10000 1 10001";
//	String INPUT = "1 29 1000000000";
	String INPUT = "";

	void solve()
	{
		int a = ni();
		int b = ni();
		int n = ni();
		if(a == 1){
			if(n <= 1<<b){
				out.println("Missing");
			}else{
				int[][] h = judge(a+1, b, n);
				int u;
				for(u = b;1<<u < n;u++);

				h[u][1] = 0;
				for(int i = u - 1;i >= b;i--){
					int x = 0;
					x |= 1 << h[i+1][1];
					x |= 1 << h[i][2];
					for(int k = 0;k <= 2;k++){
						if((x & (1<<k)) == 0){
							h[i][1] = k;
							break;
						}
					}
				}
				int h0 = h[b][1];

				h[u][1] = 1;
				for(int i = u - 1;i >= b;i--){
					int x = 0;
					x |= 1 << h[i+1][1];
					x |= 1 << h[i][2];
					for(int k = 0;k <= 2;k++){
						if((x & (1<<k)) == 0){
							h[i][1] = k;
							break;
						}
					}
				}
				int h1 = h[b][1];

				if(h0 != 0 && h1 != 0){
					out.println("Masha");
					return;
				}
				if(h0 == 0 && h1 == 0){
					out.println("Stas");
					return;
				}

				out.println("Missing");
			}
		}else{
			int[][] h = judge(a, b, n);
			out.println(h[b][a] == 0 ? "Stas" : "Masha");
		}
	}

	double EPS = 1E-6;

	int[][] judge(int a, int b, int n)
	{
		// a^b<n
		int m = (int)Math.sqrt(1E9) + 1;
		int[][] h = new int[32][m+1];
		// n : 1
		// n-1 : 0
		// n-2 : 2
		for(int i = 31;i >= b;i--){
			for(int j = m;j >= a;j--){
				if(Math.log(n) <= Math.log(j) * i + EPS){
					h[i][j] = 1;
				}else{
					if(i == 1 && j == m){
						h[i][j] = n % 2 == m % 2 ? 2 : 0;
						continue;
					}
					int x = 0;
					if(i < 31)x |= 1 << h[i+1][j];
					if(j < m - 1)x |= 1 << h[i][j+1];
					for(int k = 0;k <= 2;k++){
						if((x & (1<<k)) == 0){
							h[i][j] = k;
//							tr(i, j, k);
							break;
						}
					}
				}
			}
		}
		return h;
	}

	void run() throws Exception
	{
		in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT);
		out = new PrintWriter(System.out);

		solve();
		out.flush();
	}

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

	int ni() { return Integer.parseInt(in.next()); }
	void tr(Object... o) { if(INPUT.length() != 0)System.out.println(o.length > 1 || o[0].getClass().isArray() ? Arrays.deepToString(o) : o[0]); }
}


/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.text.ParseException;
import java.util.*;

/**
 * @author Artem_Mikhalevitch
 */
public class Main extends ASolver {

    long[] a;

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

        Main s = new Main();
        s.init();

        if (s.readData()) {
            //s.solve();
            s.writeData("" + s.solve());

        }
    }

    @Override
    public void init() {
        super.init();
    }

    @Override
    public boolean readData() {
        try {

            a = new long[4];
            for (int i = 0; i < 4; i++) {
                a[i] = nextLong();
            }
        } catch (Exception ex) {
            System.out.println(ex.getCause());
            System.out.println(ex.getMessage());
            return false;
        }
        return true;
    }

    public double[] sort(double[] mas1, double[] mas2) {
        int l1 = mas1.length;
        int l2 = mas2.length;
        double[] result = new double[l1 + l2];
        int i1 = 0, i2 = 0;
        int i = 0;
        for (i = 0; i1 < l1 && i2 < l2; i++) {
            if (mas1[i1] <= mas2[i2]) {
                result[i] = mas1[i1++];
            } else {
                result[i] = mas2[i2++];
            }
        }
        for (int j = i; i1 < l1; j++) {
            result[j] = mas1[i1++];
        }
        for (int j = i; i2 < l2; j++) {
            result[j] = mas2[i2++];
        }
        return result;
    }

    public long solve() {
        if (isGP()) {
            long result = (long) (a[3] * ((0.0 + a[3]) / a[2]));
            if (result == 0) {
                return 42l;
            }
            return result;
        }
        if (isAP()) {
            return (long) (2 * a[3] - a[2]);
        }

        return 42l;
    }

    public boolean isGP() {
        if (a[0] == 0) {
            return false;
        }
        double d = (0.0 + a[1]) / a[0];
        for (int i = 2; i < 4; i++) {
            if (a[i - 1] == 0 || ((0.0 + a[i]) / a[i - 1] != d)) {
                return false;
            }
        }
        return true;
    }

    public boolean isAP() {
        long d = a[1] - a[0];
        for (int i = 2; i < 4; i++) {
            if (a[i] - a[i - 1] != d) {
                return false;
            }
        }
        return true;
    }
    /*
     * public void buildTree(int v, int tl, int tr) { if (tl == tr) { t[v] =
     * a[tl]; } else { int tm = (tl + tr) / 2; buildTree(v * 2, tl, tm);
     * buildTree(v * 2 + 1, tm + 1, tr); t[v] = t[v * 2] + t[v * 2 + 1]; } }
     *
     * public long sum(int v, int tl, int tr, int l, int r) { if (l > r) {
     * return 0; } if (l == tl && r == tr) { return t[v]; } int tm = (tl + tr) /
     * 2; return (sum(v * 2, tl, tm, l, Math.min(r, tm))%95542721 + sum(v * 2 +
     * 1, tm + 1, tr, max(l, tm + 1), r)%95542721)%95542721; }
     *
     * public long sum(List<Integer> listForSum) { long result = 0; int size =
     * listForSum.size(); for (int i = 0; i < size; i++) { result +=
     * listForSum.get(i); } return result; }
     *
     * void update(int v, int tl, int tr, int pos) { if (tl == tr) { t[v] =
     * (t[v]*t[v]*t[v]); } else { int tm = (tl + tr) / 2; if (pos <= tm) {
     * update(v * 2, tl, tm, pos); } else { update(v * 2 + 1, tm + 1, tr, pos);
     * } t[v] = (t[v * 2] + t[v * 2 + 1]); }
        }
     */
}

abstract class ASolver {

    protected StringTokenizer tokens;
    protected BufferedReader input;
    protected PrintWriter output;

    public void init() {
        input = new BufferedReader(new InputStreamReader(System.in));
    }

    public abstract boolean readData();

    public void writeData(String result) {
        System.out.println(result);
    }

    public void writeData(int result) {
        System.out.println(result);
    }

    public void writeData(long result) {
        System.out.println(result);
    }

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

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

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

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

    public String nextLine() throws IOException {
        while (tokens == null || !tokens.hasMoreTokens()) {
            tokens = new StringTokenizer(input.readLine(), "\n");
        }
        return tokens.nextToken();
    }

    public long infinityImitator(long a, long b) {
        if (a == Long.MIN_VALUE) {
            return Long.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    public int infinityImitator(int a, int b) {
        if (a == Integer.MIN_VALUE) {
            return Integer.MIN_VALUE;
        } else {
            return a + b;
        }
    }

    /*
     * public long max(long... a) { long result = Long.MIN_VALUE; for (int i =
     * 0; i < a.length; i++) { result = Math.max(result, a[i]); } return result;
     * }
     */
    public int indexMax(int... a) {
        int result = 0;
        int index = -1;
        int length = a.length;
        for (int i = 0; i < length; i++) {
            if (a[i] > result) {
                result = a[i];
                index = i;
            }
        }
        return index;
    }

    public int indexMax(long... a) {
        long result = 0;
        int index = -1;
        int length = a.length;
        for (int i = 0; i < length; i++) {
            if (a[i] > result) {
                result = a[i];
                index = i;
            }
        }
        return index;
    }

    public int max(int... a) {
        int result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++) {
            result = Math.max(result, a[i]);
        }
        return result;
    }

    public long max(long... a) {
        long result = Integer.MIN_VALUE;
        for (int i = 0; i < a.length; i++) {
            result = Math.max(result, a[i]);
        }
        return result;
    }
}

class ABSComparator implements Comparator<Pair> {

    /**
     * Compares its two arguments for order. Returns a negative integer, zero,
     * or a positive integer as the first argument is less than, equal to, or
     * greater than the second.
     */
    @Override
    public int compare(Pair o1, Pair o2) {
        if (o1.getA() == o2.getA()) {
            return o2.getB() - o1.getB();
        }
        return o1.getA() - o2.getA();
    }
}

class Pair {

    int a;
    int b;
    int pos;

    public Pair() {
    }

    public Pair(int a, int b, int pos) {
        this.a = a;
        this.b = b;
        this.pos = pos;
    }

    public int getA() {
        return a;
    }

    public int getB() {
        return b;
    }

    public void setA(int a) {
        this.a = a;
    }

    public void setB(int b) {
        this.b = b;
    }

    public void setPos(int pos) {
        this.pos = pos;
    }

    public int getPos() {
        return pos;
    }
}

class ABSComparatorDesc implements Comparator<Pair> {

    /**
     * Compares its two arguments for order. Returns a negative integer, zero,
     * or a positive integer as the first argument is less than, equal to, or
     * greater than the second.
     */
    @Override
    public int compare(Pair o1, Pair o2) {
        if (o2.getB() == o1.getB()) {
            return o1.getA() - o2.getA();
        }
        return o2.getB() - o1.getB();
    }
}


//package july_material;
//package codeforces_1st;

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

public class kth_divisor {

	public static void main(String[] args) throws IOException{
		// TODO Auto-generated method stub
		Reader.init(System.in);
		long n = Reader.nextlong();
		int k = Reader.nextInt();
		long[] left = new long[100000000];
		long[] right = new long[100000000];
		int left_ind = -1;
		int right_ind=100000000;
		int i=1;
		//System.out.println(Math.sqrt(n));
		while(i<=(Math.sqrt(n))) {
			if (n%i==0) {
				left_ind+=1;
				right_ind-=1;
				left[left_ind]=i;
				right[right_ind]=n/i;
			}
			i++;
		}
		if (k-1<=left_ind) {
			System.out.println(left[k-1]);
		}
		else {
			int temp=k-(left_ind+1);
			temp = right_ind+temp-1;
			//System.out.println(left_ind);
			if (temp<=100000000-1 && right[temp]!=0 && right[temp]!=1) {
			System.out.println(right[temp]);}
			else {
				System.out.println(-1);
			}
		}
	}

}

class Reader {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

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

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

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

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

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


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

/**
 * Code-forces Submission Template.
 * Actual solution is in the taskC part.
 * Remove the package declaration when submission which is located in the first line.
 */
public class Q1225C {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(in, out);
        out.close();
    }

    public static class TaskC {
        void solve(InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int p = in.nextInt();

            Set<Integer> used = new HashSet<>();
            Queue<Integer> queue = new LinkedList<>();
            queue.offer(n);
            used.add(n);
            int level = 1;
            int size = 1;
            while(!queue.isEmpty()){
                int curr = queue.poll() - p;
                size--;
                if(Integer.bitCount(curr) == 1){
                    out.println(level);
                    return;
                }
                int mask = curr <= 0 ? 1 : Integer.highestOneBit(curr);
                if(!used.contains(curr-mask*2)){
                    used.add(curr-mask*2);
                    queue.offer(curr-mask*2);
                }
                if(!used.contains(curr-mask)){
                    used.add(curr-mask);
                    queue.offer(curr-mask);
                }
                if(size == 0){
                    level++;
                    size = queue.size();
                }
            }

            out.println(-1);
        }
    }

    public static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

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

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

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


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

import static java.lang.Math.*;

public class Solution 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 int[] readint(int st,int n){
		    int[] arr=new int[n+st];
		    for(int i=st;i<n+st;i++) arr[i]=nextInt();
		    return arr;
		}

		public long[] readlong(int st,int n){
		    long[] arr=new long[n+st];
		    for(int i=st;i<n+st;i++) arr[i]=nextLong();
		    return arr;
		}
	}
	public static void main(String args[]) throws Exception
	{
		new Thread(null, new Solution(),"Main",1<<27).start();
	}

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

	public static long findGCD(long arr[], int n)
	{
		long result = arr[0];
		for (int i = 1; i < n; i++)
			result = gcd(arr[i], result);
		return result;
	}

	static void sortbycolomn(long arr[][], int col)
    {

        Arrays.sort(arr, new Comparator<long[]>() {

          @Override

          public int compare(final long[] entry1,
                             final long[] entry2) {

            if (entry1[col] > entry2[col])
                return 1;
            else
                return -1;
          }
        });
    }

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

		String s1=in.next(),s2=in.next(),s3=in.next();
		int[][] arr=new int[10][3];
		if(s1.charAt(1)=='m') arr[s1.charAt(0)-48][0]++;
		else if(s1.charAt(1)=='p') arr[s1.charAt(0)-48][1]++;
		else arr[s1.charAt(0)-48][2]++;

		if(s2.charAt(1)=='m') arr[s2.charAt(0)-48][0]++;
		else if(s2.charAt(1)=='p') arr[s2.charAt(0)-48][1]++;
		else arr[s2.charAt(0)-48][2]++;

		if(s3.charAt(1)=='m') arr[s3.charAt(0)-48][0]++;
		else if(s3.charAt(1)=='p') arr[s3.charAt(0)-48][1]++;
		else arr[s3.charAt(0)-48][2]++;

		int min = Integer.MAX_VALUE;

		for(int i=1;i<10;i++){
		    for(int j=0;j<3;j++)
		        min = Math.min(min,3-arr[i][j]);
		}
		if(min==1 || min==0)
		    w.println(min);
		else{
		    int flag=2;
		    for(int i=0;i<3;i++){
		        for(int j=1;j<8;j++){
		            if(arr[j][i]!=0 && arr[j+1][i]!=0 && arr[j+2][i]!=0){
		                flag=0;
		                break;
		            }
		            else if(arr[j][i]!=0 && arr[j+1][i]!=0){
		                flag=1;
		                break;
		            }else if(arr[j][i]!=0 && arr[j+2][i]!=0){
		                flag=1;
		                break;
		            }
		        }
		    }
		    w.println(flag);
		}

		w.flush();
		w.close();
	}
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.*;
/**
 *
 * @author Aaryan
 * AV
 */

public class HR {
    public static void main(String[] args) throws Exception {
       BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));

        String str1 [] = br.readLine().split(" ");
         int n = Integer.parseInt(str1[0]);
         int k [] = new int[1001];
         String str [] = br.readLine().split(" ");
            int a [] = new int[n];
            for(int i=0; i<a.length; i++){
                a[i]=Integer.parseInt(str[i]);
            }
            ArrayList<Integer> l = new ArrayList<>();
            int sum=0;
            for(int i=a.length-1; i>=0; i--){
                if(k[a[i]]<1){
                    k[a[i]]++;
                    l.add(a[i]);
                    sum++;
            }
            }
            //System.out.println(Arrays.toString(k));
            out.println(sum);
            out.flush();
            for(int i=l.size()-1; i>=0; i--){

                    out.print(l.get(i)+" ");
            out.flush();

                }
            }

    }

}


import sun.util.resources.LocaleNames_ga;

import java.util.*;

/**
 * Created by IntelliJ IDEA.
 * User: piyushd
 * Date: 3/26/11
 * Time: 10:53 PM
 * To change this template use File | Settings | File Templates.
 */
public class TaskA {

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

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

    void run(){
        long a = nextLong(), b = nextLong();

        long LCM = lcm(a, b);

        if(a > b){
            long times = LCM / a;
            long cnta = (times * (times + 1)) / 2;
            long cntb = LCM - cnta;
            if(cnta > cntb){
                System.out.println("Dasha");
            }else if(cntb > cnta){
                System.out.println("Masha");
            }else{
                System.out.println("Equal");
            }
        }else{
            long times = LCM / b;
            long cntb = (times * (times + 1)) / 2;
            long cnta = LCM - cntb;
            if(cnta > cntb){
                System.out.println("Dasha");
            }else if(cntb > cnta){
                System.out.println("Masha");
            }else{
                System.out.println("Equal");
            }
        }
    }

    int nextInt(){
        try{
            int c = System.in.read();
            if(c == -1) return c;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return c;
            }
            if(c == '-') return -nextInt();
            int res = 0;
            do{
                res *= 10;
                res += c - '0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }

    long nextLong(){
        try{
            int c = System.in.read();
            if(c == -1) return -1;
            while(c != '-' && (c < '0' || '9' < c)){
                c = System.in.read();
                if(c == -1) return -1;
            }
            if(c == '-') return -nextLong();
            long res = 0;
            do{
                res *= 10;
                res += c-'0';
                c = System.in.read();
            }while('0' <= c && c <= '9');
            return res;
        }catch(Exception e){
            return -1;
        }
    }

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

    String next(){
        try{
            StringBuilder res = new StringBuilder("");
            int c = System.in.read();
            while(Character.isWhitespace(c))
                c = System.in.read();
            do{
                res.append((char)c);
            }while(!Character.isWhitespace(c=System.in.read()));
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }

    String nextLine(){
        try{
            StringBuilder res = new StringBuilder("");
            int c = System.in.read();
            while(c == '\r' || c == '\n')
                c = System.in.read();
            do{
                res.append((char)c);
                c = System.in.read();
            }while(c != '\r' && c != '\n');
            return res.toString();
        }catch(Exception e){
            return null;
        }
    }

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


/* package whatever; // don't place package name! */

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

/* Name of the class has to be "Main" only if the class is public. */
public class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int a = in.nextInt();
		int b = in.nextInt();
		a+=b;
		while(a<=0){
			a+=n;
		}

		while(a>n){
			a-=n-1;
		}
		System.out.println(a);
	}
}


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

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

class TaskB {
    int C1, C2, X, Y;
    public void solve(int testNumber, InputReader in, PrintWriter out) {
        C1 = in.nextInt();
        C2 = in.nextInt();
        X = in.nextInt();
        Y = in.nextInt();

        long ans = binS();
        out.println(ans);
    }

    // do binary search
    public long binS() {
        long low = 1, hi = C1 * X / (X - 1) + C2 * Y / (Y - 1);
        long ans = Integer.MAX_VALUE;
        while(low <= hi) {
            long mid = (low + hi) / 2;
            if (f(mid)) {
                if(mid < ans)
                    ans = mid;
                hi = mid - 1;
            }
            else
                low = mid + 1;
        }
        return ans;
    }

    public boolean f(long x) {
        long s1 = x / Y - x/(X * Y);
        long s2 = x / X - x/(X * Y);
        long rest = Math.max(0, C1 - s1) + Math.max(0, C2 - s2);
        if(x - x/X - x/Y + x/(X * Y) >= rest)
            return true;
        return false;
    }

}

class InputReader {
    public BufferedReader reader;
    public 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.util.*;
import java.math.*;

public class TwoProblems {
	static PrintStream ll = System.out;

	public static void main(String args[]) {
		Scanner c = new Scanner(System.in);
		int x=c.nextInt();
		int t=c.nextInt();
		int a=c.nextInt();
		int b=c.nextInt();
		int da=c.nextInt();
		int db=c.nextInt();

		boolean res[] = new boolean[601];
		for(int i=0;i<t;i++) {
			res[a+b]=true;
			res[a]=true;
			res[b]=true;
			a=a-da;
			b=b-da;
		}
		if(res[x]==true) {
			System.out.println("YES");
		}
		else{
			System.out.println("NO");
		}
	}
}

//must declare new classes here


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

public class A625 {

	public static void main(String[] args){

		Scanner in = new Scanner(System.in);
		long n = in.nextLong();
		long a = in.nextLong();
		long b = in.nextLong();
		long c = in.nextLong();
		long max=0,ans=0,k=n;
		if(n>=a || n>=b)
		{
			if(a<=b-c || b>n)
				System.out.println(n/a);
			else
			{
				for(int i=1;;i++)
				{
					if(n-(b-c)*i<b)
					    break;
					k=n-(b-c)*i;
				}
				System.out.println((n-k)/(b-c)+1);
			}
		}
		else
			System.out.println(0);

	}

}


import java.io.*;
import java.util.*;
public class sol {
    InputReader in;
    PrintWriter out;
    helper_class h;
    final long mod=1000000007;
    final long p=998244353;
    long fact[];
    public static void main(String[] args) throws java.lang.Exception{
        new sol().run();
    }
    void run() throws Exception{
        in=new InputReader(System.in);
        out = new PrintWriter(System.out);
        h = new helper_class();
        precompute();
        int t=1;
        while(t-->0){
            solve();
        }
        out.flush();
        out.close();
    }
    void solve() {
        int n=h.i(),k=h.i();
        precompute();
        long ans=0;
        for(int i=1;i<=n;i++)
            ans = add(ans, nCr(n/i-1 k-1));
        h.p(ans);
    }
    void precompute() {
        fact=new long[500001];
        fact[0]=1;
        for(int i=1;i<=500000;i++)
            fact[i]=(fact[i-1]*i)%p;
    }
    long nCr(int n,int r) {
        if(r > n) return 0;
        return mul(fact[n], mul(inv(fact[r]),inv(fact[n-r])));
    }
    long inv(long x) {
        return power(x,p-2,p);
    }
    long add(long x,long y) {
        return (x%p + y%p)%p;
    }
    long mul(long x,long y) {
        return (x%p +* y%p)%p;
    }
    long power(long a, long b,long p){
        if(b == 0)
            return 1L;
        long val = power(a, b/2, p);
        if(b % 2 == 0)
            return val * val%p;
        else
            return val * val%p * a%p;
    }
    class helper_class{
        long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
        void p(Object o){out.println(o);}
        String s(){return in.next();}
        String nl(){return in.nextLine();}
        int i(){return in.nextInt();}
        long l(){return in.nextLong();}
    }
    class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        public InputReader(InputStream stream) {
            this.stream = stream;
        }
        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }
        public void skip(int x) {
            while (x-->0)
                read();
        }
        public int nextInt() {
            return Integer.parseInt(next());
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public String nextString() {
            return next();
        }
        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }
        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }
        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 boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }
        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

    IIO io;
    Main(IIO io){
        this.io = io;
    }

    public static void main(String[] args) throws IOException {
//
//        Main m = new Main(new ConsoleIO());
//        m.solve();

        Tester test = new Tester();
        test.run();
    }

    public void solve() {
        String first = io.readLine();
        int added = io.readInt();
        int maxL = first.length() + added;
        int half = maxL / 2;

        if (added >= first.length()) {
            io.writeLine(Integer.toString(maxL / 2));
            return;
        }

        int a = half;
        for (; a > added; a--) {
            for (int i = 0; i + a + a <= maxL; i++) {
                boolean good = true;
                for (int j = i; j < i + a; j++) {
                    char q = first.charAt(j);
                    char w = j + a < first.length() ? first.charAt(j + a) : q;
                    if (q != w) good = false;
                }
                if(good){
                    io.writeLine(Integer.toString(a + a));
                    return;
                }
            }
        }

        io.writeLine(Integer.toString(a + a));
    }
}

class ConsoleIO extends BaseIO {
    BufferedReader br;

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

    public void writeLine(String s) {
        System.out.println(s);
    }

    public String readLine() {
        try {
            return br.readLine();
        }
        catch (Exception ex){
            return "";
        }
    }
}
abstract class BaseIO implements IIO {
    @Override
    public int readInt() {
        return Integer.parseInt(this.readLine());
    }

    @Override
    public int[] readIntArray() {
        String line = this.readLine();
        String[] nums = line.split(" ");
        int[] res = new int[nums.length];
        for (int i = 0; i < nums.length; i++) {
            res[i] = Integer.parseInt(nums[i]);
        }
        return res;
    }
}
interface IIO {
    void writeLine(String s);
    String readLine();
    int readInt();
    int[] readIntArray();
}


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

public class Main {

    public void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();

        List<Integer> pf = new ArrayList<>();
        int x = 2;
        while (x*x <= n) {
            if (n%x == 0) {
                pf.add(x);
                while (n%x == 0) {
                    n /= x;
                }
            }
            x++;
        }
        if (n > 1) pf.add(n);
        if (pf.size() == 1) out.println(pf.get(0));
        else out.println(1);
    }

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

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

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

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

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

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

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

        public float nextFloat() {
            return Float.parseFloat(next());
        }

    }
}


mport java.util.Scanner;

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


//package Round287_Div2;

import java.util.Scanner;
import java.util.Stack;

public class Solution3 {
  public static void main(String[] args) {
    Scanner scan = new Scanner(System.in);
    int h = scan.nextInt();
    int n = scan.nextInt();
    boolean[] visited = new boolean[(1 << (h + 1)) - 1];
    n = (1 << h) + n - 2;
    boolean isLeft = true;
    int curr = 0, next = 0;
    Stack<Integer> stack = new Stack<>();
    int step = 0;
    boolean firstSkip = false;
    while (curr != n) {
      next = isLeft ? curr*2 + 1 : curr*2 + 2;
      if (next < visited.length) {
          if (!visited[next]) {
            visited[next] = true;
            stack.push(curr);
            step++;
            curr = next;
            isLeft = !isLeft;
          } else {
            isLeft = !isLeft;
            if (!firstSkip) {
              firstSkip = true;
            } else {
              firstSkip = false;
              curr = stack.pop();
            }
          }
        } else { // null children
          curr = stack.pop();
        }
    }
    System.out.println(step);
    scan.close();
  }
}


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

public class codeforces {
    public static void main(String[] args)throws IOException {
		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(bf.readLine());
		long h = Long.parseLong(st.nextToken());
		long n = Long.parseLong(st.nextToken());
		long exit = ((long)Math.pow(2, (double)h)) + n - 1 ;
		//System.out.println(exit);
		boolean maze[] = new boolean[((int)Math.pow(2, (double)h+1))];
		Arrays.fill(maze,true);
		int counter = 0;
		int pos = 1;
		String state = "L";
		while(true){

		    if( !maze[pos*2 ] && !maze[pos*2 +1]){
		    	pos/=2;
			//	System.out.println("1");
		    }
			else if( (state.equals("L") && maze[pos*2])){
				pos = pos *2;
				maze[pos] = false;
				counter ++;
			//	System.out.println("2");
				if(pos == exit)
					break;
			}
			else if (state.equals("R") && maze[pos*2+1]){
				pos = pos * 2 +1 ;
				maze[pos] = false;
				counter ++;
			//	System.out.println("3");
				if(pos == exit)
					break;
			}
		    if(pos > ((int)Math.pow(2, (double)h))-1 ){
		    	pos /= 2;
		    	//System.out.println("4");
		    }
		    if(state.equals("L"))
		    	state = "R";
		    else
		    	state = "L";
		}

		System.out.println(counter);

    }
}


import java.util.Scanner;

public class BinarySearchprob1 {
    public static void main(String[] args) {
        Scanner s=new Scanner(System.in);
        int n=s.nextInt();
        int k=s.nextInt();
        int[] searchspace=new int[n+1];
        int maxcandy=0;
        for (int i = 1; i <= n; i++) {
            maxcandy+=i;
            searchspace[i]=maxcandy;

        }
//        for (int i = 0; i <= n; i++) {
//            System.out.print(searchspace[i]+" ");
//        }

        int start=1;
        int end=n;
        while (start<=end)
        {
            int mid=(start+end)/2;
            if((n-mid)==(searchspace[mid]-k))
            {
                System.out.println(n-mid);
                break;
            }
            if((n-mid)>(searchspace[mid]-k))
            {
                start=mid+1;
            }
            else {
                end=mid-1;
            }
        }
    }

}


import java.util.Scanner;
import java.util.Arrays;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int []i=new int[n];
		int[] Rev=new int[n];

		for(int j=0;j<i.length;j++)
		{
			i[j]=sc.nextInt();
		}
		for(int b=0;b<i.length;b++) {
			int l=0;
			int x=0,y=0,z=0,m=0;
			int abc[]=new int[n];
			abc=i.clone();
		for(int j=b+l*k;j<abc.length;l++)
		{
			if(b+l*k<=n && b+l*k>0)
			{
				y++;
				abc[b+l*k-1]=0;
			}
			else if(b+l*k>0) {}
			else
				break;
		}
		int []arr=new int[abc.length-y];
		for(int j=0;j<abc.length;j++)
		{
			if(abc[j]!=0)
			{
				arr[z]=abc[j];
				z++;
			}
		}
		for(int j=0;j<arr.length;j++)
		{
			if(arr[j]==-1)
			{
				x++;
			}
			else if(arr[j]==1)
				m++;
		}
		Rev[b]=Math.abs(x-m);

	}
		Arrays.sort(Rev);
		System.out.println(Rev[n-1]);

}
}


           import java.util.*;
            import java.lang.*;
            import java.io.*;
            public class night
            {
                public static void main(String args[]) throws IOException
                {
        BufferedReader sc= new BufferedReader(new InputStreamReader(System.in));
        String s=sc.ReadLine();
        String t=sc.ReadLine();
        int i=0;
        for(int j=0;i<s.length()||j<t.length();)
        {
        if(s.charAt(i)==t.charAt(j))
        {
        i++;
        j++;
        }
        else if(j<t.length()-1)
        {
        j++;
        }

        }
        System.out.println(i+1);

        }

            }


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

public class c {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		FastReader s = new FastReader();
		int len = s.nextInt();
		String str = s.next();

		String ans = "";
		int i=0;
		int inc = 1;
		while(i<len)
		{
			ans += str.charAt(i);
			i = i + (inc++);
		}

		System.out.println(ans);

	}

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

}
close