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++: // 2011/11/07 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){

	int total;
	cin >> total;

	if(total==0)
		break;

	int price[10];
	for(int i=0; i<9; i++)
		cin >> price[i];

	price[9] = total;
	for(int i=0; i<9; i++)
		price[9] -= price[i];

	cout << price[9] << endl;

	}

	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int x,a,b,c,d,e,f,g,h,i,j;
	scanf("%d %d %d %d %d %d %d %d %d %d",&x,&a,&b,&c,&d,&e,&f,&g,&h,&i);
	j=x-(a+b+c+d+e+f+g+h+i);
	printf("%d\n",j);
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int result;
    int book;
    for(int i = 0; i < 5; i++){
    cin >> result; //総額
    for(int i = 0; i < 9; i++){
        cin >> book;
        result = result - book;
    }
    cout << result << endl;
    }
}

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

return 0;
}

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

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

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


int main(){
   
 if(int i=0;i<5;i++){
  int n;
  cin>>n;

  int sum = 0;
  while(1){
  int x;
  cin>>x;
  
  if(x == 0) break;

 sum = sum + x;

 }
  
  cout<<n-sum<<endl;

 }
  return 0;
}

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

int main(){
  int num;


  cin >> num;

  int work;
  for(int i = 0; i<10; ++i){
    cin >> work;
    
    if(work == 0) break;

    num -= work;
  }

  cout << num << endl;
  
  return 0;
}

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<iostream>
using namespace std;
	int main(){
	int a,b[10],sum=0;
	while(cin>>a){
	
	for(int i=0;i<9;i++){
		cin>>b[i];
		sum+=b[i];
	}
	cout<<a-sum<<endl;
	}

return 0;
}

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

#define for_(i,a,b) for(int i=(a);i<(b);++i)

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

C++: #include <cstdio>

int main(){
	int a,b,i;
	for(i=0;b=0,scanf("%d",i%10?&b:&a),a;++i,printf("%d\n",a))a-=b;
}

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

int main() {
	int book, num[9];
	cin >> book;
	for (int i = 0; i < 9; i++) {
		cin >> num[i];
		book = book - num[i];
	}
	cout << book << endl;
	return 0;
}

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

int main(){

  int books;
  int cnt=0,res;

  cin >> res;

  for(int i = 0; i < 9; i++){
    cin >> books;
    cnt+=books;
    //    if(i == 9) break;
  }

  cout << res - cnt << endl;

  return 0;
}

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

int main(){
int h;
cin>>h;
 for(int i=0;i<=9;i++){
int sum=0;
 sum +=i

}
int e=h-sum;
cout<<e<<endl;
return 0;
}

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

using namespace std;

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

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i=0; i<n; i++)
#define Rep(i, j, n) for(int i=j; i<n; i++)
#define all(vec) vec.begin(), vec.end()

int main() {
    while(1) {
      int n; cin >> n;
      if(n == 0) return 0;
      rep(i, 9) {
        int m; cin >> m;
        n -= m;
      }
      cout << n << endl;
    }
}

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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int sum;
	while(cin >> sum && sum != 0){
	
		for(int i = 0; i < 9; ++i){
			int book;
			cin >> book;
			sum -= book;
		}
		
		cout << sum << endl;
	}
	
	return 0;
}

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

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

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

int main()
{
	//??¬?????????
	int num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,num7=0,num8=0,num9=0,num10=0,num11=0;
	cin>>num1>>num2>>num3>>num4>>num5>>num6>>num7>>num8>>num9>>num10;
	if(num10==0){
		return 0;
	}
	num11=num1-num2-num3-num4-num5-num6-num7-num8-num9-num10-num11;
	cout<<num11;
	cout<<"\n";
	return 0;
}