#include <bits/stdc++.h>
using namespace std;

int main(){
    int lor = 10;
    int ttime = 0;
    for(int i = 0; i < 5; i++){
        int x;
        scanf("%d", &x);
        ttime += (x-1)/10+1;
        if(x%10 != 0)lor = min(lor, x%10);
    }
    printf("%d", ttime*10-10+lor);
}
