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;

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

C++: #include<iostream>
using namespace std;
int main(){
    while(1){
        int Daikin = 0;
        int Book[9] = {0};
        cin >> Daikin;
        if(Daikin == 0){
            break;
        }
        for(int i = 0;i < 9;i++){
            cin >> Book[i];
            Daikin-=Book[i];
        }
        cout << Daikin << endl;
    }
    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 <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;

template<class T>
constexpr T INF = ::numeric_limits<T>::max() / 32 * 15 + 208;

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

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

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

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

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

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;
int n;

const int INF = 1 << 29;

int main(void)
{
	cin >> n;
	for (int i = 0; i < 10; i++)
	{
		int a;
		cin >> a;
		n -= a;
	}
	cout << n;
	return 0;
}

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

C++: #include <iostream>
using namespace std;
int main(void)
{
  int value[9];
  int money;

  cin >> money;
  for(int i = 0 ; i < 9 ; i++) {
    cin >> value[i];
    money -= value[i];
  }
  cout << money << endl;
  return 0;
}

C++: #include <stdio.h>

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

C++: #include<bits/stdc++.h>
using namespace std;
int a,b,ans;

int main(){

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

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

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

	return 0;
}

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

C++: #include<iostream>

using namespace std;

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

C++: #include<cstdio>

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

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

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

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

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

int main()
{

	int sum;
	int value[9];

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

	return 0;

}

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

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

int main() {

	for (int i = 0; i < 5; i++) {
		int x, a, b, c, d, e, f, g, h, i, j;
		cin >> x >> a >> b >> c >> d >> e >> f >> g >> h >> i >> j;

		cout << x - a - b - c - d - e - f - g - h - i - j << endl;
	}

	return 0;
}