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

public class Microb implements Runnable {

    final static String taskname = "filename";

    public void solve() throws Exception {
    	
    	String input[] = in.readLine().split(" +");
    	long k = Integer.parseInt(input[0]);
    	long b = Integer.parseInt(input[1]);
    	long n = Integer.parseInt(input[2]);
    	long t = Integer.parseInt(input[3]);
    	
    /*	BigInteger z = BigInteger.ONE;
    	  for ( int i=0 ; i < n; i++){
    		  z = z.multiply(BigInteger.valueOf(k)).add(BigInteger.valueOf(b));
    	  }
    	BigInteger cur = BigInteger.valueOf(t); 
    	int  res = 0;
    	  while ( cur.compareTo(z) <= 0) {
    		  cur = cur.multiply(BigInteger.valueOf(k)).add(BigInteger.valueOf(b));
    		  res++;
    	  }   */
    	double delta = 0;
    	if (k==1){
    		
    		delta = Math.floor((t-1)/b);
    		
    	}
    	
    	if ( k > 1) {
    		long up = b+(k-1)*t;
    		long down = k-1+b;
    		
    		delta =  (double) up/(double)down;
    		
    	//delta = (b*k+(k-1)*t)/(k-1+b);
    	
    	delta = Math.log(delta)/Math.log(k);
    	
    	// delta = (Math.floor(delta)== delta) ? (delta -1) : Math.floor(delta);
    	
    	delta = Math.floor(delta);
    	}
    	
    	int res = (int) (n - delta);
    	
    	 
    	  out.write(res+"\n");
    	
    }

    public void run() {
        try {
            in = new BufferedReader(new InputStreamReader(System.in));
            out = new BufferedWriter(new OutputStreamWriter(System.out));
//             in = new BufferedReader(new FileReader(taskname + ".in"));
//             out = new BufferedWriter(new FileWriter(taskname + ".out"));
            solve();
            out.flush();
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    public int iread() throws Exception {
        return Integer.parseInt(readword());
    }

    public double dread() throws Exception {
        return Double.parseDouble(readword());
    }

    public long lread() throws Exception {
        return Long.parseLong(readword());
    }

    
    
    BufferedReader in;

    BufferedWriter out;

    public String readword() throws IOException {
        StringBuilder b = new StringBuilder();
        int c;
        c = in.read();
        while (c >= 0 && c <= ' ')
            c = in.read();
        if (c < 0)
            return "";
        while (c > ' ') {
            b.append((char) c);
            c = in.read();
        }
        return b.toString();
    }

    public static void main(String[] args) {
        // Locale.setDefault(Locale.US);
        new Thread(new Microb()).start();
    }
}