import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class B125D1 {

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

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }
    }
}
