#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:64000000")
using namespace std;
const int INF = (int)1E9;
const long long INF64 = (long long)1E18;
const long double EPS = 1E-9;
const long double PI = 3.1415926535897932384626433832795;
long long k, b, t;
int n;
int main() {
  cin >> k >> b >> n >> t;
  long long x = 1;
  int ans = 0;
  while (x <= t) {
    x = k * x + b;
    ans++;
  }
  cout << max(0, n - ans + 1) << endl;
  return 0;
}
