#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int main() {
  vector<ll> x(1), y(1);
  ll ax, ay, bx, by;
  cin >> x[0] >> y[0] >> ax >> ay >> bx >> by;
  ll sx, sy, t;
  cin >> sx >> sy >> t;
  for (int i = 1;; i++) {
    x.push_back(ax * x[i - 1] + bx);
    y.push_back(ay * y[i - 1] + by);
    if (x[i] - sx > t || y[i] - sy > t) break;
  }
  int ans = 0;
  for (int i = 0; i < (int)(x.size()); i++) {
    ll dist = abs(x[i] - sx) + abs(y[i] - sy);
    int cnt = (dist <= t);
    for (int j = i + 1; j < x.size(); j++) {
      dist += (x[j] - x[j - 1]) + (y[j] - y[j - 1]);
      cnt += (dist <= t);
    }
    chmax(ans, cnt);
    dist = abs(x[i] - sx) + abs(y[i] - sy);
    cnt = (dist <= t);
    for (int j = i; j > 0; j--) {
      dist += (x[j] - x[j - 1]) + (y[j] - y[j - 1]);
      cnt += (dist <= t);
    }
    chmax(ans, cnt);
  }
  cout << ans << endl;
}
