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<stdio.h>
int main(void)
{
	int sougaku, money, nazo;
	scanf_s("%d", &sougaku);
	nazo = sougaku;
	for (int i = 0; i < 9;i++){
		scanf_s("%d", &money);
		nazo = nazo - money;
	}
	printf("%d\n", nazo);
	return 0;
}

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

using namespace std;

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

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

int main() {
  int a;
  while (cin >> a, a) {
    int t, b = 0;
    for (int i = 0; i < 9; i++) {
      cin >> t;
      b += t;
    }
    cout << a - b << "\n";
  }
}

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

C++: // Tazoe

#include <iostream>
using namespace std;

int main()
{
while(true){
	int total;
	cin >> total;
if(total==0)  break;
	int p1, p2, p3, p4, p5, p6, p7, p8, p9;
	cin >> p1;
	cin >> p2;
	cin >> p3;
	cin >> p4;
	cin >> p5;
	cin >> p6;
	cin >> p7;
	cin >> p8;
	cin >> p9;

	int p10 = total-p1-p2-p3-p4-p5-p6-p7-p8-p9;

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

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){break;}
		a[0] = a[0] - a[i];
		i++;		
	}
	cout << a[0] << endl;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <stack>
#include <numeric>
#include <algorithm>
#include <tuple>
#include <stdio.h>
#include <bitset>
#include <limits.h>
#include <complex>
#include <deque>
#include <iomanip>
#include <list>
#include <cstring>
using namespace std;
#define pi pair<int,int>
#define pl pair<long long,long long>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define en cout << endl //セミコロンつけろ
//#define MM 1000000000
//#define MOD MM+7
typedef long long ll;
const int MM = 1e9;
const int MOD = MM+7;
const long double PI = acos(-1);
const long long INF = 1e15;
int dx[8] = {-1,0,1,0,-1,-1,1,1};
int dy[8] = {0,-1,0,1,-1,1,1,-1};
// 'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122
template<typename T>
T GCD(T u,T v){
    return v ? GCD(v,u%v) : u;
}
template<typename T>
T LCM(T x,T y){
    T gc = GCD(x,y);
    return x*y/gc;
}
struct edge {
    ll to,cost;
};
/*
const int COM_MAX = 500500;
long long fac[COM_MAX],finv[COM_MAX],inv[COM_MAX];
void init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < COM_MAX; i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD;
        finv[i] = finv[i-1]*inv[i]%MOD;
    }
}
long long COM(int n,int k){
    if(n < k || n < 0 || k < 0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}
*/
int main(){
    while(true){
        int sum; cin >> sum;
        if (sum == 0){
            break;
        }
        int res = 0;
        for (int i = 0; i < 9; i++){
            int a; cin >> a;
            res += a;
        }
        cout << sum-res << endl;
    }
}

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

	return 0;
}

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

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

C++: #include "bits/stdc++.h"

using namespace std;

const char en = '\n';
using  ll =          long long;
using ull = unsigned long long;

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

int main(){
	ios::sync_with_stdio(false);cin.tie();
	
	while(true){
		int sum,buf;
		cin>>sum;
		if(sum==0) break;

		REP(j, 9){
			cin>>buf;
			sum-=buf;
		}
		cout<<sum<<en;
	}

	return 0;
}

C++: #include <stdio.h>
#include <cstring>

int main(){
  int i1[2] = {0};
  int ansers[5] = {0};
  int total = 1;
 
  for(int n = 0;n < 6; n++){
    scanf("%d",&total);
    if(total == 0){
      for(int x = 0; x < n; x++) printf("%d\n",ansers[x]); 
      return 0;
    }
    memset(i1,0,sizeof(i1));

    for(int n = 0; n < 9; n++){
      scanf("%d",&i1[1]);
      i1[0] += i1[1];
    }
    ansers[n] = total - i1[0];
  }
}

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

C++: //============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <algorithm>
using namespace std;
typedef long long ll;


int main() {
	int n;
	int a,b,c,d,e,f,g,h,i;
	cin>>n;
	cin>>a;
	cin>>b;
	cin>>c;
	cin>>d;
	cin>>e;
	cin>>f;
	cin>>g;
	cin>>h;
	cin>>i;


	cout<<n-(a+b+c+d+e+f+g+h+i)<<endl;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
int main(){
	int n,a[9],k=0;
	cin>>n;
	for(int i=0;i<9;i++){
		cin>>a[i];
		k+=a[i];
	}
	cout<<n-k<<endl;
	return 0;
	}

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