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,b,c,d,e,f,g,h,i, j;
  
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
 
  cout<<a-(b+c+d+e+f+g+h+i+j)<<'\n';
  return 0;
}

C++: #include <iostream>

int main() {

	int sum = 0, book[9] = {};
	const int f = 5;

	while(f == 5) {

		std::cin >> sum;

		if (sum == 0) {
			goto chin;
		}

		for (int i = 0; i < 9; i++) {
			std::cin >> book[i];
		}
		for (int j = 0; j < 9; j++) {
			sum = sum - book[j];
		}
		std::cout << sum << std::endl;

	}
	chin:
	return 0;
}

C++: #include <stdio.h>

int main(){
    int sum, hiku, i;
    scanf("%d", &sum);
    for(i = 1; i < 10; i++){
        scanf("%d", &hiku);
        sum = sum - hiku;
    }
    printf("ANS:%d\n", sum);
}

C++: #include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;

void solve(int s){
    int in;
    
    for(int i=0;i<9;i++){
        scanf("%d",&in);
        s-=in;
    }
    
    printf("%d\n",s);
    
    return;
}


int main(){
    int s;
    
    while(1){
        scanf("%d",&s);
        if(s==0) break;
        solve(s);
    }
    
    return 0;
}

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

int main() 
{ 
 int num; 
 int a; int b; int c; int d; int e; int f; int g; int h; int i; 
while(1){
 cin >>num; 
 if(num==0){
  break;}
 else{
 cin >>a; 
 cin >>b; 
 cin >>c;
 cin >>d; 
 cin >>e; 
 cin >>f; 
 cin >>g; 
 cin >>h; 
 cin >>i; 
 cout<<num-a-b-c-d-e-f-g-h-i\n; 
 }
}
 return 0; 
}

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

return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,x) for (int i = 0; i < x.size(); i++)
#define RREPALL(i,x) for (int i = x.size()-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define MIN_ELEMENT(x) min_element(ALL(x))
#define MAX_ELEMENT(x) max_element(ALL(x))
#define COUNT(x,num) count(ALL(x), num)
#define MEMSET(x,val) memset(x, val, sizeof(x))
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
#define fst first
#define scd second
#define nextline putchar('\n')
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<ll> VLL;
typedef vector<vector<ll>> VVLL;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

int p, ep;

int main()
{
    while (cin>>p, p) {
        REP(i,9) {
            cin>>ep;
            p -= ep;
        }
        cout<<p<<endl;
    }
    return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int main()
{
	int total,books;
	while(true)
		cin>>total;
		if(total==0){
			break;
		}
	for(int i=1;i<=9;i++){
	cin>>books;
	total-=books;
	cout<<total<<"\n";
	}

    return 0;
}

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

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

int main(){
int books=1;
int book=0;
int i=0;
while(books!=0){
cin>>books;
if(books==0){
break;
}
while(i<=8){
cin>>book;
books-=book;
i++;
}
if(i==9){
cout<<books<<'\n';
i==0;
}

}


return 0;
}

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

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

C++: #include<cstdio>

using namespace std;

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

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

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

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

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

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


int main(){
int i,a;
cin>>a;
while(1){
    cin>>i;
     if((i==0)||(a==0))
           break;
     else a=a-i;

}
cout<<a<<'\n';
 return 0;

}

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

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

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

C++: #include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int i,sougaku,kakaku,hon;
	while(1)
	{
		kakaku=0;
		cin>>sougaku;
		if(sougaku==0)
			break;
		kakaku=sougaku;
		for(i=0;i<9;i++)
		{
			cin>>hon;
			kakaku=kakaku-hon;
		}
		cout<<kakaku<<endl;
	}
	return 0;

}

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

int main() 
{ 
 int num; 
 int a; int b; int c; int d; int e; int f; int g; int h; int i; 
 cin >>num; 
 cin >>a; 
 cin >>b; 
 cin >>c;
 cin >>d; 
 cin >>e; 
 cin >>f; 
 cin >>g; 
 cin >>h; 
 cin >>i; 
 cout<<num-a-b-c-d-e-f-g-h-i; 
 return 0; 
}