#include <bits/stdc++.h>
using namespace std;
long long int x[105];
long long int y[105];
long long int xs, ys, t, ax, ay, bx, by;
long long int maxi = 0;
int main() {
  cin >> x[0] >> y[0] >> ax >> ay >> bx >> by >> xs >> ys >> t;
  long long int k = 0;
  for (long long int i = 1; x[i - 1] <= 3 * 1e16 && y[i - 1] < 3 * 1e16; i++) {
    x[i] = x[i - 1] * ax + bx;
    y[i] = y[i - 1] * ay + by;
    k++;
  }
  for (long long int i = 0; i < k; i++) {
    for (long long int j = 0; j < k; j++) {
      if (abs(xs - x[i]) + abs(ys - y[i]) + abs(x[i] - x[j]) +
              abs(y[i] - y[j]) <=
          t)
        maxi = max(maxi, abs(i - j) + 1);
    }
  }
  cout << maxi;
}
