#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 1e2 + 5;
long long n, x[105], y[105], a, b, ax, ay, bx, by;
long long xs, ys, t;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> x[1] >> y[1] >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  for (int i = 2; i <= 100; ++i) {
    if (x[i - 1] > xs + t || y[i - 1] > ys + t) {
      n = i - 1;
      break;
    }
    x[i] = x[i - 1] * ax + bx;
    y[i] = y[i - 1] * ay + by;
  }
  long long ans = 0;
  for (int i = 1; i <= n; ++i) {
    long long m = t, res = 0;
    m -= abs(x[i] - xs) + abs(y[i] - ys);
    if (m >= 0) {
      res++;
      int l = i, r = n, pos;
      while (l <= r) {
        int mid = l + r >> 1;
        if (x[mid] - x[i] + y[mid] - y[i] <= m) {
          pos = mid;
          l = mid + 1;
        } else
          r = mid - 1;
      }
      ans = max(ans, res + pos - i);
      l = 1, r = i, pos;
      while (l <= r) {
        int mid = l + r >> 1;
        if (x[i] - x[mid] + y[i] - y[mid] <= m) {
          pos = mid;
          r = mid - 1;
        } else
          l = mid + 1;
      }
      ans = max(ans, res + i - pos);
    }
  }
  cout << ans;
}
