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>
#include <vector>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

int main(){

	int sum,minus_sum,tmp;

	while(true){
		scanf("%d",&sum);
		if(sum == 0)break;

		minus_sum = 0;

		for(int i = 0; i < 9; i++){
			scanf("%d",&tmp);
			minus_sum += tmp;
		}

		printf("%d\n",sum-minus_sum);

	}

	return 0;
}

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

int main() {
	int L,a[10];
	cin >> L ;
	for(int i=0;i<9;i++){
		cin >> a[i];
	}
	cout << L-(a[0]+a[1]+a[2]+a[3]+a[4]+a[5]+a[6]+a[7]+a[8]) << endl;
	// your code goes here
	return 0;
}

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

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

C++: #include<stdio.h>

int main(void){
  int sum,sum9,i,a;

  while(scanf("%d",&sum),sum){
    for(i=sum9=0;i<9;i++){
      scanf("%d",&a);
      sum9+=a;
    }
    printf("%d\n",sum-sum9);
  }

  return 0;
}

C++: loop do
    sum = gets.chomp.to_i
    break if sum == 0
    
    9.times do
        x = gets.chomp.to_i
        sum -= x
    end 
    
    puts sum
end

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

return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	while(true){
			
		int a,b;
		cin >> a;
		if(a==0){
			break;
		}
		for(int n=0;n<9;n++){
			cin >> b;
			a=a-b;
		}
		printf("%d\n",a);
	}
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){

	int a[10], sum;
	int sum1 = 0;
	while(1){
		cin>>sum;
		if(sum == 0) break;
		for(int i=0;i<9;i++){
			cin>>a[i];
			sum1 += a[i];
		}
		cout<<sum - sum1<<endl;
	}
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,t,count=0,ans=0;
  cin >> t;
  while(1){
	cin >> n;
	ans += n;
	if(ans==0) break;
	if(count == 10) break;
	count++;
  }
  cout << t-ans << endl;
  return 0;
}

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

}

C++: #include <cstdio>

int main()
{
	int N, A;

	while (true)
	{
		scanf("%d", &N);

		if (N == 0) { break; }

		for (int i = 0; i < 9; i++)
		{
			scanf("%d", &A);

			N -= A;
		}

		printf("%d\n", N);
	}

	return 0;
}

C++: #include<bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
	int a[10];
	for(int i=0;i<10;i++)scanf("%d",&a[i]);
	int sum=0;
	for(int i=1;i<10;i++)sum+=a[i];
	printf("%d",a[0]-sum);
}

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

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

if(a == 0)break;

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


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

  ans = a -sum;

  cout << ans << endl;

sum = 0;

}

C++: #include <iostream>
using namespace std;
int main(){
     int total;
     cin>>total;
while(total!=0){
       int a,b,c,d,e,f,g,h,i,j;
       cin>>a>>b>>c>>d>>e>>f>>g>>h>>i;
       j=total-(a+b+c+d+e+f+g+h+i);
       cout<<j<<endl;
       cin>>total;
}
return 0;
}

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

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

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

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

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

int main(){
	int total;
	int books;

	for(int i=0;i<10;i++){
		if(i==0){
                   cin>>total;
                   if(total>10000){
                      break;
                   }
                }else{
                   cin>>books;
                   total-=books;
                }
	}
	cout>>total>>'\n';
	return 0;
}

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

using namespace std;

int main(){
	
	int sum, d;
	
	while(true){
		
		cin >> sum;
		
		if(sum == 0){
			break;
		}
		for(int i = 0; i < 9; i++){
			cin >> d;
			sum -= d;
		}
		printf("%d\n", sum);
	}
	
	return 0;
}

C++: #include <stdio.h>

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

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

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

int main(){
int books=1;
int book=0;
int i=0;
while(books!=0){
cin>>books;
if(books==0){
break;
}
while(i<=8){
cin>>book;
books-=book;
i++;
}
if(i==9){
cout<<books<<'\n';
i=0;
}

}


return 0;
}

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


int main(){

  for(int i=0;i<5;i++){

   int n;
  cin>>n;

  int sum = 0;
  while(1){
  int x;
  cin>>x;
  
  if(x == 0) break;

 sum = sum + x;

 }
  
  cout<<n-sum<<endl;
 }

  return 0;
}

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