#include <bits/stdc++.h>
using namespace std;
int MAX_INT = numeric_limits<int>::max();
int MIN_INT = numeric_limits<int>::min();
long long MAX_LL = numeric_limits<long long>::max();
long long MIN_LL = numeric_limits<long long>::min();
long long lim = 1e16 + 1;
unsigned long long xz, yz, ax, ay, bx, by;
unsigned long long xs, ys, t;
unsigned long long dist(pair<unsigned long long, unsigned long long> p1,
                        pair<unsigned long long, unsigned long long> p2) {
  unsigned long long res = 0;
  if (p1.first > p2.first)
    res += p1.first - p2.first;
  else
    res += p2.first - p1.first;
  if (p1.second > p2.second)
    res += p1.second - p2.second;
  else
    res += p2.second - p1.second;
  return res;
}
pair<unsigned long long, unsigned long long> up(
    pair<unsigned long long, unsigned long long> p) {
  return {ax * p.first + bx, ay * p.second + by};
}
unsigned long long max(unsigned long long l1, unsigned long long l2) {
  if (l1 > l2) return l1;
  return l2;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> xz >> yz >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  pair<unsigned long long, unsigned long long> myp = {xs, ys};
  pair<unsigned long long, unsigned long long> p = {xz, yz};
  long long res = 0;
  vector<pair<unsigned long long, unsigned long long> > pts;
  do {
    pts.push_back(p);
    p = up(p);
  } while (p.first < xs + lim && p.second < ys + lim);
  for (int i = 0; i < pts.size(); i++) {
    int cur = 0;
    auto my = myp;
    unsigned long long tp = t;
    int j = i;
    while (dist(my, pts[j]) <= tp && tp >= 0 && j >= 0) {
      cur++;
      tp -= dist(my, pts[j]);
      my = pts[j];
      j--;
    }
    res = max(res, cur);
    cur = 0;
    my = myp;
    tp = t;
    j = i + 1;
    while (j < pts.size() && tp >= 0 && dist(my, pts[j]) <= tp) {
      cur++;
      tp -= dist(my, pts[j]);
      my = pts[j];
      j++;
    }
    res = max(res, cur);
    cur = 0;
    my = myp;
    tp = t;
    j = 0;
    while (j < pts.size() && tp >= 0 && dist(my, pts[j]) <= tp) {
      cur++;
      tp -= dist(my, pts[j]);
      my = pts[j];
      j++;
    }
    res = max(res, cur);
  }
  cout << res << '\n';
}
