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;

#define INF_LL (int64)1e18
#define INF (int64)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}


int main(void) {
    int64 sum;
    while (cin >> sum && sum) {
        vector<int64> A(9);
        REP(i, 9) cin >> A[i];
        cout << sum - accumulate(all(A), 0) << endl;
    }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
  int sump, price;
  while (true) {
    cin >> sump;
    if (sump == 0)
      break;
    for (int i = 0; i < 9; i++) {
      cin >> price;
      sump -= price;
    }
    cout << sump << endl;
  }
  return 0;
}

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

int main() {
    while (true) {
        int sum; cin >> sum;
        if (sum == 0) break;

        int sum_sub = 0;
        for (int i = 0; i < 9; i++) {
            int tmp; cin >> tmp;
            sum_sub += tmp;
        }
        cout << sum - sum_sub << endl;
    }
}

C++: #include <iostream>
#include <cstdio>
#include <string.h>

using namespace std;
int main(){
  int sum;
  while(  cin >> sum,sum ) {
    for(int i = 0 ; i < 9 ; i++ ){
      int a;
      cin >> a;
      sum -= a;
    }
    cout << sum << endl;
  }
  return 0;
}

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

int main(){

  int books;
  int cnt=0,res;

  cin >> res;

  for(int i = 0; i < 10; i++){
    cin >> books;
    cnt+=books;
     if(books == 0) break;
  }

  books = res - cnt;
  cout << books << endl;

  return 0;
}

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

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

C++: #include<cstdio>
#include<algorithm>
using namespace std;

int main(){
  int t;
  int b;
  
  while(scanf(" %d",&t), t!=0){
    for(int i=0;i<9;i++){
      scanf(" %d",&b);
      t -= b;
    }
    printf("%d\n",t);
  } 
  
  return 0;
}

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

int main(int argc, const char * argv[]) {
    
    int nyuuryoku[5][10];
    int print[5];
    int a=0;
    int sum=0;
    
    for(int i=0;i<5;i++){
        for(int j=0;j<10;j++){
            cin >> nyuuryoku[i][j];
            if(j==0){
                if(nyuuryoku[i][j]==0){
                    a=1;
                    break;
                }
            }
        }
        if(a==1){
            break;
        }
    }
    
    for(int i=0;i<5;i++){
        
        if(nyuuryoku[i][0]==0){
            a=i;
            break;
        }
        
        for(int j=1;j<10;j++){
            sum=sum+nyuuryoku[i][j];
        }
        print[i]=nyuuryoku[i][0]-sum;
        
    }
    
    for(int i=0;i<a;i++){
        cout << print[i] << endl;
    }
    
    return 0;
}

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

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

	int total;
	int books[10];

	cin >> total;

	for(int i=0; i<10; i++){
		cin >> books[i];
		if(books[i] == 0) break;
	}

	for(int i=0; i<10; i++){
		total -= books[i];
		if(books[i] == 0) break;
	}
	

	printf("%d\n", total);

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int x,a,b,c,d,e,f,g,h,i,j;
	scanf("%d %d %d %d %d %d %d %d %d %d",&x,&a,&b,&c,&d,&e,&f,&g,&h,&i);
	j=x-(a+b+c+d+e+f+g+h+i);
	printf("%d\n",j);
	return 0;
}

C++: #include <stdio.h>

main()
{
	int a,b,i;
	scanf("%d",&a);
	for(i=1;i<11;i++){
		scanf("%d",&b);
		a-=b;
	}
	printf("%d\n",a);
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int t,x,sum=0;
	for(int j=0;j<5;j++){
	cin>>t;
	if(t==0)break;
	
for(int i=0;i<9;i++){
	cin>>x;
	sum=sum+x;
}

	cout<<t-sum<<endl;
}
return 0;
}

C++: #include<cstdio>

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

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

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

C++: #include <iostream>
using namespace std;
//
int main() {
	while(true){
		int L,a[10];
		cin >> L ;
		if(L==0) break;
		for(int i=0;i<9;i++){
			cin >> a[i];
		}
		for(int i=0;i<9;i++){
			L=L-a[i];
		}
		cout << L << endl;
		// your code goes here
	}
	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;
	Iset;
	cin >> a;
        start:
	Fi {
		cin >> b[i];
			c += b[i];
	}
	cout << a-c << endl;

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