
import java.util.*;
import java.io.*;
import java.math.*;

public class c_beta extends Thread {

	BufferedReader bf;
	PrintWriter out;
	FastScanner in;

	void solve() throws Exception {
		int k = in.nextInt();
		int b = in.nextInt();
		int n = in.nextInt();
		int t = in.nextInt();
		
		long x = 1;
		while (n > 0){
			x = x*k + b;
			if (x > t) break;
			n--;
		}
		out.println(n);
	}

	public void run() {
		try {
			bf = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
			in = new FastScanner(bf);
			solve();
			out.flush();
		} catch (Exception ex) {
			ex.printStackTrace();
		} finally {
			out.close();
		}
	}

	public static void main(String args[]) {
		new c_beta().start();
	}

	class FastScanner {
		BufferedReader bf;
		StringTokenizer st;

		public FastScanner(BufferedReader bf) {
			this.bf = bf;
		}

		public String nextToken() throws Exception {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(bf.readLine());
			}
			return st.nextToken();
		}

		public int nextInt() throws Exception {
			return Integer.parseInt(nextToken());
		}

		public long nextLong() throws Exception {
			return Long.parseLong(nextToken());
		}

		public Double nextDouble() throws Exception {
			return Double.parseDouble(nextToken());
		}

		public BigInteger nextBigInteger() throws Exception {
			return new BigInteger(nextToken());
		}
	}
}