import java.util.Scanner;

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

		int k = myScan.nextInt();
		int b = myScan.nextInt();
		int n = myScan.nextInt();
		int t = myScan.nextInt();
		long z = 1;

		for (int i = 0; i < n; i++) {
			z = z * k + b;
			if (z > t) {
				System.out.println(n - i);
				return;
			}
		}

		System.out.println(0);

	}
}
