#include <bits/stdc++.h>
using namespace std;
long long f, t, t0, a1, t1, p1, a2, t2, p2, i, j, ff, tt, mmin, tmp;
int main() {
  cin >> f >> t >> t0;
  cin >> a1 >> t1 >> p1;
  cin >> a2 >> t2 >> p2;
  mmin = (long long)1 << 62;
  if (t1 > t2) {
    tmp = t1;
    t1 = t2;
    t2 = tmp;
    tmp = a1;
    a1 = a2;
    a2 = tmp;
    tmp = p1;
    p1 = p2;
    p2 = tmp;
  }
  for (i = 0; a1 * i < f; i++) {
    ff = f - i * a1;
    tt = t - i * a1 * t1;
    if (ff * t2 > tt && ff * t0 > tt) continue;
    if (t0 <= t2 || ff * t0 <= tt)
      j = 0;
    else
      j = ((t0 * ff - tt + t0 - t2 - 1) / (t0 - t2) + a2 - 1) / a2;
    if (p1 * i + p2 * j < mmin) mmin = p1 * i + p2 * j;
  }
  if (f * t1 <= t && (f + a1 - 1) / a1 * p1 < mmin)
    mmin = (f + a1 - 1) / a1 * p1;
  if (mmin != (long long)1 << 62)
    cout << mmin << endl;
  else
    cout << -1 << endl;
}
