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