import java.util.*; class Main{ public static void main(String args[]){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int p = sc.nextInt(); int q = sc.nextInt(); int a = 0; while(n > 0){ a++; if(a >= p && a <= p + q - 1){ n -= 2*m; }else{ n -=m; } } System.out.print(a); } }