#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
using namespace std;
void desperate_optimization(int precision) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(precision);
}
long long a[2], t[2], p[2];
const int MAXN = 1e7;
long long list_pay[MAXN + 2], list_pay_l[MAXN + 2];
void hora(int tc) {
  long long f, tmax, to;
  long long res = 1e18;
  cin >> f >> tmax >> to;
  for (int i = 0; i < 2; i++) cin >> a[i] >> t[i] >> p[i];
  long long batas = (f + a[0] - 1) / a[0];
  long long sisa = f, sisa_t = tmax, harga = 0;
  long long cur = a[1], ct = p[1];
  list_pay[0] = 0;
  long long c0 = a[0], ct0 = p[0];
  for (int i = 1; i <= MAXN; i++) {
    if (i > cur) cur += a[1], ct += p[1];
    if (i > c0) c0 += a[0], ct0 += p[0];
    list_pay[i] = ct;
    list_pay_l[i] = ct0;
  }
  for (int i = 0; i <= f; i++) {
    long long lo = 0;
    long long hi = sisa;
    while (hi - lo > 3) {
      long long cut = (hi - lo) / 3;
      long long mid1 = lo + cut;
      long long mid2 = hi - cut;
      long long sisa1 = sisa - mid1;
      long long sisa2 = sisa - mid2;
      if (mid1 * to + sisa1 * t[1] > sisa_t && t[1] <= to) {
        hi = mid1 - 1;
        continue;
      }
      if (mid1 * to + sisa1 * t[1] > sisa_t && t[1] > to) {
        lo = mid1 + 1;
        continue;
      }
      if (mid2 * to + sisa2 * t[1] > sisa_t && t[1] >= to) {
        lo = mid2 + 1;
        continue;
      }
      if (mid2 * to + sisa2 * t[1] > sisa_t && t[1] < to) {
        hi = mid2 - 1;
        continue;
      }
      lo = mid1;
    }
    for (; lo <= hi; lo++) {
      long long sisa1 = sisa - lo;
      if (lo * to + sisa1 * t[1] > sisa_t) continue;
      long long ct = list_pay[sisa1];
      res = min(res, ct + list_pay_l[i]);
    }
    sisa--;
    sisa_t -= t[0];
  }
  if (res == 1e18) res = -1;
  cout << res << '\n';
}
int main() {
  desperate_optimization(10);
  int ntc = 1;
  for (int tc = 1; tc <= ntc; tc++) hora(tc);
  return 0;
}
