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 A;
	int B;
	while (1){
		cin >> A;
		for (int i = 0; i < 9; i++){
			cin >> B;
			A -= B;
		}
		cout << A << endl;
		cin >> A;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int n,m,i,z=0;
		while(1){
		scanf("%d",&n);
		if(n==0) break;
		for(i=0;i<9;i++){
		m=0;
			scanf("%d",&m);
			z+=m;
		}
		n=n-z;
		printf("%d\n",n);
		}
	return 0;
}

C++: #include<iostream>
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;
 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; 
 return 0;
}

C++: #include <iostream>

using namespace std;

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

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

        int a[9];
        REP(i, 9) cin >> a[i];

        int ans = s;
        REP(i, 9) ans -= a[i];
        cout << ans << endl;
    }
    return 0;
}

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

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

using namespace std;

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

        while(1){
        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<cstdio>
using namespace std;
int main(void)
{
	int i,x,gou,kin;
	scanf("%d",&gou);
	while(!(gou==0)){
		for(i=0;i<9;i++){
			scanf("%d",&kin);
			gou-=kin;
		}
		printf("%d\n",gou);
		scanf("%d",&gou);
	}
	return 0;
}

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

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

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

using namespace std;

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

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

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

int main(){
	int total;
	int books;
        int count=0;
       
	while(true){
         if(count==0){
           cin>>total;
           if(total==0){
               break;
           }
           count++;
          }else{
           cin>>books;
           total-=books;
           count++;
          }
         if(count==10){
           cout<<total<<'\n';
         }
	}
	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

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

//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int sum;
int main()
{
  int x;
  while(cin >>sum,sum){
    for(int i = 0;i < 9;i++){
      cin >>x;
      sum -=x;
    }
    cout <<sum<<endl;
  }
  return 0;
}

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

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

	int sum;
	cin >> sum;

	for(int i = 0; i < 9; ++i) {
		int price;
		cin >> price;
		sum -= price;
	}

	cout << sum << endl;

	return EXIT_SUCCESS;
}

C++: #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

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

C++: #include <cstdio>
int main() {
	int sum,book,books=0;
	scanf("%d",&sum);
	for(int i=1;i<10;i++) {
		scanf("%d",&book);
		books+=book;
	}
	printf("%d\n",sum-books);
}

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

#include <iostream>
using namespace std;
int N,A[9];
int main() {
	cin>>N;
	for(int i=0;i<9;i++){
		cin>>A[i];
		N-=A[i];
	}
	cout<<N<<endl;

	return 0;
}

C++: loop do
    x = gets.chomp.to_i
    break if x == 0
    
    9.times do
        sum = 0;    y = gets.chomp.to_i
        sum += y
    end 
    
    print x - sum
end

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

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

C++: #include<stdio.h>
int main(void)
{
	int a,b,i,x=0,s=0;
	while(1){
		scanf("%d",&a);
		if(a==0) break;
		s=a;
		for(i=0;i<9;i++){
			scanf("%d",&b);
			x+=b;
		}
		printf("%d\n",s-x);
	}
	return 0;
}