#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[5], b[] = {1, 1, 2, 7, 4};
int main() {
  for (int i = 0; i < 5; i++) cin >> a[i];
  int cnt = 0;
  while (1) {
    for (int i = 0; i < 5; i++)
      if (a[i] - b[i] >= 0)
        a[i] -= b[i];
      else {
        cout << cnt;
        return 0;
      }
    cnt++;
  }
  cout << "0";
}
