#include <bits/stdc++.h>
using namespace std;
typedef long double real;
vector<int> a, b;
int main() {
  a.push_back(1);
  a.push_back(1);
  a.push_back(2);
  a.push_back(7);
  a.push_back(4);
  int t;
  while (scanf("%d", &t) == 1) {
    b.push_back(t);
  }
  int ans = -1;
  bool end = false;
  while (!end) {
    for (int i = 0; i < (int)(a).size(); ++i) {
      if (i == 0) {
        ++ans;
      }
      if (b[i] < a[i]) {
        end = true;
        break;
      }
      b[i] -= a[i];
    }
  }
  printf("%d\n", ans);
}
