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()
{
	int sum, wa = 0, i, r;
	while(1){
		sum = 0;
		wa = sum;
		scanf("%d", &sum);
		if (sum==0){
			break;
		}
		for (i = 0; i < 9; i++) {
			scanf("%d", &r);
			wa = wa + r;
		}
		sum = sum - wa;
		printf("%d\n", sum);
	}
	return 0;
}

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

//足し算引き算の問題

int main(){
	int total;
	int cost;
	int totalCost;

	while(cin >> total, total){
		totalCost = 0;
		for(int i=0; i < 9; i++){
			cin >> cost;
			totalCost += cost;
		}
		total -= totalCost;

		cout << total << endl;
	}
}

C++: // 2013/09/10 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){			// 複数の入力に対応

		int s;
		cin >> s;

		if(s==0)		// 総額が0のとき入力の終わり
			break;

		int b1, b2, b3, b4, b5, b6, b7, b8, b9;
		cin >> b1;
		cin >> b2;
		cin >> b3;
		cin >> b4;
		cin >> b5;
		cin >> b6;
		cin >> b7;
		cin >> b8;
		cin >> b9;

		int b10 = s-b1-b2-b3-b4-b5-b6-b7-b8-b9;

		cout << b10 << '\n';

	}

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
using P = pair<int,int>;
#define int long long
signed main()
{
    
    
    rep(i,5){
        int n;cin >>n;
        if(n == 0)return 0;
        rep(i,9){
            int x;cin >> x;
            n -= x;
        }
        cout << n << endl;


    }
    
    return 0;
}

C++: #include<cstdio>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int s;

int main()
{
	scanf( "%d", &s );
	rep( i, 9 )
	{
		int a;
		scanf( "%d", &a );
		s -= a;
	}

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

	return 0;
}

C++: //============================================================================
// Name        : receipt.cpp
// Author      : 
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;

int main() {
	while (1) {
		int n, price[9], sum = 0;
		cin >> n;
		if (n == 0)
			break;
		for (int i = 0; i < 9; i++) {
			cin >> price[i];
			sum = sum + price[i];
		}
		cout << n - sum << 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;
	
	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;
}

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

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

C++: #include <stdio.h>
#include <algorithm>
using namespace std;

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

C++: #include <iostream>
using namespace std;
int main(void)
{
	for (;;)
	{
		int a,b,c,d;
		cin>>a;
		if (a==0)
		{
			break;
		}
		d=0;
		for (b=0;b<10;b++)
		{
			cin>>c;
			d=d+c;
		}
		b=a-d;
		cout<<b<<endl;
	}
	return 0;
}

C++: #include<stdio.h>

int main(){
	int a;
	int 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 total;
	int books;
        cin>>total;
	while(true){
          cin>>books;
          if(books==0){
             break;
          }else{
            total-=books;
          }
	}
	cout<<total<<'\n';
	return 0;
}

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

using namespace std;

int main() {
    while (true) {
        int sum;
        cin >> sum;
        if (sum == 0) break;
        for (int i = 0; i < 9; ++i) {
            int cost;
            cin >> cost;
            sum -= cost;
        }
        cout << sum << '\n';
    }
    return 0;
}

C++: #include<stdio.h>
int main()
{
	int sougaku=0,sum=0,money=0,amari[100]={0},k=0;
	scanf("%d",&sougaku);
	while(sougaku!=0){
		for(int i=0;i<9;i++){
			scanf("%d",&money);
			sum=sum+money;
		}
		amari[k]=sougaku-sum;
		k++;
		sum=0;
		scanf("%d",&sougaku);
	}
	for(int i=0;i<k;i++){
		printf("%d\n",amari[i]);
	}
	return 0;
}