#include using namespace std; #define rep(i,n) for(long long i = 0; i < (long long)(n); i++) #define pb push_back #define all(x) (x).begin(), (x).end() template bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); } template bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); } template ostream &operator<<(ostream &o, const pair &v) { o << "(" << v.first << ", " << v.second << ")"; return o; } template ostream &operator<<(ostream &o, const vector &v) { if (!v.empty()) { o << '['; copy(v.begin(), v.end(), ostream_iterator(o, ", ")); o << "\b\b]"; } return o; } using ll = long long; using ld = long double; using vll = vector; using vld = vector; typedef pair P; static const double EPS = 1e-14; static const long long INF = 1e18; #define MAX_N 100005 int main(void) { cin.tie(0); ios::sync_with_stdio(false); ll n; cin >> n; vll a(n); rep(i, a.size()) cin >> a[i]; ll m; cin >> m; cout << accumulate(all(a), (ll)0) - m << endl; return 0; }