#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, c, d, e;
  cin >> a >> b >> c >> d >> e;
  int a1, b1, c1, d1, e1;
  int a2, b2, c2, d2, e2;
  a1 = a % 10;
  a2 = a / 10;
  if (a1 != 0) a2++;
  b1 = b % 10;
  b2 = b / 10;
  if (b1 != 0) b2++;
  c1 = c % 10;
  c2 = c / 10;
  if (c1 != 0) c2++;
  d1 = d % 10;
  d2 = d / 10;
  if (d1 != 0) d2++;
  e1 = e % 10;
  e2 = e / 10;
  if (e1 != 0) e2++;
  int hasuu;
  int kotae;
  if (a1 + b1 + c1 + d1 + e1 == 0) {
    hasuu = 0;
    kotae = (a2 + b2 + c2 + d2 + e2) * 10;
    cout << kotae << endl;
    return 0;
  } else {
    if (a1 == 0) a1 = INT_MAX;
    if (b1 == 0) a1 = INT_MAX;
    if (c1 == 0) a1 = INT_MAX;
    if (d1 == 0) a1 = INT_MAX;
    if (e1 == 0) a1 = INT_MAX;
    hasuu = min({a1, b1, c1, d1, e1});
    kotae = (a2 + b2 + c2 + d2 + e2) * 10 + hasuu - 10;
    cout << kotae << endl;
    return 0;
  }
}
