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(){
  while(1){
    int total;
    cin >> total;
    if(total == 0) break;

    int sum = 0;

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

    cout << total - sum << endl;
  }
}

C++: #include<stdio.h>
int main()
{
	int sougaku=0,sum=0,money=0,amari[100]={0},k=0;
	scanf("%d",&sougaku);
	while(sougaku!=0){
		for(int i=0;i<9;i++){
			scanf("%d",&money);
			sum=sum+money;
		}
		amari[k]=sougaku-sum;
		k++;
		amari[k]=0;
		scanf("%d",&sougaku);
	}
	for(int i=0;i<k;i++){
		printf("%d\n",amari[i]);
	}
	return 0;
}

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

int main(){
  int n,re[10],ans;
  while(1){
    cin >> n;
    if(n == 0) break;
    ans = 0;
    for(int i=0;i<9;i++){
      cin >> re[i];
      ans += re[i];
    }
    ans = n - ans;
    cout << ans << endl;
  }
}

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
using namespace std;
int main(void)
{
	while(1)
	{
	int a,b;
	scanf("%d",&b);
	if(b==0){break;}
	for(int i=0;i<9;i++){
		scanf("%d",&a);
		b-=a;
	}
	printf("%d\n",b);
	}
	return 0; 
}

C++: #include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0;i < N;i++)
int main()
{
  int sum;
  int data;
  while(cin >> sum,sum){
    Rep(i,9) {
      cin >> data;
      sum -= data;
    }
    cout << sum << endl;
  }
  return 0;
}

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

int main(){
  int num;


  cin >> num;

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

    num -= work;
  }

  cout << num << endl;
  
  return 0;
}

C++: #include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main() {
	int n;
  	while(cin>>n){
	int sum = 0;
    if(n==0) break;
	for (int i = 0; i < 10; i++) {
		int x;
		cin >> x;
		sum += x;
	}
	cout << n-sum << endl;
    }
}

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

int n;

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

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

int main()
{
    int sum;
    int price[9];
    int pricesum = 0;

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

    cout << sum - pricesum << endl;

    return (0);
}

C++: #include<stdio.h>
int main(void)
{
	int n;
	int m[10];
	int l,s;
	int i;
	
	scanf("%d",&n);
	while(n!=0){
		l=0;
		for(i=0;i<9;i++){
			scanf("%d",&m[i]);
			l=l+m[i];
		}
		s=n-l;
		printf("%d\n",s);
		scanf("%d",&n);
	}
	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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>

using namespace std;

typedef unsigned uint;
typedef long long Int;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }

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

    return 0;
}

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

int main() {

	ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

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

C++: #include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
	int i, g = 0, n, j;
	cin >> j;
	g = j;
	for (i = 0; i < 9; i++)
	{
		cin >> n;
		g -= n;
	}
	cout << g << endl;
	return 0;
}

C++: #include<string>
#include<cstdio>
#include<cctype>
#include<iostream>
#include <algorithm>
#include<cmath>
#include<queue>
using namespace std;

int main(){
        int ans, book[15]={0}, s;
        while(1){
        cin >>s;
        if(s==0)break;
        for(int i=0;i<9;i++){
                scanf("%d",&book[i]);
                s-=book[i];
            }
        cout <<s<<endl;
        }
    return 0;
}

C++: #include <cstdio>

int main(){
	int a,b;
	for(a=0;scanf("%d",&b),b;)
		a?a-=b:a=b;
	printf("%d\n",a);
}

C++: #include<iostream>
using namespace std;
	int main(){
	int a,b;int sum=0;
	int sums[5000];int k=0;
	while(cin>>sum){
	if(sum==0)break;
	for(int i=0;i<9;i++){
		cin>>b;
		sum-=b;
	}
	cout<<sum<<endl;
	}
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
#define INF ( 1 << 30 )
int main(){
  int a;
  while(cin >> a ,a){
    for(int i = 0 ; i < 9 ; i++ ){
      int b;
      cin >> b;
      a -= b;
    }
    cout << a << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int sum,b;
	while(cin>>sum,sum){
    	for(int i=0;i<9;i++){
    		cin>>b;
    		sum-=b;
    	}
    	cout<<sum<<endl;
	}
}