#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000020;
const int K = 60;
const int MOd = 1e9 + 7;
long long a, x, y, ax, ay, by, bx, xs, ys, t;
vector<pair<long long, long long> > v;
long long dis(pair<long long, long long> x, pair<long long, long long> y) {
  return abs(x.first - y.first) + abs(x.second - y.second);
}
void solve(int n) {
  scanf("%lld %lld %lld %lld %lld %lld", &x, &y, &ax, &ay, &bx, &by);
  scanf("%lld %lld %lld", &xs, &ys, &t);
  for (int i = 1; i < 100; i++) {
    v.push_back(pair<long long, long long>(x, y));
    if (x > xs + t) break;
    if (y > ys + t) break;
    x = ax * x + bx;
    y = ay * y + by;
  }
  pair<long long, long long> s = pair<long long, long long>(xs, ys);
  long long ans = 0;
  for (int i = 0; i < v.size(); i++)
    for (int j = i; j < v.size(); j++) {
      long long d =
          min(dis(s, v[j]) + dis(v[j], v[i]), dis(s, v[i]) + dis(v[i], v[j]));
      if (d <= t) ans = max(ans, ((long long)j - i + 1));
    }
  cout << ans << endl;
}
int main() {
  int n = 1;
  for (int i = 1; i <= n; i++) solve(i);
  return 0;
}
