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<bits/stdc++.h>
using namespace std;
int main(){
	while(1){
		int a, b =0,c;
		cin>>a;
		if(a == 0)break;
		for (int i = 1; i < 10 ;i++){
			cin>>c;
			b += c;
		}

		cout<<a - b<<endl;
	}
	return 0;
}

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

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) for(int i=0;i<(n);i++)

int main() {
	ios::sync_with_stdio(false);
	
	int s, a;
	while(cin>>s,s) {
		rep(i, 9) {
			cin>>a;
			s-=a;
		}
		cout << s << endl;
	}
	
	return 0;
}

C++: #include <stdio.h>

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

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

C++: #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef pair<int,int> pii;

int main(void) {
  int i,j;
  int sum;
  while(1){
    cin>>sum;
    if(sum==0)break;
    int n,s=0;
    rep(i,9){
      cin>>n;
      s+=n;
    }
    cout<<sum-s<<endl;
  }
}

C++: #include <iostream>
#include <functional>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <map>
#include <cmath>

using namespace std;

namespace _{struct _{_(){ // initialize
  cin.tie(0); ios::sync_with_stdio(false);
}}_;}
template <typename T, size_t size>
inline size_t len(const T (&)[size]) { return size; }
#define println(s) cout << s << '\n';
#define str to_string
#define rep(i, n) for (int i=0; i<int(n); i++)
#define all(c) (c).begin(), (c).end()


int main() {
  while (1) {
    int n; cin >> n;
    if (n == 0) break;

    int t = 0;
    rep(i, 9) {
      int k;
      cin >> k;
      t += k;
    }
    cout << n - t << endl;
  }
  return 0;
}

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


int main(){
int i,a,t;
cin>>a;
while(t<9){
    if(a==0)
           break;

    cin>>i;
    a=a-i;
    t++;
}
cout<<a<<'\n';
 return 0;

}

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

using namespace std;

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

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

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

C++: #include<cstdio>

using namespace std;
int main(void)
{
	int a,b;
	while(scanf("%d",&a) != 0)
	{
		int c = 0;
		for(int i = 1;i < 10;i++)
		{
			scanf("%d",&b);
			c += b;
		}
		c = a - c;
		printf("%d\n",c);
	}
	return 0;
}

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

C++: #include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(void){
    while(1){
	int n;
	int a;
	int sum=0;
	cin >> n;
	if(n==0)break;

	for(int i=0;i<10;i++){
        cin >> a;
        sum+=a;
        }
    a=n-sum;

    cout<<a<<endl;
    }



	return 0;
}

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

int main(){
  int a[11]={};

  for(int i =0;i < 11;i++)
    {
      cin >> a[i];
      if(a[i]==0)
	{
	  break;
	}
    }
  for(int j =1;j < 11;j++)
    {
      a[0] -= a[j];
    }
  cout << a[0] << 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;
	cin >> a;
	while (1)
	{
		cin >> b;
		if (b == 0){ cout << a << endl;break; }
		a -= b;
	}	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep2(i, s, n) for (int i = s; i < (int)n; i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

int main () {
	int sum, p;
	while (true) {
		cin >> sum;
		if (sum == 0) break;
		rep(i, 9) {
			cin >> p;
			sum -= p;
		}
		cout << sum << endl;
	}	
}

C++: #include <iostream>
using namespace std;
int main(void)
{
	for (;;)
	{
		int a,b,c,d;
		cin>>a;
		if (a==0)
		{
			break;
		}
		d=0;
		for (b=0;b<10;b++)
		{
			cin>>c;
			d=d+c;
		}
		b=a-d;
		cout<<b<<endl;
	}
	return 0;
}

C++: //2009
#include<iostream>
using namespace std;
int main(void){
	int sum=0,a[10]={0},sum2=0;
	while(1){
	cin>>sum;
	if(sum==0){break;}
	for(int i=0;i<9;i++){
		cin>>a[i];
		sum2+=a[i];
	}
	cout<<sum-sum2<<endl;
	sum2=0;}
	return 0;
}

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

C++: #include<cstdio>
using namespace std;
int main(void)
{
	int i,x=0,kin,gou;
	scanf("%d",&gou);
	while(1){
		scanf("%d",&kin);
		if(kin==0){
			gou=gou-x;
			printf("%d",gou);
			break;
		}
		x+=kin;
	}
	return 0;
}

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

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