#include <bits/stdc++.h>
using namespace std;
long long x_, y_, ax, ay, bx, by, xs, ys, t, cnt, ans;
long long dp[66], d[66][66];
long long cal(long long x, long long y, long long a, long long b) {
  return abs(x - a) + abs(y - b);
}
struct node {
  long long x, y, dis;
} p[66];
int main() {
  cin >> x_ >> y_ >> ax >> ay >> bx >> by >> xs >> ys >> t;
  p[++cnt] = {x_, y_, 0};
  x_ = ax * x_ + bx;
  y_ = ay * y_ + by;
  while (x_ < (long long)3e16 && y_ < (long long)3e16) {
    p[++cnt] = {x_, y_, 0};
    x_ = ax * x_ + bx;
    y_ = ay * y_ + by;
  }
  for (int i = 1; i <= cnt; i++) {
    long long sum = cal(xs, ys, p[i].x, p[i].y), tmp = 0;
    tmp = sum;
    if (sum > t) continue;
    long long l = i, r = i, ansl = 1;
    while (tmp + p[l].x - p[l - 1].x + p[l].y - p[l - 1].y <= t && l > 1) {
      ansl++;
      tmp += p[l].x - p[l - 1].x + p[l].y - p[l - 1].y;
      l--;
    }
    ans = max(ans, ansl);
    long long ansr = 1;
    while (sum + p[r + 1].x - p[r].x + p[r + 1].y - p[r].y <= t && r < cnt) {
      ansr++;
      sum += p[r + 1].x - p[r].x + p[r + 1].y - p[r].y;
      r++;
    }
    ans = max(ans, ansr);
  }
  cout << ans;
}
