#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(5);
  for (int i = 0; i < 5; i++) cin >> a[i];
  vector<int> b(5);
  for (int i = 0; i < 5; i++) {
    if (a[i] % 10 == 0)
      b[i] = a[i];
    else
      b[i] = a[i] + 10 - a[i] % 10;
  }
  int ans = b[0] + b[1] + b[2] + b[3] + b[4];
  for (int i = 0; i < 5; i++) {
    int x = ans - b[i] + a[i];
    ans = min(ans, x);
  }
  cout << ans << endl;
}
