#include <bits/stdc++.h>
using namespace std;
const long long MAXKEK = 1e7 + 2007;
long long ans = -1;
void kek(long long f, long long t, long long t0, long long a1, long long t1,
         long long p1, long long a2, long long t2, long long p2) {
  for (long long i = 0; i < MAXKEK; ++i) {
    if (i && (i - 1) * a1 >= f) continue;
    if (!(i & 4098) && ((double)clock() / CLOCKS_PER_SEC > 2.8)) return;
    long long ostt = t - i * a1 * t1;
    if (ostt < 0) continue;
    long long have = i * a1 + ostt / t2 + (ostt % t2) / t0;
    if (have < f) continue;
    long long l = -1;
    long long r = ostt / t2;
    while (l < r - 1) {
      long long m = (l + r) / 2;
      long long have = i * a1 + m + (ostt - t2 * m) / t0;
      if (have >= f) {
        r = m;
      } else {
        l = m;
      }
    }
    long long new_ans = i * p1 + ((r - 1) / a2 + 1) * p2;
    if (ans == -1) ans = new_ans;
    ans = min(ans, new_ans);
    have = a1 * i + ostt / t0;
    if (have < f) continue;
    new_ans = i * p1;
    if (ans == -1) ans = new_ans;
    ans = min(ans, new_ans);
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  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;
  kek(f, t, t0, a1, t1, p1, a2, t2, p2);
  kek(f, t, t0, a2, t2, p2, a1, t1, p1);
  cout << ans;
  return 0;
}
