#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + c - 48;
    c = getchar();
  }
  return x * f;
}
int main() {
  long long F = read(), T = read();
  long long t0 = read();
  long long a1 = read(), t1 = read(), p1 = read();
  long long a2 = read(), t2 = read(), p2 = read();
  if (t1 > t2) swap(t1, t2), swap(a1, a2), swap(p1, p2);
  long long ans = 1e18;
  for (int i = 0; (i - 1) * a1 <= F; ++i) {
    long long resF = F - min(i * a1, F), resT = T - min(i * a1, F) * t1;
    if (resF == 0) {
      if (resT < 0) break;
      ans = min(ans, i * p1);
      break;
    }
    if (t0 * resF > resT && t2 * resF > resT) continue;
    if (t0 * resF <= resT)
      ans = min(ans, i * p1);
    else {
      long long x = (resT - t0 * resF) / (t2 - t0) +
                    ((resT - t0 * resF) % (t2 - t0) == 0 ? 0 : 1);
      long long pk = (x / a2) + (x % a2 == 0 ? 0 : 1);
      ans = min(ans, pk * p2 + i * p1);
    }
  }
  ans = max(ans, 0ll);
  printf("%lld\n", ans < 1e18 ? ans : -1);
  return 0;
}
