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<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,b,c,n,x;
	scanf("%d %d %d %d",&n,&a,&b,&c);
	x=n-(a+b-c);
	printf("%d\n",x);
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
constexpr int di[] = { 0, 1, 0, -1 }, dj[] = { 1, 0, -1, 0 };
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define sortr(v) sort((v).rbegin(), (v).rend())
#define all(v) (v).begin(), (v).end()
#define max 100005
#define nil -1

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 <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <stdio.h>
#include <vector>
#define int long long
#define endre getchar();getchar();return 0
using namespace std;
bool prime(int n) {
	for (int i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return (y, x%y);
}
int lcm(int x, int y) {
	return x * y / gcd(x, y);
}
int kai(int n) {
	if (n == 0)return 1;
	return kai(n - 1)*n;
}
int mod_pow(int x, int y, int mod) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x%mod;
		}
		x = x * x%mod;
		y >>= 1;
	}
	return res;
}
int n, a, b, c;
signed main() {
	cin >> n >> a >> b >> c;
	cout << (n - (a + b - c)) << endl;
	endre;
}

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<<s<<endl;
}

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;
	cin>>a>>b>>c>>d;
	cout<<a+d-b-c<<endl;
	return 0;
}

C++: #include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



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;

#define int long long

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int a, b, c, d;
  cin >> a >> b >> c >> d;

  cout << a-b-c+d << endl;
  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<math.h>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
#include<map>
#include<set>
#include <string>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
map<string, int> mp;
#define ll long long

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

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(){
	ios::sync_with_stdio(false);
	cin.tie(0);  
	int n, a, b, c;
	while(cin >> n >> a >> b >> c) {
		cout << n - (a + b - c) << endl;
	}
	return 0;	
}

C++: 
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define BIG 1000000010
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
typedef long long int ll;


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

  return 0;
}

C++: #include <iostream>
using namespace std;
int n,a,b,c;
int main(){
cin>>n>>a>>b>>c;
    cout<<n-a-b+c<<endl;
    return 0;
}

C++: #include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <iomanip>

using namespace std;

#define REP(i, n) for(ll i = 0;i < n;i++)
#define REPR(i, n) for(ll i = n;i >= 0;i--)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
#define FORR(i, m, n) for(ll i = m;i >= n;i--)
#define REPO(i, n) for(ll i = 1;i <= n;i++)
#define ll long long
#define INF (ll)1 << 60
#define MINF (-1 * INF)
#define ALL(n) n.begin(),n.end()
#define MOD 1000000007
#define P pair<ll, ll>


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

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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b, c; cin >> n >> a >> b >> c;
    while(c--)
    {
        a--, b--;
        n--;
    }
    cout << n - a - b << 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+d-c-b<<endl;
}

C++: #include <iostream>
using namespace std;

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

C++: #include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define lP pair<ll,ll>
#define iP pair<int,int>

typedef long long ll;
using namespace std;
const int mod = 1e9 + 7;

int N, A, B, C;

int main(){
	cin >> N >> A >> B >> C;
	cout << N - A - B + C << endl;
	return 0;
}

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

#pragma warning(disable:4996)
using namespace std;


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

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define eps LDBL_EPSILON
#define moder 1000000007
#define int long long
#define ll long long
#define INF ((ll)1<<31)-1
#define P std::pair<int,int>
#define prique priority_queue<int,vector<int>,greater<int>>
using namespace std;
int gcd(int a,int b){
	if(!a)return b;
	return gcd(b%a,a);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
signed main(){
	int n,a,b,c;
	cin>>n>>a>>b>>c;
	cout<<n-a-b+c<<endl;
    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <functional>
#include <map>
using namespace std;

int N, A, B, C;

int main() {
	cin >> N >> A >> B >> C;
	cout << N - A - B + C << endl;
	return 0;
}