#include <bits/stdc++.h>
#pragma warning(disable : 4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;
int IT_MAX = 1 << 19;
const long long MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long LL_INF = 0x1f3f3f3f3f3f3f3f;
const double PI = acos(-1);
const double ERR = 1e-12;
int main() {
  long long F, T, t0;
  long long a1, t1, p1;
  long long a2, t2, p2, i;
  scanf("%lld %lld %lld %lld %lld %lld %lld %lld %lld", &F, &T, &t0, &a1, &t1,
        &p1, &a2, &t2, &p2);
  t1 = min(t1, t0);
  t2 = min(t2, t0);
  if (t1 < t2) {
    swap(a1, a2);
    swap(t1, t2);
    swap(p1, p2);
  }
  if (F * t0 <= T) return !printf("0\n");
  if (t2 == t0) return !printf("-1\n");
  long long ans = LL_INF;
  for (i = 0; (i - 1) * a2 < F; i++) {
    long long y = i, x = (F - a2 * y + a1 - 1) / a1;
    long long v2 = min(a2 * y, F);
    long long v1 = F - v2;
    if (v1 * t1 + v2 * t2 <= T) ans = min(ans, x * p1 + y * p2);
  }
  for (i = 0; i * a2 <= F; i++) {
    long long y = i;
    long long xmx = (F - i * a2) / a1;
    long long q1 = a1 * (t0 - t1), q2 = F * t0 - T - a2 * y * (t0 - t2);
    long long xmn = 0;
    if (q2 <= 0)
      xmn = 0;
    else if (q1 == 0)
      xmn = LL_INF;
    else
      xmn = (q2 + q1 - 1) / q1;
    if (xmn > xmx) continue;
    ans = min(ans, xmn * p1 + y * p2);
  }
  if (ans == LL_INF) ans = -1;
  return !printf("%lld\n", ans);
}
