#include <bits/stdc++.h>
using namespace std;
const double PI = 3.141592653589793238;
long long int bexp(long long int a, long long int b, long long int mod) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
const long long int N = 100010;
const long long int mod = 1e9 + 7;
struct comp {
  bool operator()(const pair<long long int, long long int> a,
                  const pair<long long int, long long int> b) const {
    return a.second > b.second;
  }
};
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.precision(10);
  long long int k, b, n, t;
  cin >> k >> b >> n >> t;
  long long int cnt = 1;
  while (cnt <= t) {
    cnt = k * cnt + b;
    n--;
  }
  cout << max(0ll, n + 1) << "\n";
  return 0;
}
