#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const int inf = 1e9;
const int N = 2e5;
long long int power(long long int n, long long int k) {
  long long int res = 1;
  while (k != 0) {
    if (k & 1) res *= n;
    n *= n;
    k /= 2;
  }
  return res;
}
int findMax(int i, vector<pair<long long int, long long int>> points,
            long long int t) {
  int cnt = 0;
  for (long long int j = i + 1; j < (int)points.size(); j++) {
    long long int temp = abs(points[j].first - points[j - 1].first) +
                         abs(points[j].second - points[j - 1].second);
    if (temp <= t) {
      cnt++;
      t -= temp;
    } else
      break;
  }
  return cnt;
}
void solve() {
  long long int x0, y0, ax, bx, ay, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  vector<pair<long long int, long long int>> points;
  points.push_back(make_pair(x0, y0));
  long long int u = ax, v = ay, x, y;
  for (long long int i = 1;; i++) {
    x = u * x0 + (u - 1) / (ax - 1) * bx;
    y = v * y0 + (v - 1) / (ay - 1) * by;
    if (y - ys > t || x - xs > t || x - xs + y - ys > t) break;
    points.push_back(make_pair(x, y));
    u *= ax, v *= ay;
  }
  bool ok = false;
  for (auto i : points) {
    if (abs(i.first - xs) + abs(i.second - ys) <= t) {
      ok = true;
      break;
    }
  }
  if (!ok) {
    cout << 0 << "\n";
    return;
  }
  long long int tRem;
  int mx = 0, cnt;
  for (int i = 0; i < (int)points.size(); i++) {
    x = points[i].first, y = points[i].second;
    if (abs(x - xs) + abs(y - ys) > t) continue;
    tRem = t - abs(x - xs) - abs(y - ys);
    for (int j = i; j >= 0; j--) {
      cnt = 1;
      long long int temp = abs(points[j].first - x) + abs(points[j].second - y);
      if (temp <= tRem) {
        cnt += i - j;
        if (2 * temp <= tRem) cnt += findMax(i, points, tRem - 2 * temp);
        mx = max(mx, cnt);
      } else
        break;
    }
  }
  cout << mx << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
