Problem: Throughout Igor K.'s life he has had many situations worthy of attention. We remember the story with the virus, the story of his mathematical career and of course, his famous programming achievements. However, one does not always adopt new hobbies, one can quit something as well.

This time Igor K. got disappointed in one of his hobbies: editing and voicing videos. Moreover, he got disappointed in it so much, that he decided to destroy his secret archive for good. 

Igor K. use Pindows XR operation system which represents files and folders by small icons. At that, m icons can fit in a horizontal row in any window.

Igor K.'s computer contains n folders in the D: disk's root catalog. The folders are numbered from 1 to n in the order from the left to the right and from top to bottom (see the images). At that the folders with secret videos have numbers from a to b inclusive. Igor K. wants to delete them forever, at that making as few frame selections as possible, and then pressing Shift+Delete exactly once. What is the minimum number of times Igor K. will have to select the folder in order to select folders from a to b and only them? Let us note that if some selected folder is selected repeatedly, then it is deselected. Each selection possesses the shape of some rectangle with sides parallel to the screen's borders.

Input

The only line contains four integers n, m, a, b (1 ≤ n, m ≤ 109, 1 ≤ a ≤ b ≤ n). They are the number of folders in Igor K.'s computer, the width of a window and the numbers of the first and the last folders that need to be deleted.

Output

Print a single number: the least possible number of times Igor K. will have to select the folders using frames to select only the folders with numbers from a to b.

Examples

Input

11 4 3 9


Output

3


Input

20 5 2 20


Output

2

Note

The images below illustrate statement tests.

The first test:

<image>

In this test we can select folders 3 and 4 with out first selection, folders 5, 6, 7, 8 with our second selection and folder 9 with our third, last selection.

The second test:

<image>

In this test we can first select all folders in the first row (2, 3, 4, 5), then — all other ones.

Solution (in JAVA):

Solution:


import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.security.acl.LastOwnerException;

/**
 * @author Ivan Pryvalov (ivan.pryvalov@gmail.com)
 *
 */
public class C implements Runnable{
	

	private void solve() throws IOException {
		
		long n = nextInt();
		long m = nextInt();
		long a = nextInt();
		long b = nextInt();
		
//		n = 15;
//		m = 4;
//		for (a=1; a<=n; a++) for (b=a; b<=n; b++){
		
		long line1 = (a-1)/m;
		long line2 = (b-1)/m;
		long lineLast = (n-1)/m;
		
		long index1 = a%m; if (index1==0) index1 += m;
		long index2 = b%m; if (index2==0) index2 += m;
		
		if (lineLast == line2 && b==n){
			index2 = m;
		}
		
		int answer = 0;
		
		if (line1 == line2){
			answer = 1;
		}else if (index1 == 1 && index2 == m){
			answer = 1;	
		}else if (index1 == 1 || index2 == m){
			answer = 2;
		}else if (line2-line1 == 1){
			answer = 2;
		}else if (index1==index2+1){
			answer = 2;
		}else{
			answer = 3;
		}
		
        
        /*
         * 
         * long rest1 = (a-1)%m;
                long rest2 = (m-(b)%m)%m;
        
        }else if (rest1 + rest2 == m){
                answer = 2;
        }else{
                answer = 3;
        }
        */
		
		
		
		out.println(answer);
//		System.out.println(a+","+b+"="+answer);
//		}
		
	}

	/////////////////////////////////////////////////
	final int BUF_SIZE = 1024 * 1024 * 8;//important to read long tokens properly
	final int INPUT_BUFFER_SIZE = 1024 * 1024 * 8 ;
	final int BUF_SIZE_INPUT = INPUT_BUFFER_SIZE;
	
	boolean inputFromFile = false;
	String filenamePrefix = "A-small-attempt0";
	String inSuffix = ".in";
	String outSuffix = ".out";
	
	BufferedInputStream bis;
	BufferedOutputStream bos;
	PrintStream out;
	
	final static byte ZERO = '0';//48 or 0x30
	final static byte NINE = '9';
	final static byte SPACEBAR = ' '; //32 or 0x20
	final static byte MINUS = '-'; //45 or 0x2d	
	
	final static char FLOAT_POINT = '.';
	
	@Override
	public void run() {
		try{
			if (inputFromFile){
				File baseFile = new File(getClass().getResource("/").getFile());
				bis = new BufferedInputStream(
						new FileInputStream(new File(
								baseFile, filenamePrefix+inSuffix)),
								INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(
						new FileOutputStream(
								new File(baseFile, filenamePrefix+outSuffix)));
				out = new PrintStream(bos);
			}else{
				bis = new BufferedInputStream(System.in, INPUT_BUFFER_SIZE);
				bos = new BufferedOutputStream(System.out);
				out = new PrintStream(bos);
			}
			solve();
			out.flush();
		}catch (Exception e) {
			e.printStackTrace();
			System.exit(1);
		}
	}
	
	byte[] byteBufInput = new byte[BUF_SIZE_INPUT];
	byte by=-1;
	int byteRead=-1;
	int bytePos=-1;
	
	byte[] byteBuf = new byte[BUF_SIZE];
	int totalBytes;
	
	private byte nextByte() throws IOException{
		if (bytePos<0 || bytePos>=byteRead){
			byteRead = bis.read(byteBufInput);
			bytePos=0;
			if (byteRead<0)
				byteBufInput[bytePos]=0;//!!!
		}
		return byteBufInput[bytePos++];
	}
	
	public void writeInt(int num) throws IOException{
         int byteWriteOffset = byteBuf.length;
         if (num==0){
        	 byteBuf[--byteWriteOffset] = ZERO;
         }else{
        	 int numAbs = Math.abs(num);
        	 while (numAbs>0){
        		 byteBuf[--byteWriteOffset] = (byte)((numAbs % 10) + ZERO);
        		 numAbs /= 10;
        	 }
        	 if (num<0)
        		 byteBuf[--byteWriteOffset] = MINUS;
         }
         bos.write(byteBuf, byteWriteOffset, byteBuf.length - byteWriteOffset);
	}
	
	/**
	 * Please ensure ar.length <= byteBuf.length!
	 * 
	 * @param ar
	 * @throws IOException
	 */
	public void writeByteAr(byte[] ar) throws IOException{
		for (int i = 0; i < ar.length; i++) {
			byteBuf[i] = ar[i];
		}
		bos.write(byteBuf,0,ar.length);
	}
	
	public void writeSpaceBar() throws IOException{
		byteBuf[0] = SPACEBAR;
		bos.write(byteBuf,0,1);
	}
	
	/*
	//TODO test Unix/Windows formats
	public void toNextLine() throws IOException{
		while ((ch=nextChar())!='\n');
	}
	
	//[0-9.-] eE?
	public double nextDouble() throws IOException{
		while (((ch=nextChar())<'0' || ch>'9') && ch!=FLOAT_POINT && ch!='-');
		char[] tmp = new char[255];
		int itmp = 0;
		tmp[itmp++]=(char)ch;
		while (((ch=nextChar())>='0' && ch<='9') || ch==FLOAT_POINT || ch=='-'){
			tmp[itmp++]=(char)ch;
		}
		return Double.parseDouble(new String(tmp,0,itmp));
	}
	*/
	
	/**
	 * Returns next meaningful character as a byte.<br>
	 * 
	 * @return
	 * @throws IOException
	 */
	public byte nextChar() throws IOException{
		while ((by=nextByte())<=0x20);
		return by;
	}
	
	/**
	 * Returns next meaningful character OR space as a byte.<br>
	 * 
	 * @return
	 * @throws IOException
	 */
	public byte nextCharOrSpacebar() throws IOException{
		while ((by=nextByte())<0x20);
		return by;
	}

    /**
     * Reads line.
     * 
     * @return
     * @throws IOException
     */
    public String nextLine() throws IOException {
            readToken((byte)0x20);
            return new String(byteBuf,0,totalBytes);
    }
    
    /**
     * Reads token. Spacebar is separator char.
     * 
     * @return
     * @throws IOException
     */
    public String nextToken() throws IOException {
            readToken((byte)0x21);
            return new String(byteBuf,0,totalBytes);
    }
    
    /**
     * Spacebar is included as separator char
     * 
     * @throws IOException
     */
    private void readToken() throws IOException {
            readToken((byte)0x21);
    }
    
    private void readToken(byte acceptFrom) throws IOException {
            totalBytes = 0;
            while ((by=nextByte())<acceptFrom);
            byteBuf[totalBytes++] = by;
            while ((by=nextByte())>=acceptFrom){
                    byteBuf[totalBytes++] = by;
            }
    }
	
	public int nextInt() throws IOException{
		readToken();
		int num=0, i=0;
		boolean sign=false;
		if (byteBuf[i]==MINUS){
			sign = true;
			i++;
		}
		for (; i<totalBytes; i++){
			num*=10;
			num+=byteBuf[i]-ZERO;
		}
		return sign?-num:num;
	}
	
	public long nextLong() throws IOException{
		readToken();
		long num=0;
		int i=0;
		boolean sign=false;
		if (byteBuf[i]==MINUS){
			sign = true;
			i++;
		}
		for (; i<totalBytes; i++){
			num*=10;
			num+=byteBuf[i]-ZERO;
		}
		return sign?-num:num;
	}
	
	public static void main(String[] args) {
		new C().run();
	}
	
}