import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.LinkedList; /* class Dist { int t; public Dist(int t, int d) { this.t = t; this.d = d; } int d; }*/ public class invasion { static String readLine(BufferedReader in) throws IOException { String s = ""; while (s.trim().length() == 0) { s = in.readLine(); } return s; } public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while(true) { String s = readLine(in); String[] xxx = s.split(" "); int n = Integer.valueOf(xxx[0]); int m = Integer.valueOf(xxx[1]); int a = Integer.valueOf(xxx[2]); int k = Integer.valueOf(xxx[3]); if (n == 0) break; //int t1, t2, d; //int M[][] = new int[n][n]; //boolean b[] = new boolean[n]; int remain = n; /*for (int i=0; i q = new LinkedList(); for (int i=0; i 0) { d = dist.d + M[t][j]; if (d < k && d < B[j]) { q.addLast(new Dist(j, d)); B[j] = d; } } } }*/ System.out.println(remain); } //s = in.readLine(); System.out.println(); } } }