import java.util.Scanner;

public class AboutBacteria {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt(), b = sc.nextInt(), n = sc.nextInt();
		long t = sc.nextLong();
		long count = 1;
		while (count <= t) {
			count = count * k + b;
			--n;
		}
		System.out.println(Math.max(0, n + 1));
		// System.out.println(i);
		System.exit(0);
	}
}
