import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int e = sc.nextInt();
  int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10;
  ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10);
  System.out.println(ans+40);
}} import java.util.Scanner; Scanner java.util public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int e = sc.nextInt();
  int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10;
  ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10);
  System.out.println(ans+40);
}} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int e = sc.nextInt();
  int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10;
  ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10);
  System.out.println(ans+40);
} main {
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int e = sc.nextInt();
  int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10;
  ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10);
  System.out.println(ans+40);
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int d = sc.nextInt(); d sc.nextInt() sc.nextInt sc int e = sc.nextInt(); e sc.nextInt() sc.nextInt sc int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10; ans a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10 ((d-1)/10)*10 ((c-1)/10)*10 a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10 a ((b-1)/10)*10 ((b-1)/10) (b-1) b 1 10 10 ((c-1)/10)*10 ((c-1)/10) (c-1) c 1 10 10 ((d-1)/10)*10 ((d-1)/10) (d-1) d 1 10 10 ((e-1)/10)*10 ((e-1)/10) (e-1) e 1 10 10 ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10) ans Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10) Math.min Math ans b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10 ((d-1)/10)*10 ((c-1)/10)*10 b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10 b ((a-1)/10)*10 ((a-1)/10) (a-1) a 1 10 10 ((c-1)/10)*10 ((c-1)/10) (c-1) c 1 10 10 ((d-1)/10)*10 ((d-1)/10) (d-1) d 1 10 10 ((e-1)/10)*10 ((e-1)/10) (e-1) e 1 10 10 ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10) ans Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10) Math.min Math ans c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10 ((d-1)/10)*10 ((b-1)/10)*10 c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10 c ((a-1)/10)*10 ((a-1)/10) (a-1) a 1 10 10 ((b-1)/10)*10 ((b-1)/10) (b-1) b 1 10 10 ((d-1)/10)*10 ((d-1)/10) (d-1) d 1 10 10 ((e-1)/10)*10 ((e-1)/10) (e-1) e 1 10 10 ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10) ans Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10) Math.min Math ans d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10 ((b-1)/10)*10 ((c-1)/10)*10 d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10 d ((a-1)/10)*10 ((a-1)/10) (a-1) a 1 10 10 ((c-1)/10)*10 ((c-1)/10) (c-1) c 1 10 10 ((b-1)/10)*10 ((b-1)/10) (b-1) b 1 10 10 ((e-1)/10)*10 ((e-1)/10) (e-1) e 1 10 10 ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10) ans Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10) Math.min Math ans e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10 ((d-1)/10)*10 ((c-1)/10)*10 e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10 e ((a-1)/10)*10 ((a-1)/10) (a-1) a 1 10 10 ((c-1)/10)*10 ((c-1)/10) (c-1) c 1 10 10 ((d-1)/10)*10 ((d-1)/10) (d-1) d 1 10 10 ((b-1)/10)*10 ((b-1)/10) (b-1) b 1 10 10 System.out.println(ans+40) System.out.println System.out System System.out ans+40 ans 40 String[] args args public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int e = sc.nextInt();
  int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10;
  ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10);
  System.out.println(ans+40);
}} public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int e = sc.nextInt();
  int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10;
  ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10);
  System.out.println(ans+40);
}} Main
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  int d = sc.nextInt();
  int e = sc.nextInt();
  int ans = a +  ((b-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10;
  ans = Math.min(ans, b +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, c +  ((a-1)/10)*10 + ((b-1)/10)*10 + ((d-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, d +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((b-1)/10)*10 + ((e-1)/10)*10);
  ans = Math.min(ans, e +  ((a-1)/10)*10 + ((c-1)/10)*10 + ((d-1)/10)*10 + ((b-1)/10)*10);
  System.out.println(ans+40);
}}