#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int k, b, n, t;
  cin >> k >> b >> n >> t;
  long long int x = 1;
  long long int ans = n;
  while (k * x + b <= t) {
    x = k * x + b;
    ans--;
  }
  cout << max(ans, 0 * 1ll) << endl;
}
