#include <bits/stdc++.h>
long long int MMM = 1000000007;
int pw(long long int a, long long int b) {
  if (b == 0) return 1;
  long long int t = pw(a, b / 2);
  if (b % 2 == 0)
    return (t * t) % 1000000007;
  else
    return ((t * t) % 1000000007 * a) % 1000000007;
}
using namespace std;
vector<int> pm;
void prm(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (int p = 2; p <= n; p++)
    if (prime[p]) pm.push_back(p);
}
bool sortbysecdesc(const pair<long long int, long long int> &a,
                   const pair<long long int, long long int> &b) {
  return a.first > b.first;
}
bool cmp(int x, int y) { return x > y; }
int gcd(int a, int b) {
  if (a < b) swap(a, b);
  return (b == 0) ? a : gcd(b, a % b);
}
int pa[26];
int find(int i) {
  if (i == pa[i]) return i;
  return pa[i] = find(pa[i]);
}
void join(int i, int j) {
  int a = find(i);
  int b = find(j);
  if (b >= a)
    pa[b] = a;
  else
    pa[a] = b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int x, y, a, b, c, d, mx = 0;
  cin >> x >> y >> a >> b >> c >> d;
  long long int u, v, t, tt;
  cin >> u >> v >> t;
  tt = t;
  vector<pair<long long int, long long int> > vec;
  vec.push_back(make_pair(x, y));
  for (long long int i = 1;; i++) {
    if ((1e17 - c) / a < x) break;
    if ((1e17 - d) / b < y) break;
    x *= a;
    x += c;
    y *= b;
    y += d;
    vec.push_back(make_pair(x, y));
  }
  for (long long int i = 0; i < (int)vec.size(); i++) {
    t = tt;
    long long int cnt = 0, cnt1 = 0;
    long long int ans = 0;
    ans = abs(u - vec[i].first) + abs(v - vec[i].second);
    if (ans > t) continue;
    cnt++;
    cnt1++;
    t -= ans;
    for (long long int j = i; j > 0; j--) {
      ans = 0;
      ans += vec[j].first - vec[j - 1].first;
      ans += vec[j].second - vec[j - 1].second;
      if (ans > t) break;
      t -= ans;
      cnt++;
    }
    for (long long int j = i; j < (int)vec.size() - 1; j++) {
      ans = 0;
      ans += vec[j + 1].first - vec[j].first;
      ans += vec[j + 1].second - vec[j].second;
      if (ans > t) break;
      t -= ans;
      cnt1++;
    }
    mx = max(mx, cnt1);
    mx = max(mx, cnt);
  }
  cout << mx << endl;
}
