#include <bits/stdc++.h>
using namespace std;
ifstream fin("date.in");
ofstream fout("date.out");
struct data {
  long long nr;
  long long val;
  long long parcurs;
} curent, adaugare;
bool operator<(data a, data b) {
  if (a.parcurs == b.parcurs) return a.val > b.val;
  return a.parcurs < b.parcurs;
}
priority_queue<data> heap;
unsigned long long vx[100];
unsigned long long vy[100];
const unsigned long long val_max = 200000000000000000;
unsigned long long distanta(long long a, long long b, long long c,
                            long long d) {
  return abs(a - c) + abs(b - d);
}
unsigned long long m[100][100];
bool verificat[100];
unsigned long long dijkstra(long long n, long long t) {
  int i, max1 = 0, sem;
  curent.val = 0;
  curent.nr = 0;
  curent.parcurs = 0;
  heap.push(curent);
  while (!heap.empty()) {
    curent = heap.top();
    heap.pop();
    verificat[curent.nr] = 1;
    sem = 0;
    for (i = 1; i <= n; i++)
      if (curent.val + m[curent.nr][i] <= t) {
        sem = 1;
        adaugare.nr = i;
        if (verificat[i] == 0)
          adaugare.parcurs = curent.parcurs + 1;
        else
          adaugare.parcurs = curent.parcurs;
        adaugare.val = curent.val + m[curent.nr][i];
        heap.push(adaugare);
      }
    if (sem == 0) return curent.parcurs;
  }
  return 0;
}
unsigned long long dist_i_j(unsigned long long i, unsigned long long j) {
  unsigned long long suma = 0;
  for (unsigned long long i2 = i + 1; i2 <= j; i2++) suma += m[i2 - 1][i2];
  return suma;
}
unsigned long long distanta_adevarata2(unsigned long long n,
                                       unsigned long long t) {
  unsigned long long min1 = val_max, minn = 0, aux;
  for (int i = 1; i <= n; i++) {
    if (min1 > m[0][i]) {
      min1 = m[0][i];
      minn = i;
    }
  }
  unsigned long long nr1, nr2, x, y, i, j, minct = 1;
  bool sem = 1;
  nr2 = minn;
  if (m[0][nr2] > t) return 0;
  for (j = nr2; j <= n; j++)
    for (i = nr2; i >= 1; i--) {
      aux = dist_i_j(i, j) +
            min(min(dist_i_j(i, nr2), dist_i_j(nr2, j)) + m[0][nr2],
                min(m[0][i], m[0][j]));
      if (aux <= t)
        if (minct < nr2 - i + j - nr2 + 1) minct = nr2 - i + j - nr2 + 1;
    }
  return minct;
}
int main() {
  unsigned long long x0, y0, xs, ys, t, ax, ay, bx, by, n = 1, i, j;
  cin >> x0 >> y0 >> ax >> ay >> bx >> by >> xs >> ys >> t;
  vx[0] = xs;
  vy[0] = ys;
  while (x0 < val_max && y0 < val_max) {
    vx[n] = x0;
    vy[n] = y0;
    n++;
    x0 = ax * x0 + bx;
    y0 = ay * y0 + by;
  }
  n--;
  for (i = 0; i <= n; i++)
    for (j = 0; j <= n; j++) {
      if (i == j) continue;
      m[i][j] = distanta(vx[i], vy[i], vx[j], vy[j]);
    }
  cout << distanta_adevarata2(n, t);
  return 0;
}
