#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long n, k, t, a1, a2, t1, t2, p1, p2;
long long times(long long u, long long v) {
  long long rem = n - u * a1 - v * a2;
  if (rem >= 0) return u * a1 * t1 + v * a2 * t2 + rem * t;
  long long res = u * a1 * t1 + v * a2 * t2;
  long long r1 = u * a1;
  long long r2 = v * a2;
  while (rem < 0) {
    rem++;
    if (r1 == 0) {
      r2--, res -= t2;
      continue;
    } else if (r2 == 0) {
      r1--, res -= t1;
      continue;
    }
    if (t1 < t2)
      res -= t2, r2--;
    else
      res -= t1, r1--;
  }
  return res;
}
long long check(long long u) {
  long long sum = u * p1;
  long long rem = n - u * a1;
  long long tim = u * a1 * t1;
  long long L = 0;
  long long R = rem / a2 + 1;
  R = max(R, 1LL);
  if (t2 < t) {
    while (L < R) {
      long long M = (L + R) / 2;
      if (times(u, M) > k)
        L = M + 1;
      else
        R = M;
    }
  }
  if (times(u, L) > k) return -1;
  return u * p1 + L * p2;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k >> t;
  cin >> a1 >> t1 >> p1;
  cin >> a2 >> t2 >> p2;
  if (t1 > t2) swap(t1, t2), swap(a1, a2), swap(p1, p2);
  long long l = 0;
  long long r = n / a1 + 1;
  if (t1 < t) {
    while (l < r) {
      long long m = (l + r) / 2;
      long long val1 = check(m);
      long long val2 = check(m + 1);
      if (val1 < 0)
        l = m + 1;
      else {
        if (val2 < 0)
          r = m;
        else if (val2 >= val1)
          r = m;
        else
          l = m + 1;
      }
    }
  }
  long long ans = -1;
  for (long long i = max(0LL, l - 1000000); i <= min(l + 1000000, n / a1 + 1);
       i++) {
    long long val = check(i);
    if (val >= 0) {
      if (ans == -1)
        ans = val;
      else
        ans = min(ans, val);
    }
  }
  cout << ans;
}
