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 total,book;
	int c=0;
	
	while(true){
	if(c==0){
		cin >> total;	
	}
	if(total==0){
		break;
	}
	c++;
	}else{
	for(c=1;c<10;c++)
	cin >> book ;
	total -= book;
	}
	if(c==10){
	cout << total << '\n';
	c=0;
	}
	}	
	return 0;
}

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

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

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

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

	return 0;

}

C++: #include <iostream>

using namespace std;

int main()
{
	int Ttotal,Ftotal,in;

	
	while(cin >> Ttotal && Ttotal){

		Ftotal = 0;
		for(int i = 0; i < 9; i++){
			cin >> in;
			Ftotal += in;
		}

		cout << Ttotal-Ftotal << endl;
	}

	return 0;
}

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

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

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

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

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

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

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

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

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

int main() {
  while (true) {
    int ans = 0;
    vector<int> vec(10);
    for (int i = 0; i < 10; i++) cin >> vec.at(i);
    if (vec.at(0) == 0) break;
    ans = vec.at(0);
    for (int i = 1; i < 10; i++) ans -= vec.at(i);
    cout << ans << endl;
  }
}

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

int main(){
    int N, x[10];
    int X = 0;

    for(int j=0;j < 5;j++){
      cin>>N;
      if(N == 0) break;
      
      for(int i=1;i < 10;i++){
        cin>>x[i];
        X += x[i];
      }
      cout<<N - X<<endl
    }
    return 0;
}

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

int main(){

  while(1){ 

  int daikin;
  int sum = 0;
  int yj[9];
  
  cin >> daikin;
  if (daikin == 0){
    return 0;
  }

  for(int i = 0; i < 9; i++){
    cin >> yj[i];
  }
  
  for(int i = 0; i < 9; i++){
    sum += yj[i];
  }

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

C++: #include<cstdio>

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

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

int main(){
  int total = 0,book,totala = 0,mach;
  while(true){
    cin>>total;
    if(total==0){
      break;
    }
    for(int i=1;i <= 9;i++){
      cin >> book;
      totala = totala + book;
    }
    mach = total - totala;
    cout << mach << endl;
    totala=0;
    total=0;
  }
  return 0;
}

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


int main(){
int i,a,t;
cin>>a;
while(t<9){
    cin>>i;
     if((i==0)||(a==0))
           break;
     else a=a-i;
t++;
}
cout<<a<<'\n';
 return 0;

}

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

int main()
{

	int sum;
	int value[9];

	while(cin >> sum, sum != 0) {
		for (int i = 0; i < 9; i++) {
			cin >> value[i];
			sum -= value[i];
		}
		cout << sum <<  endl;
	}

	return 0;

}

C++: #include <bits/stdc++.h>
#define rep(i,l,n) for(int i=l;i<n;i++)
#define rer(i,l,n) for(int i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pii;

int main(){
	while(1){
		int x,a;
		cin>>x;
		if(x==0) break;
		rep(i,0,9){
			cin>>a; x-=a;
		}
		o(x);
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
    ll n;
    while (cin >> n) {
        if (n == 0) {
            break;
        } else {
            ll sum = 0;
            rep(i, 9) {
                ll a;
                cin >> a;
                sum += a;
            }
            cout << n-sum << endl;
        }
    }
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
using namespace std;
int main()
{
	int a, b, c, d, e,f,g,h, i, j, k, l, m, n, o, p, q, r,s,t,u;
	while (1){
		cin >> a;
		if (a == 0){ break; }
		cin >> b;
		cin >> c;
		cin >> d;
		cin >> e;
		cin >> f;
		cin >> g;
		cin >> h;
		cin >> i;
		cin >> j;
		a -= b;
		a -= c;
		a -= d;
		a -= e;
		a -= f;
		a -= g;
		a -= h;
		a -= i;
		a -= j;
		cout << a << endl;
	}
	return 0;
}

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