import static java.util.Arrays.deepToString;

import java.awt.font.NumericShaper;
import java.io.*;
import java.util.*;

import javax.swing.text.AbstractDocument.LeafElement;

public class B {

    static void solve() throws Exception {
        long k = nextInt();
        long b = nextInt();
        long n = nextInt();
        long t = nextInt();
        long z = 1;
        for(int i = 0; i < n; i++){
            z = k * z + b;
        }       
        int time = 0;
        long y = t;
        while (y < z){
            y = k * y + b;
            time++;
        }
        System.out.print(time);
    } 

    static BufferedReader br;
    static StringTokenizer st;
    static PrintWriter out;

    static void debug(Object... a) {
        System.err.println(deepToString(a));
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null) {
                return null;
            }
            st = new StringTokenizer(line);
        }
        return st.nextToken();
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    public static void main(String[] args) {
        try {           
            br = new BufferedReader(new InputStreamReader(System.in));
            solve();
            br.close();
        } catch (Throwable e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}