#include "bits/stdc++.h" using namespace std; #define rt return #define FOR(i,j,k) for(int i=j; i<(int)k;++i) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define mt make_tuple #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; int main(){ ios::sync_with_stdio(0); cin.tie(0); int N; while(cin >> N){ vi A(N); rep(i, N)cin >> A[i]; int sm = accumulate(all(A), 0), v; cin >> v; cout << sm - v << endl; } }