#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int bneed, thave, t0;
int a1, t1, c1;
int a2, t2, c2;
void run() {
  scanf("%d%d%d", &bneed, &thave, &t0);
  scanf("%d%d%d", &a1, &t1, &c1);
  scanf("%d%d%d", &a2, &t2, &c2);
  if (t1 > t2) {
    swap(a1, a2);
    swap(t1, t2);
    swap(c1, c2);
  }
  long long ret = LLONG_MAX;
  for (int n1 = 0;; ++n1) {
    int lim1 = min(bneed, thave / t1);
    int b1 = min(n1 * a1, lim1);
    int brem = bneed - b1,
        trem = (int)max(0LL, thave - (long long)n1 * a1 * t1);
    if (t2 < t0) {
      long long b2 =
          (long long)brem * t0 - trem < 0
              ? 0
              : ((long long)brem * t0 - trem + t0 - t2 - 1) / (t0 - t2);
      if (b2 <= brem) {
        int n2 = (b2 + a2 - 1) / a2;
        long long cur = (long long)n1 * c1 + (long long)n2 * c2;
        ret = min(ret, cur);
      }
    } else {
      if ((long long)brem * t0 <= trem) {
        long long cur = (long long)n1 * c1;
        ret = min(ret, cur);
      }
    }
    if (n1 * a1 >= lim1) break;
  }
  printf("%lld\n", ret == LLONG_MAX ? -1 : ret);
}
int main() {
  run();
  return 0;
}
