#include <bits/stdc++.h>
using namespace std;
const long long LIM = 4e16;
long long X0, Y0, ax, ay, bx, by;
long long xs, ys, t, ans = 0;
void Trans(long long &x, long long &y) {
  x = ax * x + bx;
  y = ay * y + by;
}
struct Node {
  long long x, y;
} p[100];
int N;
long long solve(int pos) {
  long long tmp = t - (abs(xs - p[pos].x) + abs(ys - p[pos].y));
  if (tmp < 0) return 0;
  int res = 1;
  for (int i = pos + 1; i <= N; i++) {
    long long ds = (abs(p[i].x - p[pos].x) + abs(p[i].y - p[pos].y));
    if (tmp - ds < 0) break;
    int j;
    for (j = 1; j < pos; j++)
      if (tmp - ds - (abs(p[i].x - p[j].x) + abs(p[i].y - p[j].y)) >= 0) break;
    res = max(res, i - j + 1);
  }
  for (int i = pos - 1; i; i--) {
    long long ds = (abs(p[i].x - p[pos].x) + abs(p[i].y - p[pos].y));
    if (tmp - ds < 0) break;
    int j;
    for (j = N; j > pos; j--)
      if (tmp - ds - (abs(p[i].x - p[j].x) + abs(p[i].y - p[j].y)) >= 0) break;
    res = max(res, j - i + 1);
  }
  return res;
}
int main() {
  scanf("%lld%lld%lld%lld%lld%lld", &X0, &Y0, &ax, &ay, &bx, &by);
  scanf("%lld%lld%lld", &xs, &ys, &t);
  for (long long x = X0, y = Y0;;) {
    p[++N] = (Node){x, y};
    Trans(x, y);
    if (x > LIM || y > LIM) break;
  }
  for (int i = 1; i <= N; i++) ans = max(ans, solve(i));
  cout << ans << endl;
  return 0;
}
