// DPQZDBU --> GVDL NF
import java.util.Scanner;

public class cf_199C {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int b = sc.nextInt();
		int n = sc.nextInt();
		int t = sc.nextInt();
		sc.close();
		long x = 1, time = 0;
		for(int i = 0; i < n; i++) {
			x = k*x + b;
			if(x <= t)
				time++;
			else break;
		}
		System.out.println(n - time);
	}

}
