import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        String strN[] = new String[5];

        PrintWriter out = new PrintWriter(System.out);
        try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        }


    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.PrintWriter; PrintWriter java.io public class Main {

    public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        String strN[] = new String[5];

        PrintWriter out = new PrintWriter(System.out);
        try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        }


    }

} Main public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        String strN[] = new String[5];

        PrintWriter out = new PrintWriter(System.out);
        try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        }


    } main {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        String strN[] = new String[5];

        PrintWriter out = new PrintWriter(System.out);
        try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        }


    } InputStreamReader isr = new InputStreamReader(System.in); isr new InputStreamReader(System.in) BufferedReader br = new BufferedReader(isr); br new BufferedReader(isr) String strN[] = new String[5]; strN new String[5] 5 PrintWriter out = new PrintWriter(System.out); out new PrintWriter(System.out) try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        } catch (IOException e) {

        } IOException e {

        } {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	} int i=0 ; int i=0 ; i 0 i < 5 i 5 i++ i++ i {
        		strN[i] = br.readLine();
        	} {
        		strN[i] = br.readLine();
        	} strN[i] = br.readLine() strN[i] strN i br.readLine() br.readLine br int intN[] = new int[5]; intN new int[5] 5 int intMod[] = new int[5]; intMod new int[5] 5 int intSum=0; intSum 0 for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	} int i=0 ; int i=0 ; i 0 i < 5 i 5 i++ i++ i {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	} {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	} intN[i] = Integer.parseInt(strN[i]) intN[i] intN i Integer.parseInt(strN[i]) Integer.parseInt Integer strN[i] strN i intMod[i] = intN[i] % 10 intMod[i] intMod i intN[i] % 10 intN[i] intN i 10 intSum += intN[i] - intMod[i] intSum intN[i] - intMod[i] intN[i] intN i intMod[i] intMod i if (intMod[i] != 0) intSum +=10; intMod[i] != 0 intMod[i] intMod i 0 intSum +=10 intSum 10 int intMin = intMod[0]; intMin intMod[0] intMod 0 if (intMin == 0)	intMin = 9; intMin == 0 intMin 0 intMin = 9 intMin 9 int j= 0; j 0 for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	} int i=1 ; int i=1 ; i 1 i<5 i 5 i++ i++ i {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	} {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	} if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		} intMin > intMod[i] && intMod[i] !=0 intMin > intMod[i] intMin intMod[i] intMod i intMod[i] !=0 intMod[i] intMod i 0 {
        			intMin = intMod[i];
        			j = i;
        		} intMin = intMod[i] intMin intMod[i] intMod i j = i j i if (intMod[j] != 0) intSum -= (10 - intMod[j]); intMod[j] != 0 intMod[j] intMod j 0 intSum -= (10 - intMod[j]) intSum (10 - intMod[j]) 10 intMod[j] intMod j System.out.println(intSum) System.out.println System.out System System.out intSum out.flush() out.flush out String[] args args public class Main {

    public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        String strN[] = new String[5];

        PrintWriter out = new PrintWriter(System.out);
        try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        }


    }

} public class Main {

    public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        String strN[] = new String[5];

        PrintWriter out = new PrintWriter(System.out);
        try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        }


    }

} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {

    public static void main(String[] args) {

        InputStreamReader isr = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(isr);

        String strN[] = new String[5];

        PrintWriter out = new PrintWriter(System.out);
        try {

        	for (int i=0 ; i < 5 ; i++) {
        		strN[i] = br.readLine();
        	}

        	int intN[] = new int[5];
        	int intMod[] = new int[5];

        	int intSum=0;
        	for (int i=0 ; i < 5 ; i++) {
        		intN[i] = Integer.parseInt(strN[i]);
        		intMod[i] = intN[i] % 10;
        		intSum += intN[i] - intMod[i];
        		if (intMod[i] != 0) intSum +=10;

        	}

        	int intMin = intMod[0];
        	if (intMin == 0)	intMin = 9;

        	int j= 0;
        	for (int i=1 ; i<5 ; i++) {
        		if (intMin > intMod[i] && intMod[i] !=0) {
        			intMin = intMod[i];
        			j = i;
        		}
        	}

        	if (intMod[j] != 0) intSum -= (10 - intMod[j]);

    		System.out.println(intSum);


            out.flush();


        } catch (IOException e) {

        }


    }

}