Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		sum := io.NextInt();
		if sum == 0 {
			break
		}
		for i := 0; i < 9; i++ {
			sum -= io.NextInt()
		}
		io.Println(sum)
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include<bits/stdc++.h>
using namespace std;

int main(){
  int a ,c,sum,ans;
  int b[9] ={};
  sum =0;

  cin >> a;

  for(int i=0;i<9;i++){
    cin >> b[i];
  }

  cin >> c;

  for(int i=0;i<9;i++){
    sum += b[i];
  }

  ans = a -sum;

  cout << ans << endl;

}

C++: #include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
	int s[3][3],e[3][3],st,et,gt;
	for(int i=0;i<3;i++)
	{
		cin>>s[i][0]>>s[i][1]>>s[i][2]>>e[i][0]>>e[i][1]>>e[i][2];
	}
	for(int i=0;i<3;i++)
	{
		st=s[i][0]*3600+s[i][1]*60+s[i][2];
		et=e[i][0]*3600+e[i][1]*60+e[i][2];
		gt=et-st;
		cout<<gt/3600<<" "<<(gt%3600)/60<<" "<<(gt%3600%60)<<endl;
	}
	
	return 0;
}

C++: #include <bits/stdc++.h>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};


int main() {

    int s, a1, a2, a3, a4, a5, a6, a7, a8, a9;
    cin >> s >> a1 >> a2 >> a3 >> a4 >> a5 >> a6 >> a7 >> a8 >> a9;

    int ans = s - (a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9);
    cout << ans << endl;
    return 0;
}

C++: #include<iostream>
using namespace std;
	int main(){
	int a,b,sum=0;
	while(1){
	cin>>a;
	if(a==0)break;
	for(int i=0;i<9;i++){
		cin>>b;
		sum+=b;
	}
	cout<<a-sum<<endl;
	}

return 0;
}

C++: #include<cstdio>
#include<iostream>
using namespace std;
int s[11];
int main()
{
	int i,j,n,m;
	while(cin>>n)
	{
		m=0;
		if(n==0)break;
		for(i=1;i<=9;i++)
		{
			cin>>s[i];
			m+=s[i];
		}
		j=n-m;
		cout<<j<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int i, g = 0, n, j;
	while (1)
	{
		cin >> j;
		if (j == 0)
			break;
		g = j;
		for (i = 0; i < 9; i++)
		{
			cin >> n;
			g -= n;
		}
		cout << g << endl;
	}
	return 0;
}

C++: #include <stdio.h>
#include <limits.h>
#include <math.h>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <iostream>

#define VARIABLE(x) cerr << #x << "=" << x << endl
#define BINARY(x) static_cast<bitset<16> >(x);
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)
#define if_range(x, y, w, h) if (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))

const int INF = 100000000;
typedef double D;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4]={-1, 0, 1, 0}, dy[4]={0, -1, 0, 1};
using namespace std;
//typedef pair<int, int> P;

/** Problem0543 : Receipt **/
int main()
{
	int sum;
	while (cin>>sum, sum) {
		int tmp=0;
		rep(i, 9) {
			int t; cin>>t;
			tmp += t;
		}
		cout << sum-tmp << endl;
	}
}

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

int main(){
while(1){
	int n,in;
	scanf("%d",&n);
	if(n==0)break;
	for(int i=0;i<9;i++){scanf("%d",&in); n-=in;}
	printf("%d\n",n);
}
}

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

int main(){
	int total;
	int books;
	int lostbook=0;
         cin>>total;
	while(true){
		
			cin>>books;
                         if(books==0){
                            break;
                         }
			total-=books;
		
	}
	cout<<total<<'\n';
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int total;
    while(cin >> total) {
        if(total == 0) break;
        int sum = 0;
        rep(i, 9) {
            int v; cin >> v;
            sum += v;
        }
        cout << total - sum << '\n';
    }
    return 0;
}

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

int main() {
	while(true) {
		int sum;
		cin >> sum;
		if(sum == 0) break;
		for(int i = 0; i < 9; i++) {
			int el;
			cin >> el;
			sum -= el;
		}
		cout << sum << endl;
	}
}

C++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>

using namespace std;

typedef complex<double> xy_t;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF= 1 << 30;
const double EPS = 1e-9;
const double PI = 3.1415926535897932384626433832795;

int main(){
	int cost;
	int books;
	int num;
	while(cin >> cost && cost){
		books = 0;
	for(int i = 0; i < 9; i++){
		cin >> num;
		books += num;
	}
	cout << cost - books << endl;
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define END << endl;
#define SP << " " << 
using namespace std;

int main(){
	int sum;
	cin >> sum;
	while(sum != 0){
	REP(i,9){
		int t;
		cin >> t;
		sum -= t;
	}
	cout << sum END
	cin >> sum;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	int n;
  	cin>>n;
	int sum = 0;
	for (int i = 0; i < 10; i++) {
		int x;
		cin >> x;
		sum += x;
	}
	cout << n-sum << endl;
}