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 m,k;
	cin>>m;
	for(int n=0; n<9; n++ ){
	cin>>k;
	m-=k;
	}
	cout<<m<<endl;
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	for(int i=0; i<9; i++){
		int a;
		cin >> a;
		n -= a;
	}
	cout << n << endl;
	return 0;
}

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

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

int main(){
 int h;
 int x;
 int y;
 int z;
 int a;
 int b;
 int c;
 int d;
 int f;
 int g;
 int i;
 cin>>h>>x>>y>>z>>a>>b>>c>>d>>f>>g>>i;
int e =h-x-y-z-a-b-c-d-f-g-i;

cout<<e<<endl;
return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int n;
	while(cin>>n &n){
	for(int i=0;i<9;i++){
		int x;
		cin>>x;
		n-=x;
	}
	
	cout<<n<<endl;
	}
}

C++: 2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
 
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    while(1){
        int sum = 0;
        int n;
        cin >> sum;
        if(sum == 0) break;
        for(int i = 0; i < 9; i++){
            cin >> n;
            sum -= n;
        }
        cout << sum << endl;
    }
    return 0;
}

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


int main(){
int i,a;
cin>>a;
while(1){
    cin>>i;
     if(i==0)
           break;
     else a=a-i;

}
cout<<a<<'\n';
 return 0;

}

C++: #include<iostream>
#include <cstdio>
#include<cstring>
#include <cstdlib>  
#include<cmath>   
#include <cctype>
#include<string>
#include<set>
#include <iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility>
#define LEN 100005
using namespace std;
using ll = long long;
double pi() { return 3.14; }
int sum(int a, int b) { return a + b; }
int mul(int a, int b) { return a * b; }
ll LGCD(ll x, ll y) {if (x % y == 0) return y;else return LGCD(y, x % y);}
ll LLCM(ll x, ll y) {return x * y / LGCD(x, y);}

int GCD(int x, int y) {if (x % y == 0) return y;else return GCD(y, x % y);}
int LCM(int x, int y) {return x * y / GCD(x, y);}
ll dp[10000][10000];
ll combination(ll n, ll r) {
         if (n == r){dp[n][n] = 1;}
	else if (r == 0) {return dp[n][0] = 1;}
	else if (r == 1) {return dp[n][1]=n;}
	else {dp[n][r]=dp[n - 1][r - 1] % 1000000007 + dp[n - 1][r] % 1000000007;
	return dp[n][r]=combination(n - 1, r - 1) % 1000000007 + combination(n - 1, r) % 1000000007;}
}

int main() {
	vector<int>Book(9);
	int ans;
	int A;
	while (1) {
		cin >>A;
		if (A == 0)break;
		else { 
			for (int i = 0;i < 9;i++) { cin >> Book.at(i);
			A = A - Book.at(i);
			}cout << A << endl;
		}
		
	}
	
	return 0;
}

C++: #include<cstdio>
using namespace std;
int main(){
while(1){
int n;
scanf("%d",&n);
for(int i=0;i<9;i++){
int c;
scanf("%d",&c);
n-=c;
}
printf("%d\n",n);
}
}

C++: #include <iostream>
using namespace std;
int main()
{
 int x;
 int h[10];
 while(true){
 
 cin >> x;
 if(x==0)
    break;
 for(int i=0 ;i<9 ;i++){
     cin >> h[i];
   
     x = x - h[i];
 }
}
 cout << x << endl;
 return 0;
}

C++: #include <iostream>
using namespace std;
int main(void)
{
  int value[9];
  int money;

  while(1) {
    cin >> money;
    if(money == 0) break;
    for(int i = 0 ; i < 9 ; i++) {
      cin >> value[i];
      money -= value[i];
    }
    cout << money << endl;
  }
  return 0;
}

C++: 
#include <iostream>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)

int main(void){
	while(true){
		int sum;
		cin >> sum;
		if(sum == 0) return 0;
		rep(i, 9){
			int x;
			cin >> x;
			sum -= x;
		}
		cout << sum << endl;
	}
}

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

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

int main() {
  while(true) {
    int total1 = 0;
    int total2 = 0;
    cin >> total1;
    if(total1 == 0) break;
    for(int i = 0; i < 9; ++i) {
      int cost;
      cin >> cost;
      total2 += cost;
    }
    cout << total1 - total2 << endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <cstdio>
#include <iomanip>

using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;(i)>=0;(i)--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())

typedef long long ll;


int main(){

    while(true){
        int n;
        cin>>n;
        if(n==0)break;
        
        int sum=0;
        REP(i,9){
            int t;
            cin>>t;
            sum+=t;
        }
        
        cout<<n-sum<<endl;
        
    }
    
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int a;
	cin >> a;
	if(a>10000)
		cout << "error" << '\n';
	else{
	int b;int c=0;
	while(c<9){
		cin >> b;
		a = a-b;
		c++;
		if(a<=0){
			cout << 0 << '\n';
			break;
		}
	}
}
	cout << a << '\n';
	return 0;
}

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