#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long ax, ay, bx, by, xs, ys, X, Y, t;
long long x[60], y[60];
const long long inf = 1e17;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> x[0] >> y[0] >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  int n = 0;
  while ((inf - bx) / ax >= x[n] && (inf - by) / ay >= y[n])
    n++, x[n] = (ax * x[n - 1] + bx), y[n] = (ay * y[n - 1] + by);
  int ans = 0;
  for (int i = 1; i <= n + 1; ++i)
    for (int l = 0; l + i - 1 <= n; ++l) {
      int r = l + i - 1;
      long long len = x[r] - x[l] + y[r] - y[l];
      long long dl = abs(xs - x[l]) + abs(ys - y[l]);
      long long dr = abs(xs - x[r]) + abs(ys - y[r]);
      if (dl <= t - len || dr <= t - len) ans = max(ans, i);
    }
  cout << ans << endl;
  return 0;
}
