#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> adj[1001];
int vis[1001];
int main() {
  long long k, b, n, t, m = 1;
  cin >> k >> b >> n >> t;
  while (n >= 1 && k * m + b <= t) m = k * m + b, n--;
  cout << n << endl;
  return 0;
}
