#include <bits/stdc++.h>
using namespace std;
const int Maxn = 5;
const long long INF = 1e15;
long long t[Maxn + 5];
long long p[Maxn + 5];
long long l[Maxn + 5];
long long f, T;
inline long long solve() {
  long long lim = f / l[1] + 1LL;
  long long ret = INF;
  for (long long i = 0; i <= lim; i++) {
    long long tim = T - i * l[1] * t[1], data = max(f - i * l[1], 0LL),
              mey = i * p[1];
    if (t[0] <= t[2])
      tim -= data * t[0];
    else {
      tim -= data * t[2];
      long long now = max(0LL, data - tim / (t[0] - t[2]));
      now = now / l[2] + (now % l[2] == 0LL ? 0LL : 1LL);
      mey += now * p[2];
    }
    if (tim >= 0) ret = min(ret, mey);
  }
  return ret;
}
int main() {
  scanf("%I64d%I64d", &f, &T);
  scanf("%I64d", &t[0]);
  for (int i = 1; i <= 2; i++) scanf("%I64d%I64d%I64d", &l[i], &t[i], &p[i]);
  long long mx = min(min(t[1], t[2]), t[0]);
  if (mx * f > T) {
    printf("-1\n");
    return 0;
  }
  long long ans = INF;
  ans = min(solve(), ans);
  swap(t[1], t[2]);
  swap(p[1], p[2]);
  swap(l[1], l[2]);
  ans = min(solve(), ans);
  printf("%I64d\n", ans);
  return 0;
}
