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

C++: #include<iostream>
 
using namespace std;
 
int main(){
    int m,k;
    cin>>m;
    if(m=0){
    	return 0;
    }
    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(){


for(int i=0;i < 10;i++){

   int y;
   cin>>y;
 

  int x, t;
  cin>>x>>t;
  x = (10000 - t) - y;

if( x == 0) break;
    
 
  cout<<t<<endl;

 }
 
  return 0;
}

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

C++: #include <iostream>
using namespace std;
int main(){
     int a,b,i=0;
     cin>>a;
     if(a>10000){
      cout<<"エラー"<<endl;
}
do{
     cin>>b;
     a=a-b;i++;
}while(i<=8);
if(i==9){
     cout <<a<<endl;
}


return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=1<<18,INF=1<<30;

int main(){
    
    while(1){
        vector<int> A(10);
    int ans=0;
    for(int i=0;i<10;i++){
        cin>>A[i];
        if(i==0) ans+=A[i];
        else ans-=A[i];
        
        if(i==0&&ans==0) return 0;
    }
    cout<<ans<<endl;
    }
    
}

C++: #include<stdio.h>
int main(void)
{
	int sougaku, money, nazo;
	scanf_s("%d", &sougaku);
	nazo = sougaku;
	scanf_s("%d", &money);
	while (money != 0){
		nazo = nazo - money;
		scanf_s("%d", &money);
	}
	printf("%d\n", nazo);
	return 0;
}

C++: #include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <functional>
#include <utility>
#include <algorithm>
#include <numeric>
#include <typeinfo>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <ctime>

using namespace std;

#define dump(n) cout<<"# "<<#n<<"="<<(n)<<endl
#define debug(n) cout<<__FILE__<<","<<__LINE__<<": #"<<#n<<"="<<(n)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,n) repi(i,0,n)
#define iter(c) __typeof((c).begin())
#define foreach(i,c) for(iter(c) i=(c).begin();i!=(c).end();i++)
#define allof(c) (c).begin(),(c).end()
#define mp make_pair

typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int main()
{
	vi a(10);
	rep(i,10)
		cin>>a[i];
	cout<<a[0]-accumulate(1+allof(a),0)<<endl;
	
	return 0;
}

C++: #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    while(true){
	int m;
	cin >> m;
	if(m==0) break;
	REP(i,9) {
	    int temp;
	    cin >> temp;
	    m -= temp;
	}
	cout << m << endl;
    }
    return 0;
}

C++: #include<cstdio>

int main(){
	int total;

	while(1){
		scanf("%d",&total);
		if(total == 0)break;

		int sum = 0;
		for(int i=0;i<9;i++){
			int tmp;
			scanf("%d",&tmp);
			sum += tmp;
		}
		printf("%d\n",total-sum);
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
int sum;
void solve(){
  int price[10]; 
  for (int i = 0; i < 9; i++){
    scanf("%d", &price[i]);
    sum -= price[i];
  }
  printf("%d\n", sum);
}

int main(){
  while (scanf("%d", &sum), sum) solve();
}

C++: #include <iostream>

using namespace std;

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

C++: #include <stdio.h>


int main(void){
	int sum, p;


	while (true){
		scanf("%d", &sum);
		if (sum == 0){ break; }
		for (int i = 0; i < 9; i++){
			scanf("%d", &p);
			sum -= p;
		}
		printf("%d\n", sum);
	}


	return 0;
}