import java.util.ArrayList;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> timelist = new ArrayList<>();
        ArrayList<Integer> firstdigits = new ArrayList<>();
        int tempval = 0;
        int amountOfTime = 0;
        boolean lastOrder = false;
        int lastOrderTime = 0;
        
        for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        }
        Collections.sort(firstdigits);
        
        loop:for(int i=0; i<5; i++){
            if(firstdigits.get(i)!=0){
                lastOrderTime = firstdigits.get(i);
                break loop;
            }        
        }
        
        for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        }
        System.out.println(amountOfTime);
    }
} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util import java.util.Arrays; Arrays java.util import java.util.Collections; Collections java.util public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> timelist = new ArrayList<>();
        ArrayList<Integer> firstdigits = new ArrayList<>();
        int tempval = 0;
        int amountOfTime = 0;
        boolean lastOrder = false;
        int lastOrderTime = 0;
        
        for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        }
        Collections.sort(firstdigits);
        
        loop:for(int i=0; i<5; i++){
            if(firstdigits.get(i)!=0){
                lastOrderTime = firstdigits.get(i);
                break loop;
            }        
        }
        
        for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        }
        System.out.println(amountOfTime);
    }
} Main public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> timelist = new ArrayList<>();
        ArrayList<Integer> firstdigits = new ArrayList<>();
        int tempval = 0;
        int amountOfTime = 0;
        boolean lastOrder = false;
        int lastOrderTime = 0;
        
        for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        }
        Collections.sort(firstdigits);
        
        loop:for(int i=0; i<5; i++){
            if(firstdigits.get(i)!=0){
                lastOrderTime = firstdigits.get(i);
                break loop;
            }        
        }
        
        for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        }
        System.out.println(amountOfTime);
    } main {
        
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> timelist = new ArrayList<>();
        ArrayList<Integer> firstdigits = new ArrayList<>();
        int tempval = 0;
        int amountOfTime = 0;
        boolean lastOrder = false;
        int lastOrderTime = 0;
        
        for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        }
        Collections.sort(firstdigits);
        
        loop:for(int i=0; i<5; i++){
            if(firstdigits.get(i)!=0){
                lastOrderTime = firstdigits.get(i);
                break loop;
            }        
        }
        
        for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        }
        System.out.println(amountOfTime);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> timelist = new ArrayList<>(); timelist new ArrayList<>() ArrayList<Integer> firstdigits = new ArrayList<>(); firstdigits new ArrayList<>() int tempval = 0; tempval 0 int amountOfTime = 0; amountOfTime 0 boolean lastOrder = false; lastOrder false int lastOrderTime = 0; lastOrderTime 0 for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        } {
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        } tempval = sc.nextInt() tempval sc.nextInt() sc.nextInt sc firstdigits.add(tempval%10) firstdigits.add firstdigits tempval%10 tempval 10 timelist.add(tempval) timelist.add timelist tempval Collections.sort(firstdigits) Collections.sort Collections firstdigits for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        } int i=0; int i=0; i 0 i<5 i 5 i++ i++ i {
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        } {
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        } if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            } lastOrder==false && (timelist.get(i)%10==lastOrderTime) lastOrder==false lastOrder false (timelist.get(i)%10==lastOrderTime) timelist.get(i)%10 timelist.get(i) timelist.get timelist i 10 lastOrderTime {
                lastOrder = true;
                amountOfTime += timelist.get(i);
            } lastOrder = true lastOrder true amountOfTime += timelist.get(i) amountOfTime timelist.get(i) timelist.get timelist i if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            } timelist.get(i)%10!=0 timelist.get(i)%10 timelist.get(i) timelist.get timelist i 10 0 {
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            } amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10)) amountOfTime (timelist.get(i) + (10-timelist.get(i)%10)) timelist.get(i) timelist.get timelist i (10-timelist.get(i)%10) 10 timelist.get(i)%10 timelist.get(i) timelist.get timelist i 10 {
                amountOfTime += timelist.get(i);
            } amountOfTime += timelist.get(i) amountOfTime timelist.get(i) timelist.get timelist i System.out.println(amountOfTime) System.out.println System.out System System.out amountOfTime String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> timelist = new ArrayList<>();
        ArrayList<Integer> firstdigits = new ArrayList<>();
        int tempval = 0;
        int amountOfTime = 0;
        boolean lastOrder = false;
        int lastOrderTime = 0;
        
        for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        }
        Collections.sort(firstdigits);
        
        loop:for(int i=0; i<5; i++){
            if(firstdigits.get(i)!=0){
                lastOrderTime = firstdigits.get(i);
                break loop;
            }        
        }
        
        for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        }
        System.out.println(amountOfTime);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> timelist = new ArrayList<>();
        ArrayList<Integer> firstdigits = new ArrayList<>();
        int tempval = 0;
        int amountOfTime = 0;
        boolean lastOrder = false;
        int lastOrderTime = 0;
        
        for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        }
        Collections.sort(firstdigits);
        
        loop:for(int i=0; i<5; i++){
            if(firstdigits.get(i)!=0){
                lastOrderTime = firstdigits.get(i);
                break loop;
            }        
        }
        
        for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        }
        System.out.println(amountOfTime);
    }
} Main
import java.util.ArrayList;
import java.util.Scanner;
import java.util.Arrays;
import java.util.Collections;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> timelist = new ArrayList<>();
        ArrayList<Integer> firstdigits = new ArrayList<>();
        int tempval = 0;
        int amountOfTime = 0;
        boolean lastOrder = false;
        int lastOrderTime = 0;
        
        for(int i=0; i<5; i++){
            tempval = sc.nextInt();
            firstdigits.add(tempval%10);
            timelist.add(tempval);
        }
        Collections.sort(firstdigits);
        
        loop:for(int i=0; i<5; i++){
            if(firstdigits.get(i)!=0){
                lastOrderTime = firstdigits.get(i);
                break loop;
            }        
        }
        
        for(int i=0; i<5; i++){
            if(lastOrder==false && (timelist.get(i)%10==lastOrderTime)){
                lastOrder = true;
                amountOfTime += timelist.get(i);
            }
            else if(timelist.get(i)%10!=0){
                amountOfTime += (timelist.get(i) + (10-timelist.get(i)%10));
            }
            else{
                amountOfTime += timelist.get(i);
            }
        }
        System.out.println(amountOfTime);
    }
}