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