#include <bits/stdc++.h>
using namespace std;
int ceil1(int a) {
  if (a % 10 != 0)
    return (a / 10) * 10 + 10;
  else
    return a;
}
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int ans1 = a + ceil1(b) + ceil1(c) + ceil1(d) + ceil1(e);
  int ans2 = ceil1(a) + b + ceil1(c) + ceil1(d) + ceil1(e);
  int ans3 = ceil1(a) + ceil1(b) + c + ceil1(d) + ceil1(e);
  int ans4 = ceil1(a) + ceil1(b) + ceil1(c) + d + ceil1(e);
  int ans5 = ceil1(a) + ceil1(b) + ceil1(c) + ceil1(d) + e;
  vector<int> ans;
  ans.push_back(ans1);
  ans.push_back(ans2);
  ans.push_back(ans3);
  ans.push_back(ans4);
  ans.push_back(ans5);
  sort(ans.begin(), ans.end());
  cout << ans[0] << endl;
}
