#include <bits/stdc++.h>
using namespace std;

void solve () {
    long long n;
    cin >> n;
    long long mn = 1e15 + 1;
    long long pos = 0;
    for (int i = 0; i < 5; i++) {
        long long x;
        cin >> x;
        if (mn > x) {
            pos = i;
            mn = x;
        }
    }
    cout << (n % mn > 0) + (n / mn) + (4ll - pos) + pos;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
    return 0;
}

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main(){
  int h1, m1, h2, m2, k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  int hour;
  int min;

  int t1, t2, t3;
  t3 = h2 * 60 + m2;
  t2 = t3 - k;
  t1 = h1 * 60 + m1;

  int ans;
  
  ans = t2 - t1;

  cout << ans << endl;


}