#include <bits/stdc++.h>
using namespace std;
template <typename T>
void gmin(T &a, T b) {
  a = a < b ? a : b;
}
template <typename T>
void gmax(T &a, T b) {
  a = a > b ? a : b;
}
long long ax, ay, bx, by;
long long xs, ys, t;
long long mxx, mxy;
int n, ans;
long long px[60], py[60];
int main() {
  cin >> px[0] >> py[0] >> ax >> ay >> bx >> by >> xs >> ys >> t;
  mxx = xs + t;
  mxy = ys + t;
  for (n = 1; px[n - 1] <= (mxx - bx) / ax && py[n - 1] <= (mxy - by) / ay;
       n++) {
    px[n] = ax * px[n - 1] + bx;
    py[n] = ay * py[n - 1] + by;
  }
  ans = 0;
  for (int i = 0; i < n; i++) {
    long long tt = t - abs(xs - px[i]) - abs(ys - py[i]);
    for (int j = i; j >= 0; j--) {
      if (abs(px[j] - px[i]) + abs(py[j] - py[i]) <= tt) gmax(ans, i - j + 1);
    }
    for (int j = i; j < n; j++) {
      if (abs(px[j] - px[i]) + abs(py[j] - py[i]) <= tt) gmax(ans, j - i + 1);
    }
  }
  cout << ans << endl;
  return 0;
}
