#include <bits/stdc++.h>
using namespace std;
long long ax, ay, bx, by, ans, n, x[71], y[71], xs, ys, t;
long long dist(long long x1, long long y1, long long x2, long long y2) {
  return llabs(x1 - x2) + llabs(y1 - y2);
}
int main() {
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d", &x[0], &y[0], &ax, &ay, &bx, &by);
  scanf("%I64d%I64d%I64d", &xs, &ys, &t);
  while (++n) {
    x[n] = ax * x[n - 1] + bx;
    y[n] = ay * y[n - 1] + by;
    if (x[n] > xs && y[n] > ys && dist(xs, ys, x[n], y[n]) > t) break;
  }
  for (int i = 0; i <= n; i++) {
    long long tans = 0, tt = t;
    if (dist(xs, ys, x[i], y[i]) <= tt)
      tt -= dist(xs, ys, x[i], y[i]), tans++;
    else {
      ans = max(ans, tans);
      continue;
    }
    for (int j = i; j; j--) {
      if (dist(x[j], y[j], x[j - 1], y[j - 1]) <= tt)
        tt -= dist(x[j], y[j], x[j - 1], y[j - 1]), tans++;
      else
        break;
    }
    for (int j = 1; j <= n; j++) {
      if (dist(x[j], y[j], x[j - 1], y[j - 1]) <= tt)
        tt -= dist(x[j], y[j], x[j - 1], y[j - 1]), tans += j > i;
      else
        break;
    }
    ans = max(ans, tans);
  }
  printf("%I64d\n", ans);
  return 0;
}
