#include <bits/stdc++.h>
using namespace std;
const unsigned _mod = 998244353;
const unsigned mod = 1e9 + 7;
const long long infi = 0x3f3f3f3f3f3f3f3fll;
const int inf = 0x3f3f3f3f;
long long ksm(long long x, long long y) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % mod;
    y >>= 1ll;
    x = x * x % mod;
  }
  return ret;
}
long long qpow(long long x, long long y, long long m) {
  long long ret = 1;
  while (y) {
    if (y & 1ll) ret = ret * x % m;
    y >>= 1ll;
    x = x * x % m;
  }
  return ret;
}
long long _gcd(long long x, long long y) { return y ? _gcd(y, x % y) : x; }
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long f, t, t0, a1, t1, p1, a2, t2, p2, y, x, _min = infi / 2, jyz;
int main() {
  cin >> f >> t >> t0 >> a1 >> t1 >> p1 >> a2 >> t2 >> p2;
  if (t1 > t2) swap(t1, t2), swap(a1, a2), swap(p1, p2);
  for (register int i = 0; i <= (f - 1) / a1; ++i) {
    x = f - i * a1;
    y = t - i * a1 * t1;
    if (x * min(t0, t2) > y) continue;
    if (t0 <= t2)
      _min = min(_min, p1 * i);
    else
      _min = min(
          _min,
          p1 * i +
              p2 * max(((t0 * x - y + t0 - t2 - 1) / (t0 - t2) + a2 - 1) / a2,
                       0ll));
  }
  if (f * t1 <= t) _min = min(_min, ((f - 1) / a1 + 1) * p1);
  if (_min == infi / 2)
    puts("-1");
  else
    cout << _min << '\n';
  return 0;
}
