#include <bits/stdc++.h>
using namespace std;
int main() {
  int mi[5];
  for (int i = 0; i < 5; i++) cin >> mi[i];
  int min, la;
  la = 0;
  min = 10;
  for (int i = 0; i < 5; i++) {
    if (min > mi[i] % 10 && mi[i] % 10 > 0) {
      min = mi[i] % 10;
      la = i;
    }
  }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    int k = mi[i] / 10;
    if (mi[i] % 10) k++;
    ans += k;
    mi[i] = k;
  }
  ans -= 10;
  ans += min;
  cout << ans << endl;
}
