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 <stdio.h>

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

C++: #include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main(){
    while(true){
        int max;
        cin >> max;
        if(max == 0){
            return 0;
        }
        for(int i=0; i<9; i++){
            int tmp;
            cin >> tmp;
            max -= tmp;
        }
        cout << max << endl;
    }
}

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

int main(){
	int a;
	scanf("%d",&a);
	int b;
	for(int c=0;c<9;c++){
		scanf("%d",&b);
		a-=b;
	}
	printf("%d\n",a);
}

C++: #include<iostream>

int main(){
	int sum;
	while(std::cin >> sum, sum){
		int p;
		for(int i=9;i--;){
			std::cin >> p;
			sum -= p;
		}
		std::cout << sum << std::endl;
	}
}

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

int main()
{
  int a,b,c,d,e,f,g,h,i,j,k;
  
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
  k=a-b-c-d-e-f-g-h-i-j;
  cout<<k<<'\n';

  return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    int ret;
    cin >> ret;

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

    return 0;
}

C++: #include <iostream>
#define Iset int i,j,l;
#define Fi for (i = 0; i < 9; i++)
using namespace std;

int main() {
	int a, b[11], c=0;
	start:
	Iset;
	cin >> a;
	Fi {
		cin >> b[i];
			c += b[i];
	}
	cout << a-c << endl;

	cin >> a ;
	if (a == 0) {
		goto end;
	}
	else {
		goto start;
	}
	end:
	return 0;
}

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

int main()
{
  int a, b, c, d, e, f, g, h, i, j;
  
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
  cout<<a-(b+c+d+e+f+g+h+i+j)<<'\n';

  return 0;
}

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

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

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

int main()
{
    int a; int b; int c; int d; int e; int f; int g; int h; int i; int j;
    cin >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j;
    cout << a-(b+c+d+e+f+g+h+i+j) << '\n';
    return 0;
}

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


int main(){
int i,a,t;
cin>>a;
while(a!=0){
t=0;
while(t<9){
//  if(a==0)
//         break;

    cin>>i;
    a=a-i;
    t++;
}
cout<<a<<'\n';
cin >> a;

}
 return 0;

}

C++: a

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

int main()
{
  int a,b,c,d,e,f,g,h,i, j;
  
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
 
  cout<<a-b-c-d-e-f-g-h-i-j<<'\n';

  return 0;
}

C++: #include <iostream>
#include <fstream>

using namespace std;

int main()
{
//	cut here before submit 
//	freopen ("testcase.receipt", "r", stdin );
	int total, book;

	while (cin >> total && total ){
		for (int i = 0; i < 9; ++i){
			cin >> book;
			total -= book;
		} // end for
		cout << total << endl;

	} // end loop
	
	return 0;
}

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


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

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

}

C++: #include <stdio.h>
int main(void)
{
	int t,b=0,n,i;
	scanf("%d",&t);
	for(i=0;i!=9;++i){
		scanf("%d",&n);
		b+=n;
	}
	printf("%d\n",t-b);
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
 
using namespace std;
 
void solve(int s){
    int in;
     
    for(int i=0;i<9;i++){
        scanf("%d",&in);
        s-=in;
    }
     
    printf("%d\n",s);
     
    return;
}
 
 
int main(){
    int s;
     
    while(1){
        scanf("%d",&s);
        if(s==0) break;
        solve(s);
    }
     
    return 0;
}

C++: #include<cstdio>
using namespace std;
int main(void)
{
	int i,x=0,kin,gou,sa;
	scanf("%d",&gou);
	for(i=0;i<9;i++){
		scanf("%d",&kin);
		x+=kin;
	}
	sa=gou-x;
	printf("%d\n",sa);
	return 0;
}

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

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

int main()
{
int S;
cin>>S;
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;
int i;
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>e;
cin>>f;
cin>>g;
cin>>h;
cin>>i;
cout<<S-a-b-c-d-e-f-g-h-i<<'\n';


  return 0;
}

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

int main(){
    int n;

    while(cin>>n,n){
        for(int i=0;i<9;i++){
            int a;cin>>a;
            n-=a;
        }

        cout<<n<<endl;
    }

    return 0;
}