import java.util.Scanner;

/**
 * 
 * About Bacteria
 *
 */
public class CodeForces_199C {

        public static void main(String[] args) throws Exception {
        CodeForces_199C.Solve();
    }
    
    public static void Solve() {
        Scanner scanner = new Scanner(System.in);
        int k = scanner.nextInt();
        int b = scanner.nextInt();
        int n = scanner.nextInt();
        int t = scanner.nextInt();
        
        long numOfBacteria = 1;
        int s = 0;
        long nextSec = k * numOfBacteria + b;
        while (t >= nextSec) {
            numOfBacteria = nextSec;
            nextSec = k * numOfBacteria + b;
            s++;
        }
        
        System.out.println(n - s >= 0 ? n - s : 0);
    }
}
