#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long POW(long long a, long long b, long long MMM = MOD) {
  long long ret = 1;
  for (; b; b >>= 1, a = (a * a) % MMM)
    if (b & 1) ret = (ret * a) % MMM;
  return ret;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) {
  if (a == 0 || b == 0) return a + b;
  return a * (b / gcd(a, b));
}
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, 1, -1};
long long oo = (long long)1e17;
long long x, y, ax, ay, bx, by, xs, ys, t;
vector<pair<long long, long long> > v;
bool ok(pair<long long, long long> p1, pair<long long, long long> p2) {
  long long t1 = (long long)abs(xs - p1.first) + (long long)abs(ys - p1.second);
  long long t2 = (long long)abs(p1.first - p2.first) +
                 (long long)abs(p1.second - p2.second);
  return t1 + t2 <= t;
}
int main() {
  cin >> x >> y >> ax >> ay >> bx >> by >> xs >> ys >> t;
  v.push_back(make_pair(x, y));
  while (x < oo / ax && y < oo / ay) {
    x = x * ax + bx, y = y * ay + by;
    v.push_back(make_pair(x, y));
  }
  int ans = 0, N = v.size();
  for (int(i) = (0); (i) <= (N - 1); (i) += (1)) {
    for (int(j) = (0); (j) <= (N - 1); (j) += (1)) {
      if (ok(v[i], v[j])) ans = max(ans, (int)abs(i - j) + 1);
    }
  }
  printf("%d", ans);
}
