#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1, -1, -1, 0, 1, -1, 0, 1};
int kx8[] = {1, 1, 2, 2, -1, -1, -2, -2};
int ky8[] = {2, -2, 1, -1, 2, -2, 1, -1};
long long bigmod(long long a, long long b, long long c) {
  if (b == 0) return 1 % c;
  long long x = bigmod(a, b / 2, c);
  x = (x * x) % c;
  if (b % 2 == 1) x = (x * a) % c;
  return x;
}
long long mod_inverse(long long a, long long mod) {
  return bigmod(a, mod - 2, mod);
}
long long poww(long long a, long long b) {
  if (b == 0) return 1;
  long long x = poww(a, b / 2);
  x = x * x;
  if (b % 2 == 1) x = (x * a);
  return x;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long f, T, t0, a1, t1, p1, a2, t2, p2;
  cin >> f >> T >> t0;
  cin >> a1 >> t1 >> p1;
  cin >> a2 >> t2 >> p2;
  if (t1 > t2) {
    swap(a1, a2);
    swap(t1, t2);
    swap(p1, p2);
  }
  long long res = t0 * f;
  if (t0 <= t1 || res <= T) {
    if (res > T)
      res = -1;
    else
      res = 0;
    cout << res << endl;
    return 0;
  }
  long long lw = 0, hi = 1e14, ans = -1, mid;
  while (lw <= hi) {
    mid = (lw + hi) / 2;
    long long sum = 1e18;
    long long band = 0;
    long long cost = 0;
    long long tm = 0;
    for (long long i = 0; i <= 1e6; i++) {
      if (tm > T || cost > mid) break;
      long long ncost = mid - cost;
      long long nband = f - band;
      long long now = tm + nband * t0;
      if (sum > now) {
        sum = now;
      }
      long long j = ncost / p2;
      long long rband = j * a2;
      if (rband >= nband) rband = nband;
      long long rtm = rband * t2;
      now = tm + rtm + (f - band - rband) * t0;
      if (sum > now) {
        sum = now;
      }
      if (sum <= T) break;
      if (band >= f) break;
      cost += p1;
      band += a1;
      if (band >= f) band = f;
      tm = band * t1;
    }
    for (long long i = 0; i <= 1e6; i++) {
      long long band = min(f, i * a2);
      long long cost = i * p2;
      long long tm = band * t2;
      if (tm > T || cost > mid) break;
      long long ncost = mid - cost;
      long long nband = f - band;
      sum = min(sum, tm + nband * t0);
      long long j = ncost / p1;
      long long rband = min(nband, j * a1);
      long long rtm = rband * t1;
      sum = min(sum, tm + rtm + (f - band - rband) * t0);
      if (sum <= T) break;
      if (band >= f) break;
    }
    if (sum <= T) {
      ans = mid;
      hi = mid - 1;
    } else {
      lw = mid + 1;
    }
  }
  cout << ans << endl;
  return 0;
}
