#include <bits/stdc++.h>
using namespace std;
long long int pos(long long int n) {
  if (n >= 0) {
    return n;
  }
  return -n;
}
int main() {
  long long int x_0, y_0, a_x, a_y, b_x, b_y, x_s, y_s, t;
  cin >> x_0 >> y_0 >> a_x >> a_y >> b_x >> b_y;
  cin >> x_s >> y_s >> t;
  vector<pair<long long int, long long int> > v;
  pair<long long int, long long int> r;
  r.first = x_0;
  r.second = y_0;
  v.push_back(r);
  while (v[v.size() - 1].first <= (1000000000000000000 - b_x) / a_x &&
         v[v.size() - 1].second <= (1000000000000000000 - b_y) / a_y) {
    pair<long long int, long long int> s;
    s.first = v[v.size() - 1].first * a_x + b_x;
    s.second = v[v.size() - 1].second * a_y + b_y;
    v.push_back(s);
  }
  long long int we = t;
  long long int answer = 0;
  for (long long int start = 0; start < v.size(); start++) {
    t = we;
    long long int distance =
        pos(x_s - v[start].first) + pos(y_s - v[start].second);
    if (distance > t) {
      continue;
    }
    t -= distance;
    bool good = true;
    for (int i = start; i >= 0; i--) {
      if (pos(v[start].first - v[i].first) +
              pos(v[start].second - v[i].second) <=
          t) {
        ;
      } else {
        answer = max(answer, start - i);
        good = false;
        break;
      }
      if (i == 0) {
        if (2 * (pos(v[start].first - v[i].first) +
                 pos(v[start].second - v[i].second)) >
            t) {
          answer = max(answer, start - i + 1);
          good = false;
          break;
        } else {
          t -= 2 * (pos(v[start].first - v[i].first) +
                    pos(v[start].second - v[i].second));
        }
      }
    }
    if (!good) {
      continue;
    }
    long long int ans = start + 1;
    for (int i = start + 1; i < v.size(); i++) {
      if (pos(v[start].first - v[i].first) +
              pos(v[start].second - v[i].second) <=
          t) {
        ans++;
      } else {
        break;
      }
    }
    answer = max(ans, answer);
  }
  cout << answer;
}
