Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

func main() {
	for sc.Scan() {
		d := Sliceconvtoi()
		fmt.Println(d[0] - d[1] - d[2] + d[3])
	}
}

C++: #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second

signed main(){
	int n,a,b,c;
	cin>>n>>a>>b>>c;
	cout<<(n-(a+b-c))<<endl;
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;

int main(){
    ll n,a,b,c;
    cin>>n>>a>>b>>c;
    cout<<n-a-b+c<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,a,b,c;
    cin>>n>>a>>b>>c;
    cout<<n-(a+b-c)<<endl;
}

C++: #include <bits/stdc++.h>
#define REP(i, a, n) for(ll i=a; i<n; i++)
#define RREP(i, a, n) for(ll i=n-1; i>=a; i--)
typedef long long ll;
const ll mod =1e9+7;
const ll inf =1e18;
using namespace std;


int main(){
    ll n, a, b, c;
    cin>>n>>a>>b>>c;

    cout<<n-(a+b-c)<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  int n, a, b, c;
  cin >> n >> a >> b >> c;
  cout << n-(a+b-c) << endl;
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
#define int long long
signed main() {
	int n, a, b, c; cin >> n >> a >> b >> c;
	cout << n - (a + b - c) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;

#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define abs(a) max((a),-(a))
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repe(i,n) rep(i,(n)+1)
#define per(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define pere(i,n) rep(i,(n)+1)
#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define RET return 0
#define MOD 1000000007
#define INF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n,a,b,c;
  cin >> n >> a >> b >> c;
  cout << n-a-b+c << endl;
  return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <vector>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <list>
#include <bitset>

using namespace std;

int main()
{
    int a, b, c ,d;
    cin >> a >> b >> c >> d;
    cout << a - b - c + d << endl;

    return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define MOD ((int)1e9 + 7)
#define INF ((int)1e9)
#define ALL(x) (x).begin(),(x).end()
#define ctoi(x) (x - 'a') 
#define CTOI(x) (x - 'A')
using namespace std;
int main(){
    int N,A,B,C;
    cin >> N >> A >> B >> C;
    cout << N - A - B + C << endl;
    return 0;
}

C++: #include<iostream> 
#include<string> 
#include<vector> 
#include<algorithm> 
using namespace std; 
int main()
{
	int a, b, c, d; 
	cin >> a >> b >> c >> d; 
	cout << a - (b + c - 1) << endl;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    cout << N-(A+B-C) << endl;
    return 0;
    
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(){
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<a-b-c+d<<endl;
 
  return 0;
}

C++: #include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second



signed main(){
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  int s=c+(a-c)+(b-c);
  cout<<n-s<<endl;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int N, A, B, C;
    cin >> N >> A >> B >> C;
    cout << N-(A+B-C) << endl;
    return 0;
    
}

C++: #include <bits/stdc++.h>
#define f(i,n) for(int i=0;i<(n);i++)
#define P pair<int,int>
#define mod 1000000007
#define S second
#define F first
#define int long long
using namespace std;

signed main(){
	int a,b,c,d;
	in>>a>>b>>c>>d;
	cout<<a+d-b-c<<endl;
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long ni(long long ta, vector<long long> & v) {

}
long long rui(long long n, long long k, long long p) {
	if (k == 0) {
		return 1;
	}
	else {
		long long a = rui(n, k / 2, p);
		if (k % 2 == 0) {
			return (a*a) % p;
		}
		return (((a*a) % p)*n) % p;
	}
}
int main(){
	int n, a, b, c;
	cout <<( n - (a + b)) + c << endl;
	return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define double long double

int n,a,b,c;

void input(){
	cin>>n>>a>>b>>c;
	return;
}

void solve(){
	cout<<n-(a+b-c)<<endl;
	return;
}

int main(){
	input();
	solve();
	return 0;
}

C++: #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);

    cin>>n>>a>>b>>c;
    Cout(n-(a+b-c));
    return 0;
}