#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
  long long int res = 1;
  x = x % 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res;
}
bool prime[1000001];
long long int ans;
void solve(vector<long long int> x, vector<long long int> y,
           vector<long long int> z) {
  for (long long int i = 0; i < y.size(); i++) {
    auto f = lower_bound(z.begin(), z.end(), y[i]);
    auto g = upper_bound(x.begin(), x.end(), y[i]);
    if (f == z.end() or g == x.begin()) {
      continue;
    }
    g--;
    ans = min(ans, (y[i] - *f) * (y[i] - *f) + (y[i] - *g) * (y[i] - *g) +
                       (*f - *g) * (*f - *g));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  {
    long long int x, y, a1, a2, b1, b2, c1, c2;
    cin >> x >> y >> a1 >> a2 >> b1 >> b2;
    long long int xs, ys, t;
    cin >> xs >> ys >> t;
    vector<long long int> v1, v2;
    v1.push_back(x);
    v2.push_back(y);
    long long int lim = 5e18;
    while ((lim - b1) / a1 >= v1.back() and (lim - b2) / a2 >= v2.back()) {
      v1.push_back(a1 * v1.back() + b1);
      v2.push_back(a2 * v2.back() + b2);
    }
    long long int s = v1.size();
    long long int ans = 0;
    long long int p, q;
    ans = abs(xs - v1[0]) + abs(ys - v2[0]);
    long long int sol = 0;
    for (long long int i = 0; i < s; i++) {
      long long int f = abs(xs - v1[i]) + abs(ys - v2[i]);
      if (f <= ans and f <= t) {
        p = i;
        q = f;
        ans = f;
        sol = 1;
      }
    }
    if (sol == 0) {
      cout << 0;
      return 0;
    }
    long long int sp = 0;
    for (long long int i = 0; i < p; i++) {
      if (abs(v1[p] - v1[i]) + abs(v2[p] - v2[i]) + q <= t) {
        sol = p - i + 1;
        sp = i;
        break;
      }
    }
    if (sp == 0) {
      for (long long int i = p + 1; i < s; i++) {
        if (min(abs(xs - v1[0]) + abs(ys - v2[0]),
                abs(xs - v1[i]) + abs(ys - v2[i])) +
                abs(v1[i] - v1[sp]) + abs(v2[i] - v2[sp]) <=
            t) {
          sol++;
        } else {
          break;
        }
      }
    }
    cout << sol;
  }
}
