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;

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  for (int s; cin >> s, s;){
  rep (i, 9) {
    int x; cin >> x;
    s -= x;
  }
  cout << s << endl;}

  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void)
{
	while(1)
	{
	int a,b;
	scanf("%d",&b);
	if(b==0){break;}
	for(int i=0;i<9;i++){
		scanf("%d",&a);
		b-=a;
	}
	printf("%d\n",b);
	}
	return 0; 
}
//3:25.212クリア

C++: #include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
	while(cin >> n, n) {
		for(int i = 0; i < 9; i++) cin >> m, n -= m;
		cout << n << 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;
	return 0;
}

C++: #include <stdio.h>

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

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

C++: #include<stdio.h>

int main()
{
	int total;
	int sum = 0;
	int a;
	
	scanf("%d",&total);
	
	for(;;){
		scanf("%d",&a);
		if(a == 0){
			break;
		}
		sum += a;
	}
	
	printf("%d\n",total - sum);
	
	return 0;
}

C++: #include <bits/stdc++.h> 
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(vec) vec.begin(), vec.end()
#define tmax(x,y,z) max((x),max((y),(z)))
#define tmin(x,y,z) min((x),min((y),(z)))
typedef long long ll;ll MM = 1000000000;ll mod = MM + 7; ll MMM=9223372036854775807;//2^63 -1
ll GCD(ll x, ll y) {if (y == 0) return x;else return GCD(y, x % y);}
ll LCM(ll x, ll y) { return x / GCD(x, y) * y;}
//cout << fixed << setprecision(10);

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

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

int main()
{
	int a;

	cin >> a;

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

		cin >> a;
	}

	return 0;
}

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

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

    return 0;
}

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;
}

C++: #include <iostream>
#include <string>
using namespace std;
int main(){
int a;
int b;
int c;
int d;
int e;
int f;
int g;
int h;
int i;
int j;
while(cin >>a){
if(a==0){break;}
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<<endl;
}
}

C++: #include<stdio.h>

int main(){

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

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

using namespace std;

int main(){
	int m,k;
	cin>>m;
	for(int n=0; n<9; n++ ){
	cin>>k;
	m-=k;
	if(m=0){
		break;
	}
	}
	cout<<m<<endl;
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int t,x,sum=0;
	cin>>t;
	for(int i=0;i<10;i++){
	if(x==0)break;
	cin>>x;
	sum=sum+x;
}
	cout<<t-sum<<endl;

return 0;
}

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

using namespace std;

int main(){

	int sum;
	while(cin >> sum && sum != 0){
		int sum2 = 0;
		for(int i = 0; i < 9; i++){
			int tmp;
			cin >> tmp;
			sum2 += tmp;
		}
		cout << sum - sum2 << endl;
	}

	return 0;
}

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

int main(int argc, const char * argv[]) {
    
    int nyuuryoku[5][10];
    int print[5];
    int a=0;
    int sum=0;
    
    for(int i=0;i<5;i++){
        for(int j=0;j<10;j++){
            cin >> nyuuryoku[i][j];
            if(j==0){
                if(nyuuryoku[i][j]==0){
                    a=1;
                    break;
                }
            }
        }
        if(a==1){
            break;
        }
    }
    
    for(int i=0;i<5;i++){
        
        if(nyuuryoku[i][0]==0){
            a=i;
            break;
        }
        
        sum=0;
        for(int j=1;j<10;j++){
            sum=sum+nyuuryoku[i][j];
        }
        print[i]=nyuuryoku[i][0]-sum;
        
    }
    
    for(int i=0;i<a;i++){
        cout << print[i] << endl;
        
    }
    
    return 0;
}

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

#define REP(i, n) for (int i = 0; i < (n); i++)

int main()
{
  int cash, book[9], i;

  while (cin >> cash, cash){
    REP(i, 9){
      cin >> book[i];
      cash -= book[i];
    }
    cout << cash << endl;
  }
}

C++: #include <iostream>

using namespace std;

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

	return 0;
}