#include using namespace std; int main() { int s; cin >> s; for (int i = 1; i <= 5; i++) { int x; cin >> x; s -= x; } cout << s << endl; return 0; }