#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int main() {
  int dish[5], fd[5];
  for (int i = 0; i < 5; i++) cin >> dish[i];
  for (int i = 0; i < 5; i++) fd[i] = dish[i] % 10;
  int mn = 9;
  int index;
  for (int i = 0; i < 5; i++)
    if (fd[i] < mn) {
      mn = fd[i];
      index = i;
    }
  int ans = 0;
  for (int i = 0; i < 5; i++) {
    if (i == index)
      continue;
    else
      ans += dish[i] + 10 - fd[i];
  }
  ans += dish[index];
  cout << ans << endl;
}
