#include using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; using uint = unsigned int; using vi = vector; using vb = vector; using vd = vector; using vl = vector; using vvi = vector; using vvb = vector; using vvd = vector; using vvl = vector; #define REP(i,n) for(ll i=0; i<(n); ++i) int main() { cin.tie(0); ios_base::sync_with_stdio(false); cout << fixed << setprecision(30); ll n; cin >> n; vl a(n); REP(i, n) cin >> a[i]; ll w; cin >> w; ll sum = 0; REP(i, n) sum += a[i]; cout << sum - w << endl; return 0; }