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;
cin>>total;
int a=0;
int b=0;
int buy=0;

for(int i=1;i<=9;i++){
cin>>a;
b=total-a;
total=b;
}

cout<<total<<'\n';

return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <functional>
#include <numeric>
#include <cmath>
#include <cstring>
#include <queue>

using namespace std;
int n;

const int INF = 1 << 29;

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

C++: //2009
#include<iostream>
using namespace std;
int main(void){
	int sum=0,a[10]={0},sum2=0;
	cin>>sum;
	for(int i=0;i<9;i++){
		cin>>a[i];
		sum2+=a[i];
	}
	cout<<sum-sum2<<endl;
	return 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++: #include <iostream>
using namespace std;
int main(){
  int n,s=0,p=9,a;
  cin>>n;
  while(p--){
    cin>>a;
    s+=a;
  }
  cout<<n-s<<endl;
}

C++: #include<stdio.h>

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

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

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

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

using namespace std;

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

C++: #include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <sstream>
#include <set>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define repp(i,k,n) for(int i=k;i<(int)n;i++)
#define rei(n) for(int i=0;i<(int)n;i++)
#define rel(n) for(int l=0;l<(int)n;l++)
#define al(s) s.begin(),s.end()
#define INT_MAX 2147483647
#define debug(x) cout<<#x<<": "<<x<<endl;
#define PI 2*acos(0,0)
#define pb push_back
#define inin(x) int x; cin>>x;
#define ll long long

typedef pair<int, int> pii;

struct Calendar
{
	long long year;
	long long month;
	long long day;
	long long dat[2][13];
	Calendar(long long y, long long m, long long d)
	{
		year = y;
		month = m;
		day = d;
		dat[0][0] = dat[1][0] = 0;
		dat[0][1] = dat[1][1] = 31;
		dat[0][2] = dat[1][2] = 28;
		dat[0][3] = dat[1][3] = 31;
		dat[0][4] = dat[1][4] = 30;
		dat[0][5] = dat[1][5] = 31;
		dat[0][6] = dat[1][6] = 30;
		dat[0][7] = dat[1][7] = 31;
		dat[0][8] = dat[1][8] = 31;
		dat[0][9] = dat[1][9] = 30;
		dat[0][10] = dat[1][10] = 31;
		dat[0][11] = dat[1][11] = 30;
		dat[0][12] = dat[1][12] = 31;
		dat[1][2] = 29;
	}
	int uruu()
	{
		if (year % 4 == 0)
		{
			if (year % 400 != 0 && year % 100 == 0)
			{
				return 0;
			}
			else
			{
				return 1;
			}
		}
		return 0;
	}
	int uruu(long long y)
	{
		if (y % 4 == 0)
		{
			if (y % 400 != 0 && y % 100 == 0)
			{
				return 0;
			}
			else
			{
				return 1;
			}
		}
		return 0;
	}
	long long pday(long long d)
	{
		day += d;
		for (;; month++)
		{
			if (month >= 13)
			{
				year++;
				month = 1;
			}

			if (dat[uruu()][month] < day)
			{
				day -= dat[uruu()][month];
			}
			else
			{
				break;
			}
		}
		pmonth(0);
		return d;
	}
	long long pmonth(long long m)
	{
		month += m;
		for (;; year++)
		{
			if (month > 12)
			{
				month -= 12;
			}
			else
			{
				break;
			}
		}
		return m;
	}
	long long pyear(long long y)
	{
		year += y;
		return y;
	}
	long long dif(Calendar c)
	{
		long long ans = 0;
		Calendar a(year, month, day);
		ans -= a.day;
		ans += c.day;
		a.day = 0;
		c.day = 0;
		for (; a.month >= 1; a.month--)
		{
			ans -= dat[a.uruu()][a.month-1];
		}
		for (; c.month >= 1; c.month--)
		{
			ans += dat[c.uruu()][c.month-1];
		}
		for (; a.year != c.year; a.year++)
		{
			ans += 365;
			if (a.uruu())ans++;
		}
		return ans;
	}


};




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

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

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

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

C++: #include <iostream>
using namespace std;
int main(){
    int a;
    int b[10];
    cin>>a;
    for(int i=0;i<10;i++){
        cin>>b[i];
        a-=b[i];
    }
    cout<<a<<endl;
}

C++: #include<stdio.h>

int main(void){
  int hh,mm,ss,sec;
  scanf("%d%d%d",&hh,&mm,&ss);
  sec=-(3600*hh+60*mm+ss);
  scanf("%d%d%d",&hh,&mm,&ss);
  sec+=3600*hh+60*mm+ss;
  printf("%d %d %d\n",sec/3600,sec/60%60,sec%60);

  scanf("%d%d%d",&hh,&mm,&ss);
  sec=-(3600*hh+60*mm+ss);
  scanf("%d%d%d",&hh,&mm,&ss);
  sec+=3600*hh+60*mm+ss;
  printf("%d %d %d\n",sec/3600,sec/60%60,sec%60);

  scanf("%d%d%d",&hh,&mm,&ss);
  sec=-(3600*hh+60*mm+ss);
  scanf("%d%d%d",&hh,&mm,&ss);
  sec+=3600*hh+60*mm+ss;
  printf("%d %d %d\n",sec/3600,sec/60%60,sec%60);
  
  return 0;
}