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<iostream>
using namespace std;

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

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

using namespace std;

int main()
{
  while(1){
    int n,sum;
    cin>>sum;
    if(sum == 0){
      break;
    }

    n = 0;
    for(int i = 0;i < 9;++i){
      int book;
      cin>>book;
      n += book;
    }

    int ans = sum - n;
    cout<<ans<<endl;
  }

  return 0;
}

C++: #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007;

int N, M, K, H, W, L, R;


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

	cin >> N;
	while(N){
	for (int i = 0; i < 9; i++) {
		cin >> M;
		N -= M;
	}
	cout << N << endl;
	cin>>N;
	}
	return 0;
}

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

int main()
{

int a,b,c,d,e,f,g,h,i,j;
cin>>a;
cin>>b;
cin>>c;
cin>>d;
cin>>e;
cin>>f;
cin>>g;
cin>>h;
cin>>i;
cin>>j;

cout<<a-b-c-d-e-f-g-h-i-j<<'\n';

return 0;
}

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

int main(){

	int answer[5];
	int datanum = 0;

	for(int dataset = 0; dataset < 5; dataset++){
	
		int input;
		int sum;

		cin >> input;
		if(input == 0) break;
		sum = input;

		for(int i = 0; i < 9; i++){
			cin >> input;
			sum -= input;
		}
	
		int m,s;

		answer[dataset] = sum;

		datanum++;
	}

	for(int dataset = 0; dataset < datanum; dataset++){
		cout << answer[dataset] << endl;
	}

	return 0;
}

C++: #include <cstdio>

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

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

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

int main(){
	int total;
	int books;
	int lostbook=0;
	for(int i=0;i<10;i++){
		if(i==0){
			cin>>total;
		}else{
			cin>>books;
			total-=books;
		}
	}
	cout<<total;
	return 0;
}

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

int main(){
  int N, x[50];
  int X = 0;
  cin>>N;
  
  for(int i=0;;i++){
    cin>>x[i];
    if(x[i] == 0) break;
    X += x[i];
  }

  cout<<N - X<<endl;

  return 0;
}

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

	int a[1000], sum;
	int sum1 = 0;
	for(int j=0;j<5;j++){
		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<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>

using namespace std;

    int main(){
        int price[11],allprice,Ans;

        while(1){
        for(int i=0;i<11;i++){
        price[i]=0;
        }
        cin>>allprice;
        if(allprice==0)break;

        for(int i=0;i<9;i++){
            cin>>price[i];
        }
        for(int i=0;i<9;i++){
            price[10]+=price[i];
        }
        Ans=allprice-price[10];
        cout<<Ans<<endl;
        }
     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<algorithm>
#include<functional>
#include<cstdio>
#include<vector>
#include<map>
#include<string>
#include<cmath>
using namespace std;
int main(){
	
	int s;
	int n;
	while(cin>>s,s!=0){
	for(int i=0;i<9;i++){
		cin>>n;
		s-=n;
	}
	
	cout<<s<<endl;
	}
}

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

int main(){

  int daikin;
  int sum = 0;
  int yj[9];
  
  cin >> daikin;

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

  cout << daikin - sum << endl;

  return 0;
}

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

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

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-10;
const vi emp;

int sum;

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

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

int main(){
  int s,a;
  while(cin >> s){
    if(s==0)break;
    for(int i=0;i<9;i++){
      cin >> a;
      s -= a;
    }
    cout << s << endl;
  }
}