#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
long long f, T, t0, a1, t1, p1, a2, t2, p2, resF, resT, ans = inf;
int main() {
  cin >> f >> T >> t0 >> a1 >> t1 >> p1 >> a2 >> t2 >> p2;
  if (t1 > t2) swap(a1, a2), swap(p1, p2), swap(t1, t2);
  for (int i = 0; (i - 1) * a1 <= f; ++i) {
    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, (long long)0);
  printf("%lld\n", ans < inf ? ans : -1);
  return 0;
}
