#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e, k = 0;
  cin >> a >> b >> c >> d >> e;
  if (a % 10 != 0) k = a % 10;
  if (b % 10 != 0 && b % 10 < k) k = b % 10;
  if (c % 10 != 0 && c % 10 < k) k = c % 10;
  if (d % 10 != 0 && d % 10 < k) k = d % 10;
  if (e % 10 != 0 && e % 10 < k) k = e % 10;
  while (a % 10 != 0) a++;
  while (b % 10 != 0) b++;
  while (c % 10 != 0) c++;
  while (d % 10 != 0) d++;
  while (e % 10 != 0) e++;
  cout << a + b + c + d + e - 10 + k;
  return 0;
}
