#include <bits/stdc++.h>
using namespace std;
void Solve() {
  long long ans = LLONG_MAX;
  long long f, T, t0;
  cin >> f >> T >> t0;
  long long a1, t1, p1;
  cin >> a1 >> t1 >> p1;
  long long a2, t2, p2;
  cin >> a2 >> t2 >> p2;
  for (signed i = 0; i < (2); i++) {
    for (long long x = 0; x <= f; ++x) {
      long long y = 0;
      long long time_ost = T - x * t1;
      if (time_ost < 0) break;
      long long down = t0 - t2;
      long long up = (f - x) * t0 - time_ost;
      if (down > 0 && up > 0) {
        y = max(0ll, (up + down - 1) / down);
      }
      if (x * t1 + y * t2 <= T && x + y + (T - x * t1 - y * t2) / t0 >= f) {
        long long cnt1 = (x + a1 - 1) / a1;
        long long cnt2 = (y + a2 - 1) / a2;
        ans = min(ans, cnt1 * p1 + cnt2 * p2);
      }
    }
    swap(a1, a2), swap(t1, t2), swap(p1, p2);
  }
  cout << (ans == LLONG_MAX ? -1 : ans);
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Solve();
  return 0;
}
