#include <bits/stdc++.h>
using namespace std;
const int INF = 1001001001;
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++) {
    b[i] = a[i] % 10;
  }
  vector<int> c(5);
  int sum_1 = 0;
  ;
  for (int i = 0; i < (5); i++) {
    c[i] = a[i] - b[i];
    sum_1 += c[i];
  };
  for (int i = 0; i < (5); i++)
    if (b[i] != 0)
      b[i] = b[i];
    else
      b[i] = INF;
  sort(b.begin(), b.end(), greater<int>());
  int sum_2 = 0;
  for (int i = 0; i < (4); i++) {
    if (b[i] != 0) sum_2 += 10;
  }
  sum_2 += b[4];
  cout << sum_1 + sum_2 << endl;
}
