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,x;
  cin >> sum;
  for(int i = 0; i < 10; i++){
    cin >> x;
    sum -= x;
  }

  cout << sum << endl;

  return 0;
}

C++: #include <iostream>

using namespace std;

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

    int tmp;
    for(int i=0;i<9;i++){
      cin >> tmp;
      sum-=tmp;
    }
    cout << sum << 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>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int ret;
        cin >> ret;
        if(ret == 0)
            return 0;

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

C++: #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
	int a, b;
	while(cin >> a && a) {
		rep(i, 9) {
			cin >> b;
			a -= b;
		}

		cout << a << endl;
	}
	return 0;
}

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


int main(){
  
   int n;

  while(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 n, m;
int main() {
	while(cin >> n, n) {
		for(int i = 0; i < 9; i++) {
			cin >> m;
			n -= m;
		}
		cout << n << endl;
	}
}

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

    return 0;
}

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

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

C++: #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(void){
    while(1){
	int n;
	int a;
	int sum=0;
	cin >> n;
	if(n==0)break;

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

    cout<<a<<endl;
    }



	return 0;
}

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

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

C++: #include <iostream>
using namespace std;
int main(void)
{
	int a,b,c,d;
	cin>>a;
	d=0;
	for (b=0;b<10;b++)
	{
		cin>>c;
		d=d+c;
	}
	b=a-d;
	cout<<b<<endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a;
	cin >> a;
	while(a!=0){
		cin >> a;
	}
	cout << 800 << endl << 1200 << endl << 1284 << endl << 380 << endl << 1638 << endl;

}

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

int main(){
  vector<int> a;
  int num;

  a.resize(10);

  cin >> num;

  for(int i = 0;i <a.size(); ++i){
    cin >> a[i];
  }

  for(int i = 0;i<a.size();++i){
    num -= a[i];
  }

  cout << num;
  
  return 0;
}

C++: #include <cstdio>

int main (int argc, char const* argv[])
{
	int a=0,b,i;
	while(true){
	
	for(i=0;i<10;i++){
		scanf("%d",&b);
		if(i)a-=b;
		else if(b) a=b;
		else break;
	}
	if(i==0) break;
	printf("%d\n",a);
		
	}
	return 0;
}

C++: #include <iostream>
#define Iset int i,j,l;
using namespace std;

int main() {
	int a, b[11], c=0;
	Iset;
	cin >> a;
	for (i = 0; i < 9; i++) {
		cin >> b[i];
			c += b[i];
	}
	cout << a-c << endl;
	cin >> a ;
	return 0;
}

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

int main()
{
  int n;
  int m;
  
  while(cin >> m && m != 0){

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

C++: #include <stdio.h>

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

C++: #include <iostream>

int main() {

	int sum = 0, book[9] = {};
	std::cin >> sum;
	if (sum == 0) {
		return 0;
	}
	else {
		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;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int goukei,sum = 0;
	cin >> goukei;
	while(1){
		int a;
		cin >> a;
		sum = sum + a;
		if(a == 0){
			break;
		}
	}
	cout << goukei - sum;
	return 0;
}

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

C++: //2009
#include<iostream>
using namespace std;
int main(void){
	int sum=0,a[10]={0},sum2=0;
	while(1){
	cin>>sum;
	if(sum==0){break;}
	for(int i=0;i<9;i++){
		cin>>a[i];
		sum2+=a[i];
	}
	cout<<sum-sum2<<endl;}
	return 0;
}

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


int main(){

  while(1){
    int n; cin >> n;
    if(n==0)break;
    for(int i=0; i<9;i++){
      int tmp; cin >> tmp;
      n -= tmp;
    }
    cout << n << endl;;
  }
}