import java.util.Scanner;

import java.util.InputMismatchException;

public class Main{
    public static void main(String args[]){
        int time[] = new int[5];

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        int extraTimes[] = new int[5];
        int tenTimes[] = new int[5];
        int extraTimesMin = 10;
        int minIndex = 0;
        for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        }

        int totalTime = 0;
        for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        }
        totalTime += time[minIndex];
        System.out.println(totalTime);
    }
} import java.util.Scanner; Scanner java.util import java.util.InputMismatchException; InputMismatchException java.util public class Main{
    public static void main(String args[]){
        int time[] = new int[5];

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        int extraTimes[] = new int[5];
        int tenTimes[] = new int[5];
        int extraTimesMin = 10;
        int minIndex = 0;
        for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        }

        int totalTime = 0;
        for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        }
        totalTime += time[minIndex];
        System.out.println(totalTime);
    }
} Main public static void main(String args[]){
        int time[] = new int[5];

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        int extraTimes[] = new int[5];
        int tenTimes[] = new int[5];
        int extraTimesMin = 10;
        int minIndex = 0;
        for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        }

        int totalTime = 0;
        for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        }
        totalTime += time[minIndex];
        System.out.println(totalTime);
    } main {
        int time[] = new int[5];

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        int extraTimes[] = new int[5];
        int tenTimes[] = new int[5];
        int extraTimesMin = 10;
        int minIndex = 0;
        for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        }

        int totalTime = 0;
        for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        }
        totalTime += time[minIndex];
        System.out.println(totalTime);
    } int time[] = new int[5]; time new int[5] 5 try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        } catch(InputMismatchException e){
            System.out.println(e);
        } InputMismatchException e {
            System.out.println(e);
        } System.out.println(e) System.out.println System.out System System.out e {
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            } int i = 0; int i = 0; i 0 i < time.length i time.length time time.length i++ i++ i {
                time[i] = scanner.nextInt();
            } {
                time[i] = scanner.nextInt();
            } time[i] = scanner.nextInt() time[i] time i scanner.nextInt() scanner.nextInt scanner scanner.close() scanner.close scanner int extraTimes[] = new int[5]; extraTimes new int[5] 5 int tenTimes[] = new int[5]; tenTimes new int[5] 5 int extraTimesMin = 10; extraTimesMin 10 int minIndex = 0; minIndex 0 for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        } int i = 0; int i = 0; i 0 i < extraTimes.length i extraTimes.length extraTimes extraTimes.length i++ i++ i {
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        } {
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        } extraTimes[i] = time[i] % 10 extraTimes[i] extraTimes i time[i] % 10 time[i] time i 10 tenTimes[i] = time[i] / 10 tenTimes[i] tenTimes i time[i] / 10 time[i] time i 10 if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            } extraTimes[i] < extraTimesMin && extraTimes[i] != 0 extraTimes[i] < extraTimesMin extraTimes[i] extraTimes i extraTimesMin extraTimes[i] != 0 extraTimes[i] extraTimes i 0 {
                extraTimesMin = extraTimes[i];
                minIndex = i;
            } extraTimesMin = extraTimes[i] extraTimesMin extraTimes[i] extraTimes i minIndex = i minIndex i int totalTime = 0; totalTime 0 for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        } int i = 0; int i = 0; i 0 i < time.length i time.length time time.length i++ i++ i {
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        } {
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        } if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            } i != minIndex i minIndex {
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            } totalTime += tenTimes[i] * 10 totalTime tenTimes[i] * 10 tenTimes[i] tenTimes i 10 if(extraTimes[i] != 0){
                    totalTime += 10;
                } extraTimes[i] != 0 extraTimes[i] extraTimes i 0 {
                    totalTime += 10;
                } totalTime += 10 totalTime 10 totalTime += time[minIndex] totalTime time[minIndex] time minIndex System.out.println(totalTime) System.out.println System.out System System.out totalTime String args[] args public class Main{
    public static void main(String args[]){
        int time[] = new int[5];

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        int extraTimes[] = new int[5];
        int tenTimes[] = new int[5];
        int extraTimesMin = 10;
        int minIndex = 0;
        for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        }

        int totalTime = 0;
        for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        }
        totalTime += time[minIndex];
        System.out.println(totalTime);
    }
} public class Main{
    public static void main(String args[]){
        int time[] = new int[5];

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        int extraTimes[] = new int[5];
        int tenTimes[] = new int[5];
        int extraTimesMin = 10;
        int minIndex = 0;
        for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        }

        int totalTime = 0;
        for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        }
        totalTime += time[minIndex];
        System.out.println(totalTime);
    }
} Main
import java.util.Scanner;

import java.util.InputMismatchException;

public class Main{
    public static void main(String args[]){
        int time[] = new int[5];

        try{
            Scanner scanner = new Scanner(System.in);
            for(int i = 0; i < time.length; i++){
                time[i] = scanner.nextInt();
            }
            scanner.close();
        } catch(InputMismatchException e){
            System.out.println(e);
        }

        int extraTimes[] = new int[5];
        int tenTimes[] = new int[5];
        int extraTimesMin = 10;
        int minIndex = 0;
        for(int i = 0; i < extraTimes.length; i++){
            extraTimes[i] = time[i] % 10;
            tenTimes[i] = time[i] / 10;
            if(extraTimes[i] < extraTimesMin && extraTimes[i] != 0){
                extraTimesMin = extraTimes[i];
                minIndex = i;
            }
        }

        int totalTime = 0;
        for(int i = 0; i < time.length; i++){
            if(i != minIndex){
                totalTime += tenTimes[i] * 10;
                if(extraTimes[i] != 0){
                    totalTime += 10;
                }
            }
        }
        totalTime += time[minIndex];
        System.out.println(totalTime);
    }
}
