long long int k,b,n,t;
int main(){
    scanf("%I64d%I64d%I64d%I64d",&k,&b,&n,&t);
    long long ans = 0;
    if(t == 1) ans = n;
    else{
        long long tem = k+b;
        int i=1;
        while(i<=n){
            if(t >= tem) tem = tem*k+b;
            else break;
            i++;
        }
        printf("%d\n",n-i+1);
    }
    return 0;
}
