#include <bits/stdc++.h>
using namespace std;
int a[6], sum, i;
bool cmp(int x, int y) { return x % 10 >= y % 10; }
int main() {
  cin >> a[1] >> a[2] >> a[3] >> a[4] >> a[5];
  sort(a, a + 5, cmp);
  for (i = 0; i < 5; i++) {
    while (sum % 10 != 0) sum++;
    sum += a[i];
  }
  cout << sum;
  return 0;
}
