#include <bits/stdc++.h>
using namespace std;
long long f, t, t0, a1, t1, p1, a2, t2, p2, _;
int main() {
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d%I64d", &f, &t, &t0, &a1, &t1,
        &p1, &a2, &t2, &p2);
  if (t1 > t2) swap(a1, a2), swap(t1, t2), swap(p1, p2);
  long long ans = (long long)1 << 62;
  for (long long i = 0; a1 * i < f; i++) {
    long long F = f - i * a1, T = t - i * a1 * t1;
    if (F * t2 > T && F * t0 > T) continue;
    if (t0 <= t2 || F * t0 <= T)
      _ = 0;
    else
      _ = ((t0 * F - T + t0 - t2 - 1) / (t0 - t2) + a2 - 1) / a2;
    ans = min(ans, p1 * i + p2 * _);
  }
  if (f * t1 <= t && (f + a1 - 1) / a1 * p1 < ans) ans = (f + a1 - 1) / a1 * p1;
  printf("%I64d\n", (ans != (long long)1 << 62) ? ans : -1);
}
