#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10000;
const int MOD = 1000000007;
const int INF = ((1 << 31) - 1);
int k, n1, n2, n3, t1, t2, t3;
int f1, f2;
int p[MAXN + 5];
int s1[MAXN + 5];
int s2[MAXN + 5];
int pos1, pos2;
int main() {
  scanf("%d%d%d%d%d%d%d", &k, &n1, &n2, &n3, &t1, &t2, &t3);
  for (int i = (0), _for = (k); i < _for; ++i) p[i] = (i / n1 + 1) * t1;
  for (int i = (0), _for = (k); i < _for; ++i) {
    f1 = p[i] + t2;
    f2 = s1[pos1] + t2;
    p[i] = max(f1, f2);
    s1[pos1] = p[i];
    pos1++;
    pos1 %= n2;
  }
  for (int i = (0), _for = (k); i < _for; ++i) {
    f1 = p[i] + t3;
    f2 = s2[pos2] + t3;
    p[i] = max(f1, f2);
    s2[pos2] = p[i];
    pos2++;
    pos2 %= n3;
  }
  printf("%d ", p[k - 1]);
  return 0;
}
