#include <bits/stdc++.h>
using namespace std;
long long f, T, t0, t1, p1, a1, t2, p2, a2;
const long long inf = 1e18;
long long bst = inf;
void load() {
  cin >> f >> T >> t0;
  cin >> a1 >> t1 >> p1 >> a2 >> t2 >> p2;
}
long long mlt(long long a, long long b, long long c) {
  long double res = a;
  res *= b;
  res *= c;
  res = min(res, 1e18l);
  return (long long)(res);
}
void check(long long y) {
  if (y * a1 >= f) {
    if (min(a1 * y, f) * t1 <= ::T) {
      bst = min(bst, y * p1);
    }
    return;
  }
  if (mlt(y, t1, a1) > ::T) return;
  long long T = ::T - a1 * y * t1;
  long long x = f - y * a1;
  if (x * t0 + mlt(y, t1, a1) <= ::T) {
    bst = min(bst, p1 * y);
    return;
  }
  if (t2 >= t0) return;
  long long up = x * t0 - T;
  long long dw = a2 * (t0 - t2);
  long long cnt = (up + dw - 1) / dw;
  long long TT = max(0ll, f - y * a1 - cnt * a2) * t0 + y * t1 * a1 +
                 min(cnt * a2, f - a1 * y) * t2;
  if (TT > ::T) return;
  long long F = max(0ll, f - y * a1 - cnt * a2) + y * a1 + cnt * a2;
  if (F < f) return;
  bst = min(bst, y * p1 + cnt * p2);
}
void solve() {
  for (int i = 0; i <= f; i++) {
    check(i);
  }
  swap(a1, a2);
  swap(p1, p2);
  swap(t1, t2);
  for (int i = 0; i <= f; i++) {
    check(i);
  }
  if (bst == inf) bst = -1;
  cout << bst << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  load();
  solve();
  return 0;
}
