#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 1000002;
const double PI = 4 * atan(1);
const double eps = 1e-7;
const long long oo = 1e18;
long long n, q;
vector<pair<long long, long long> > v;
long long dist(pair<long long, long long> a, pair<long long, long long> b) {
  return abs(a.first - b.first) + abs(a.second - b.second);
}
long long x, y, ax, ay, bx, by;
long long xs, ys;
long long t;
int main() {
  ios::sync_with_stdio(0);
  cin >> x >> y >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  v.push_back({x, y});
  while (x + y <= 2 * t + xs + ys) {
    x = ax * x + bx;
    y = ay * y + by;
    v.push_back({x, y});
  }
  long long n = v.size();
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      if (i == j) {
        ans = (ans > (t >= dist({xs, ys}, v[i])) ? ans
                                                 : (t >= dist({xs, ys}, v[i])));
      } else {
        for (int k = i; k <= j; k++) {
          long long z = dist({xs, ys}, v[k]);
          z += dist(v[i], v[j]) + (dist(v[k], v[i]) < dist(v[k], v[j])
                                       ? dist(v[k], v[i])
                                       : dist(v[k], v[j]));
          if (z <= t) ans = (ans > j - i + 1 ? ans : j - i + 1);
        }
      }
    }
  }
  cout << ans;
  return 0;
}
