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 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 <iostream>
 
using namespace std;
 
int main()
{
	int t;
	t<=10000;
	cin>>t;

	for(int i=1;i<=10;i++){
		int b;
		cin>>b;
		if(b==0){
			cout<<t-b<<"\n";
			break;
		}

	}

    return 0;
}

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

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

using namespace std;

#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define REP3(i, m, n) for(int i = m, i##_len=(n);i < i##_len;i++)
#define FORVEC(i, v) for(int i = 0;i < v.size();i++)

#define INF 1000000000
#define pb(a) push_back(a)
#define llong long long
#define vi vector<int>
#define P pair<int,int>
#define all(vec) (vec.begin()),(vec.end())

int main(){
	int a;
	int buf;
	while(1){
		cin>>a;
		if(a==0)break;
		REP(i,9){
			cin>>buf;
			a-=buf;
		}
		cout<<a<<"\n";
	}
	return 0;
}

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

C++: #include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef long long ll;
typedef pair<int,int> pii;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=(int)(n);v>=0;v--)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;
const ll INFLL = 1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
    os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
    ITR(i,v)os<<*i<<(i==end(v)-1?"":" ");return os;}
//------------------------------------------------------------------------------

signed main() {
    while(true) {
        int s=0,all;
        cin>>all;
        if(all==0) break;
        REP(i,9) {
            int a;
            cin>>a;
            s+=a;
        }
        cout<<all-s<<endl;
    }

    return 0;
}

C++: //
//  main.cpp

#include <iostream>
using namespace std;


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

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


int main(){
int i,a,t;
cin>>a;
while(a!=0){

while(t<9){
//  if(a==0)
//         break;

    cin>>i;
    a=a-i;
    t++;
}
cout<<a<<'\n';
cin >> a;

}
 return 0;

}

C++: #include<iostream>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int main()
{
	int sum;
	while (cin >> sum, sum) {
		REP(i, 0, 9) {
			int value;
			cin >> value;
			sum -= value;
		}

		cout << sum << endl;
	}
	return 0;
}

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

C++: #include<iostream>
using namespace std;
int main(){
  unsigned long long int s,book,books;
  while(cin>>s){
    if(s==0) break;
    books = 0;
    for(int i=0;i<10;i++){
      cin >> book;
      books += book;
    }
    cout << s - books << endl;
  }
  return 0;
}

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

using namespace std;

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

	return 0;
}

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

C++: #include <iostream>

using namespace std;

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

int main() {
	int v[9];
	int sum;

	while (1) {
		cin >> sum;
		if (sum == 0) break;
		REP(i,9) cin >> v[i];

		REP(i,9) sum -= v[i];
		cout << sum << endl;
	}
	return 0;
}

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

int main(){
   int a;
   int book[10] =  {};
   for(int i=1;i<10;i++){
       cin>>book[i-1];
      while(1){
           if(book[i-1] == 0) break;

           for(int j=0;j<<10;j++){
              int k;
              k =+ book[j];
              int x;
              x = a - (k);
              cout<<x<<endl;
           }
           cout<<endl;
      }

   }
   cout<<endl;

   return 0;
}

C++: #include<iostream>

using namespace std;

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

C++: #include<iostream>
using namespace std;
int main(){
int total;
cin>>total;
int a,b,c,d,e,f,g,h,i,j;
while(total!=0){
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
j=total-(a+b+c+d+e+f+g+h+i);
cout<<j<<'\n';
cin>>total;
}
return 0;
}