#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const double PI = acos(-1.0);
const long long LIM = 1e17;
const int T = 80;
long long X[T];
long long Y[T];
long long ax, ay, bx, by;
long long xs, ys, t;
int m;
int gen() {
  int i = 1;
  while (LIM / ax >= X[i - 1] and LIM / ay >= Y[i - 1]) {
    X[i] = ax * X[i - 1] + bx;
    Y[i] = ay * Y[i - 1] + by;
    i++;
  }
  return i;
}
long long dist(int a, int b) { return abs(X[a] - X[b]) + abs(Y[a] - Y[b]); }
int sob(int z) {
  long long x = xs, y = ys;
  long long d = abs(xs - X[z]) + abs(ys - Y[z]);
  if (d > t) return 0;
  int ori = z - 1;
  int ans = 1;
  while (z < m - 1 and d < t) {
    if (dist(z, z + 1) + d <= t) {
      d += dist(z, z + 1);
      z++;
      ans++;
    } else
      break;
  }
  while (ori >= 0 and d < t) {
    if (dist(z, ori) + d <= t) {
      d += dist(z, ori);
      z = ori;
      ori--;
      ans++;
    } else
      break;
  }
  return ans;
}
int desc(int z) {
  long long x = xs, y = ys;
  long long d = abs(xs - X[z]) + abs(ys - Y[z]);
  if (d > t) return 0;
  int ori = z + 1;
  int ans = 1;
  while (z > 0 and d < t) {
    if (dist(z, z - 1) + d <= t) {
      d += dist(z, z - 1);
      z--;
      ans++;
    } else
      break;
  }
  while (ori < m and d < t) {
    if (dist(z, ori) + d <= t) {
      d += dist(z, ori);
      z = ori;
      ori++;
      ans++;
    } else
      break;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> X[0] >> Y[0] >> ax >> ay >> bx >> by;
  cin >> xs >> ys >> t;
  m = gen();
  int ans = 0;
  for (int i = 0; i < m; i++) {
    ans = max(ans, sob(i));
    ans = max(ans, desc(i));
  }
  cout << ans << '\n';
  return 0;
}
