#include <bits/stdc++.h>
using namespace std;
bool acompare(int a, int b) { return a % 10 > b % 10; }
int main() {
  int a, b, c, d, e;
  int i;
  cin >> a >> b >> c >> d >> e;
  vector<int> v;
  vector<int> v2;
  v.push_back(a);
  v.push_back(b);
  v.push_back(c);
  v.push_back(d);
  v.push_back(e);
  int dishes[5] = {a, b, c, d, e};
  int a_mod10 = a % 10;
  int b_mod10 = b % 10;
  int c_mod10 = c % 10;
  int d_mod10 = d % 10;
  int e_mod10 = e % 10;
  int flag[5] = {0, 0, 0, 0, 0};
  if (a_mod10 == 0) flag[0] = 1;
  if (b_mod10 == 0) flag[1] = 1;
  if (c_mod10 == 0) flag[2] = 1;
  if (d_mod10 == 0) flag[3] = 1;
  if (e_mod10 == 0) flag[4] = 1;
  int sum = 0;
  for (i = 0; i < 5; i++) {
    if (flag[i] == 1) {
      sum += v[i];
    } else {
      v2.push_back(v[i]);
    }
  }
  sort(v2.begin(), v2.end(), acompare);
  for (i = 0; i < v2.size() - 1; i++) {
    sum += v2[i] + (10 - v2[i] % 10);
  }
  sum += v2[v2.size() - 1];
  cout << sum << endl;
  return 0;
}
