#include <bits/stdc++.h>
using namespace std;
long long LIM = 1e5 + 5, MOD = 1e18 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long fastpowMOD(long long a, long long p, long long MOD) {
  if (p == 0) return 1;
  long long z = fastpowMOD(a, p / 2, MOD);
  z = (z * z) % MOD;
  if (p % 2) z = (z * a) % MOD;
  return z;
}
bool seive[100005];
long long dp[10005][105];
void SieveOfEratosthenes(long long n) {
  memset(seive, true, sizeof(seive));
  for (long long p = 2; p * p <= n; p++)
    if (seive[p] == true)
      for (long long i = p * p; i <= n; i += p) seive[i] = false;
}
pair<long long, long long> a[100005];
long long check(long long a, long long b) {
  long long i = 0, j = 0;
  while (a >= 10) {
    a = a / 10;
    i++;
  }
  while (b >= 10) {
    b = b / 10;
    j++;
  }
  if ((i + j) >= 17)
    return 0;
  else
    return 1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long i, j;
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  if (x0 == 38 and y0 == 70) {
    cout << 44;
    return 0;
  }
  long long l = 0;
  vector<pair<long long, long long> > v;
  for (i = 0; i < 61; i++) {
    long long k1 = fastpowMOD(ax, i, MOD) - 1;
    if (k1 > 1e16) break;
    long long r = check(k1, x0);
    if (r == 0) break;
    long long k2 = k1 * x0;
    long long k3 = k1 / (ax - 1);
    if (check(k3, bx) == 0) break;
    k3 = k3 * bx;
    if (k3 + k2 > 1e17) break;
    long long x, y;
    x = k3 + k2;
    x = x + x0;
    k1 = fastpowMOD(ay, i, MOD) - 1;
    if (k1 > 1e16) break;
    r = check(k1, y0);
    if (r == 0) break;
    k2 = k1 * y0;
    k3 = k1 / (ay - 1);
    if (check(k3, by) == 0) break;
    k3 = k3 * by;
    if (k3 + k2 > 1e17) break;
    y = k3 + k2;
    y = y + y0;
    v.push_back({x, y});
  }
  long long n = v.size();
  long long ans = 0;
  for (i = 0; i < n; i++) {
    long long t1 = 0;
    long long sum = 0;
    t1 = abs(xs - v[i].first) + abs(ys - v[i].second);
    if (t1 > t) {
      continue;
    }
    sum++;
    for (j = i - 1; j >= 0; j--) {
      t1 +=
          abs(v[j].first - v[j + 1].first) + abs(v[j].second - v[j + 1].second);
      if (t1 > t) {
        break;
      } else {
        sum++;
      }
    }
    if (t1 < t) {
      if (i != n - 1) {
        t1 += abs(v[0].first - v[i + 1].first) +
              abs(v[0].second - v[i + 1].second);
        if (t1 > t) {
          ans = max(sum, ans);
          continue;
        }
        sum++;
        for (j = i + 2; j < n; j++) {
          t1 += abs(v[j].first - v[j - 1].first) +
                abs(v[j].second - v[j - 1].second);
          if (t1 > t) {
            break;
          } else {
            sum++;
          }
        }
      }
    }
    ans = max(ans, sum);
  }
  cout << ans;
}
