import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		long[] a = new long[n];
		sa = br.readLine().split(" ");
		if (sa.length > 1) {
			System.out.println("assert");
			return;
		}
		a[0] = Long.parseLong(sa[0]);
		a[1] = Long.parseLong(br.readLine());
		a[2] = Long.parseLong(br.readLine());

		long[] b = new long[n];
		b[0] = a[0] + a[1];
		b[1] = a[0] + a[2];
		b[2] = a[1] + a[2];
		Arrays.parallelSort(b);
		if (b[1] == b[2]) {
			System.out.println(b[0]);
		} else {
			System.out.println(b[1]);
		}
	}
}