#include <bits/stdc++.h>
using namespace std;
long long int ESP = 1e18;
long long int FCB = 1e9 + 7;
long long int dir[][2] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int k, b, n, t;
  cin >> k >> b >> n >> t;
  long long int cur = 1;
  while (cur <= t) {
    cur = cur * k + b;
    n--;
  }
  cout << max(0LL, n + 1) << "\n";
  return 0;
}
