#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.1,sse4.2,popcnt,mmx,avx")
using namespace std;
const int MOD = 1000000007;
const int UNDEF = -1;
const int INF = 1 << 30;
template <typename T>
inline bool chkmax(T &aa, T bb) {
  return aa < bb ? aa = bb, true : false;
}
template <typename T>
inline bool chkmin(T &aa, T bb) {
  return aa > bb ? aa = bb, true : false;
}
int rint();
char rch();
long long rlong();
long long z[2], a[2], b[2], s[2];
const int mn = 1e5;
__int128 p[mn][2];
vector<__int128> d;
int n = 1;
long long have;
__int128 abs(__int128 x) {
  if (x < 0) return -x;
  return x;
}
bool f(int init, int want) {
  if (want == 0) return true;
  if (want > n) return false;
  __int128 base = 0;
  for (int t = 0; t < 2; t++) base += abs(s[t] - p[init][t]);
  __int128 left = have - base;
  if (left < 0) return false;
  if (init - want + 1 >= 0) {
    __int128 need = d[init] - d[init - want + 1];
    if (need <= left) {
      return true;
    }
  }
  if (init + want - 1 < n) {
    __int128 need = d[init + want - 1] - d[init];
    if (need <= left) {
      return true;
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (int t = 0; t < 2; t++) cin >> z[t];
  for (int t = 0; t < 2; t++) cin >> a[t];
  for (int t = 0; t < 2; t++) cin >> b[t];
  for (int t = 0; t < 2; t++) cin >> s[t];
  cin >> have;
  for (int t = 0; t < 2; t++) p[0][t] = z[t];
  d.push_back(0);
  for (int i = 1;; i++) {
    bool ok = true;
    for (int t = 0; t < 2; t++) {
      __int128 res = a[t] * p[i - 1][t] + b[t];
      if (res - s[t] > have) ok = false;
      p[i][t] = res;
    }
    if (!ok) break;
    __int128 dist = 0;
    for (int t = 0; t < 2; t++) dist += abs(p[i][t] - p[i - 1][t]);
    __int128 cumdist = dist + d.back();
    d.push_back(cumdist);
    n++;
  }
  int final = 0;
  for (int i = 0; i < n; i++) {
    int imin = 0, imax = n + 1;
    while (imin < imax) {
      int imid = (imin + imax) / 2;
      if (f(i, imid))
        imin = imid + 1;
      else
        imax = imid;
    }
    chkmax(final, imin - 1);
  }
  printf("%d\n", final);
}
