#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000000 + 7;
const long long int N = 200000 + 6;
const long long int inf = 1e18 + 1e17;
long long int powm(long long int a, long long int b) {
  a = a % mod;
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return (res % mod);
}
long long int modInverse(long long int a, long long int m) {
  long long int m0 = m;
  long long int y = 0, x = 1;
  if (m == 1) return 0;
  while (a > 1) {
    long long int q = a / m;
    long long int t = m;
    m = a % m, a = t;
    t = y;
    y = x - q * y;
    x = t;
  }
  if (x < 0) x += m0;
  return x;
}
bool brr[2][N];
void solve() {
  long long int x, y, a1, a2, b1, b2, xs, ys, t;
  cin >> x >> y >> a1 >> a2 >> b1 >> b2 >> xs >> ys >> t;
  vector<pair<long long int, long long int> > v;
  v.push_back(make_pair(x, y));
  for (;;) {
    x = x * a1 + b1;
    y = y * a2 + b2;
    if ((x > 4 * 1e16 || x <= 0) || (y > 4 * 1e16 || y <= 0))
      break;
    else
      v.push_back(make_pair(x, y));
  }
  long long int maxorbs = 0;
  for (long long int i = 0; i < v.size(); i++) {
    long long int val = t;
    val = val - (abs(xs - v[i].first) + abs(ys - v[i].second));
    if (val >= 0) {
      long long int orbs = 1;
      long long int val2 = val;
      for (long long int j = i + 1; j < v.size() && val2 >= 0; j++) {
        val2 = val2 - (abs(v[j - 1].first - v[j].first) +
                       abs(v[j - 1].second - v[j].second));
        if (val2 >= 0) orbs++;
      }
      maxorbs = std::max(orbs, maxorbs);
      orbs = 1;
      val2 = val;
      for (long long int j = i - 1; j >= 0 && val2 >= 0; j--) {
        val2 = val2 - (abs(v[j].first - v[j + 1].first) +
                       abs(v[j].second - v[j + 1].second));
        if (val2 >= 0) orbs++;
      }
      maxorbs = std::max(orbs, maxorbs);
    }
  }
  cout << maxorbs << '\n';
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) solve();
}
