#include <bits/stdc++.h>
using namespace std;
long long x[100], y[100], ax, ay, bx, by, xs, ys, t;
inline long long abso(const long long& x) { return x < 0 ? -x : x; }
int main() {
  cin >> x[0] >> y[0] >> ax >> ay >> bx >> by >> xs >> ys >> t;
  int tot = 0;
  while (y[tot] < ys || abso(x[tot] - xs) + abso(y[tot] - ys) <= t) {
    ++tot;
    x[tot] = ax * x[tot - 1] + bx;
    y[tot] = ay * y[tot - 1] + by;
  }
  int ans = 0;
  for (int i = 0; i <= tot; i++) {
    long long d1 = abso(xs - x[i]) + abso(ys - y[i]);
    if (d1 > t) continue;
    for (int j = 0; j <= i; j++)
      for (int k = i; k <= tot; k++) {
        long long l = abso(x[j] - x[k]) + abso(y[j] - y[k]);
        if (l > t || d1 + l > t) continue;
        long long d2 = min(abso(x[i] - x[j]) + abso(y[i] - y[j]),
                           abso(x[i] - x[k]) + abso(y[i] - y[k]));
        if (d2 > t || d1 + l + d2 > t) continue;
        ans = max(ans, k - j + 1);
      }
  }
  cout << ans;
  return 0;
}
