#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
long long x[maxn], y[maxn];
int main() {
  long long x0, y0, ax, ay, bx, by;
  scanf("%lld%lld%lld%lld%lld%lld", &x0, &y0, &ax, &ay, &bx, &by);
  long long xs, ys, t;
  cin >> xs >> ys >> t;
  x[1] = x0, y[1] = y0;
  int cnt = 1;
  for (int i = 2;; i++) {
    x[i] = x[i - 1] * ax + bx;
    y[i] = y[i - 1] * ay + by;
    if (x[i] + y[i] - xs - ys > t) break;
    cnt = i;
  }
  int mx = 0;
  for (int i = 1; i <= cnt; i++) {
    long long T = t;
    int num = 0;
    T -= abs(xs - x[i]) + abs(ys - y[i]);
    if (T < 0) continue;
    num++;
    long long p = T;
    for (int j = i; j >= 2; j--) {
      T -= abs(x[j] - x[j - 1]) + abs(y[j] - y[j - 1]);
      if (T < 0) break;
      num++;
    }
    if (T < 0)
      mx = max(mx, num);
    else {
      T -= abs(x[i + 1] - x[1]) + abs(y[i + 1] - y[1]);
      if (T < 0) {
        mx = max(mx, num);
        continue;
      }
      num++;
      for (int j = i + 1; j <= cnt; j++) {
        T -= abs(x[j] - x[j + 1]) + abs(y[j] - y[j + 1]);
        if (T < 0) break;
        num++;
      }
      mx = max(mx, num);
    }
  }
  cout << mx << endl;
  return 0;
}
