#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T& a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T& a, T b) {
  return a < b ? (a = b, true) : false;
}
const long long INF = 1e16L;
long long d(pair<long long, long long> p, pair<long long, long long> q) {
  return abs(p.first - q.first) + abs(p.second - q.second);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long x0, y0, ax, ay, bx, by, xs, ys, t;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  long long xx = x0, yy = y0;
  vector<pair<long long, long long>> p = {{x0, y0}};
  while (true) {
    long long x = p.back().first;
    long long y = p.back().second;
    x = x * ax + bx;
    y = y * ay + by;
    if (x > 2e16 || y > 2e16) break;
    p.emplace_back(x, y);
  }
  int n = p.size();
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      if (d(p[i], p[j]) <= t - d(p[i], make_pair(xs, ys)) ||
          (d(p[i], p[j]) <= t - d(p[j], make_pair(xs, ys)))) {
        uax(ans, j - i + 1);
      }
    }
  }
  cout << ans << '\n';
}
