import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    }
} import java.util.*; util.* java public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    } main {
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int[] P = new int[3]; P new int[3] 3 P[0] = sc.nextInt() P[0] P 0 sc.nextInt() sc.nextInt sc int min = P[0]; min P[0] P 0 int max = P[0]; max P[0] P 0 int ans = 0; ans 0 for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        } int i=1; int i=1; i 1 i<3 i 3 i++ i++ i {
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        } {
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        } P[i] = sc.nextInt() P[i] P i sc.nextInt() sc.nextInt sc int m = min; m min min = Math.min(max, P[i]) min Math.min(max, P[i]) Math.min Math max P[i] P i max = Math.max(m, P[i]) max Math.max(m, P[i]) Math.max Math m P[i] P i ans += min ans min System.out.println(ans) System.out.println System.out System System.out ans String[] args args public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    }
} public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    }
} Main
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int[] P = new int[3];
        P[0] = sc.nextInt();
        int min = P[0];
        int max = P[0];
        int ans = 0;

        for(int i=1; i<3; i++){
            P[i] = sc.nextInt();
            int m = min;
            min = Math.min(max, P[i]);
            max = Math.max(m, P[i]);
            ans += min;
        }
        System.out.println(ans);
    }
}