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,a,sum=0;
	cin>>n;
	for(int i=1; i<=9; i++){
		cin>>a;
		sum+=a;
	}
	cout<<n-sum;
	return 0;
}

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

int main() {

	//ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

	int i, sum, p;
	while(1) {
	cin >> sum;
	if(sum == 0)
		break;
	for(i = 0; i < 9; i++) {
		cin >> p;
		sum -= p;
	}
	cout << sum << endl;
	}

	return 0;

}

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

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

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

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

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

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

  return 0;
}

C++: #include<stdio.h>
int main()
{
	int sum, wa = 0, i, r;
	while(1){
		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);
	}
}

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

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

C++: #include<iostream>

using namespace std;

int main(){
  int all;
  cin>>all;
  while(true){
    int a; cin>>a;
    if(a==0) break;
    all-=a;
  }
  cout << all << endl;
  return 0;
}

C++: #include <stdio.h>
#include <cmath>
#include <vector>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
using namespace std;

int main(void) {
	vector<int> r;
	while (true)
	{
		int n=0;
		scanf("%d",&n);
		if (n==0){
			break;
		}
		for (int i=0; i<9; i++)
		{
			int m=0;
			scanf("%d",&m);
			n-=m;
		}
		r.push_back(n);
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

C++: 9850
1050
800
420
380
600
820
2400
1800
980

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

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

	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int sum;
	int a;
	while (cin >> sum) {
		if (sum == 0) {
			break;
		}
		for (int i = 0; i < 10; i++) {
			cin >> a;
			sum -= a;
		}
		cout << sum << 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;
                }else{
                   cin>>books;
                   total-=books;
                }
	}
	cout<<total;
	return 0;
}

C++: #include<stdio.h>
int main()
{
	int sougaku, money, nazo;
	scanf("%d", &sougaku);
	nazo = sougaku;
	scanf_s("%d", &money);
	while (money != 0){
		nazo = nazo - money;
		scanf("%d", &money);
	}
	printf("%d\n", nazo);
	return 0;
}

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

#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ios::sync_with_stdio(false);

    int sum;
    while(cin >> sum,sum){
        int a;
        REP(i,9){
            cin >> a;
            sum-=a;
        }
        cout << sum << endl;
    }
}

C++: /* -- 0543:Receipt --*/
#include	<iostream>

using namespace std;

int main(void) {
	int sum, buff;
	while(1) {
		cin >> sum;
		if(sum == 0) { break; }
		for(int i=0; i<9; i++) {
			cin >> buff;
			sum -= buff;
		}
		cout << sum << endl;
	}
	return 0;
}

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

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

C++: #include<iostream>
#include<cmath>
#include<string>

using namespace std;
int main()
{
    int cnt=0;
    int a,b;
    while(cin >> b){
        if(b==0){
            break;
        }
        if(cnt==0){
            a=b;
        }else{
            a-=b;
        }
        if(cnt==9){
            cnt=0;
            cout << a << endl;
        }else{
            cnt++;
        }
    }
    return 0;
}

C++: #include <stdio.h>

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

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

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

    return 0;
}

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

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

  cout << sum;

  return 0;
}

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

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

C++: #include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x;
while(cin>>y){
x-=y;
}
cout<<x<<endl;
}

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