#include <bits/stdc++.h>
using namespace std;
const int N = 1;
long long f, T, t0, a1, t1, p1, a2, t2, p2, ans = (long long)1e18;
long long g(long long a, long long b) { return (a + b - 1) / b; }
void solve() {
  for (long long i = 0; i <= g(f, a1); i++) {
    if (t1 * min(i * a1, f) > T) break;
    long long tk = f - i * a1;
    if (tk <= 0) {
      ans = min(ans, i * p1);
      continue;
    }
    long long rem = T - i * t1 * a1;
    long long bad = tk * t0 - rem;
    if (bad <= 0) {
      ans = min(ans, i * p1);
      continue;
    }
    if (t2 >= t0) continue;
    long long o = g(bad, t0 - t2);
    if (o > tk) continue;
    o = g(o, a2);
    long long tk2 = max((long long)0, tk - o * a2);
    ans = min(ans, p1 * i + o * p2);
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> f >> T >> t0 >> a1 >> t1 >> p1 >> a2 >> t2 >> p2;
  solve();
  swap(p1, p2);
  swap(t1, t2);
  swap(a1, a2);
  solve();
  if (ans == (long long)1e18)
    cout << -1 << endl;
  else
    cout << ans << endl;
  return 0;
}
