#include<bits/stdc++.h>
using namespace std;
inline int read(){
    int res=0;
    char c;
    bool zf=0;
    while(((c=getchar())<'0'||c>'9')&&c!= '-');
    if(c=='-')zf=1;
    else res=c-'0';
    while((c=getchar())>='0'&&c<='9')res=(res<<3)+(res<<1)+c-'0';
    if(zf)return -res;
    return res;
}
signed main(){
	cout<<read()-read()+read(); 
	return 0;
}
#include <iostream>
using namespace  std;
int main() {
	int N;
	int A[4];
	N = 4;
	int ans;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		if (i == 0) {
			ans = A[0];
		}
		else {
			if (ans > A[i]) {
				ans = A[i];
			}
		}
	}	
	cout << ans << endl;
}