#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long x, y, a, b, aa, bb, s[120], v[120], c[120], ans, haha, d, pppp;
  long long xx, yy, t;
  cin >> x >> y >> a >> b >> aa >> bb;
  cin >> xx >> yy;
  cin >> t;
  s[0] = x;
  v[0] = y;
  ans = 0;
  pppp = 0;
  for (long long i = 0; i <= 80; i++) {
    if ((LONG_LONG_MAX - aa) / a < s[i] || (LONG_LONG_MAX - bb) / b < v[i]) {
      pppp = i;
      break;
    }
    s[i + 1] = s[i] * a + aa;
    v[i + 1] = v[i] * b + bb;
    c[i] = max(xx, s[i]) - min(xx, s[i]) + max(yy, v[i]) - min(yy, v[i]);
  }
  for (long long i = 1; i <= 60; i++) {
    d = 0;
    haha = 0;
    for (long long j = 0; j <= pppp - i; j++) {
      haha = min(c[j], c[j + i - 1]);
      haha = haha + s[j + i - 1] + v[j + i - 1] - s[j] - v[j];
      if (t >= haha) {
        d = 1;
        break;
      }
    }
    if (d == 0) {
      ans = i - 1;
      break;
    }
  }
  cout << ans;
}
