
import java.util. ArrayList;
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        while(sc.hasNext()== true ){
            a.add(sc.nextInt());
        }
        int sumo = 0;
        for (int i =0; i<a.size(); i++){
            sumo += a.get(i);
        }
        sumo -= a.get(0);
        sumo -= a.get(1);
        int ans = a.get(0) - sumo;
        if( a.get(0)< sumo){
            System.out.println(-1);
        }else{
            System.out.println(ans);
        }
    }
} import java.util. ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        while(sc.hasNext()== true ){
            a.add(sc.nextInt());
        }
        int sumo = 0;
        for (int i =0; i<a.size(); i++){
            sumo += a.get(i);
        }
        sumo -= a.get(0);
        sumo -= a.get(1);
        int ans = a.get(0) - sumo;
        if( a.get(0)< sumo){
            System.out.println(-1);
        }else{
            System.out.println(ans);
        }
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        while(sc.hasNext()== true ){
            a.add(sc.nextInt());
        }
        int sumo = 0;
        for (int i =0; i<a.size(); i++){
            sumo += a.get(i);
        }
        sumo -= a.get(0);
        sumo -= a.get(1);
        int ans = a.get(0) - sumo;
        if( a.get(0)< sumo){
            System.out.println(-1);
        }else{
            System.out.println(ans);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        while(sc.hasNext()== true ){
            a.add(sc.nextInt());
        }
        int sumo = 0;
        for (int i =0; i<a.size(); i++){
            sumo += a.get(i);
        }
        sumo -= a.get(0);
        sumo -= a.get(1);
        int ans = a.get(0) - sumo;
        if( a.get(0)< sumo){
            System.out.println(-1);
        }else{
            System.out.println(ans);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) ArrayList<Integer> a = new ArrayList<>(); a new ArrayList<>() while(sc.hasNext()== true ){
            a.add(sc.nextInt());
        } sc.hasNext()== true sc.hasNext() sc.hasNext sc true {
            a.add(sc.nextInt());
        } a.add(sc.nextInt()) a.add a sc.nextInt() sc.nextInt sc int sumo = 0; sumo 0 for (int i =0; i<a.size(); i++){
            sumo += a.get(i);
        } int i =0; int i =0; i 0 i<a.size() i a.size() a.size a i++ i++ i {
            sumo += a.get(i);
        } {
            sumo += a.get(i);
        } sumo += a.get(i) sumo a.get(i) a.get a i sumo -= a.get(0) sumo a.get(0) a.get a 0 sumo -= a.get(1) sumo a.get(1) a.get a 1 int ans = a.get(0) - sumo; ans a.get(0) - sumo a.get(0) a.get a 0 sumo if( a.get(0)< sumo){
            System.out.println(-1);
        }else{
            System.out.println(ans);
        } a.get(0)< sumo a.get(0) a.get a 0 sumo {
            System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 {
            System.out.println(ans);
        } System.out.println(ans) System.out.println System.out System System.out ans String[] args args

import java.util. ArrayList;
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<Integer> a = new ArrayList<>();
        while(sc.hasNext()== true ){
            a.add(sc.nextInt());
        }
        int sumo = 0;
        for (int i =0; i<a.size(); i++){
            sumo += a.get(i);
        }
        sumo -= a.get(0);
        sumo -= a.get(1);
        int ans = a.get(0) - sumo;
        if( a.get(0)< sumo){
            System.out.println(-1);
        }else{
            System.out.println(ans);
        }
    }
}
