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>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
typedef long long ll;

int main(){
	int a[10];
	while(scanf("%d",&a[0]),a[0]){
		for(int i=1;i<10;i++)scanf("%d",&a[i]);
		int sum=0;
		for(int i=1;i<10;i++)sum+=a[i];
		printf("%d\n",a[0]-sum);
	}
}

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

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

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

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

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

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int sum, n;

int main(){
	cin >> sum;
	REP(i, 9){
		cin >> n;
		sum -= n;
	}
	cout << sum << endl;
}

C++: #include <iostream>

int main() {

	int sum = 0, book[9] = {};
	
	do{

		std::cin >> sum;
	
		for (int i = 0; i < 9; i++) {
			std::cin >> book[i];
		}
		for (int j = 0; j < 9; j++) {
			sum = sum - book[j];
		}
		std::cout << sum << std::endl;

	} while (sum == 0);

	return 0;
}

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

int	main(){

	while(true){
	
	int A,B,C,D,E,F,G,H,I,J,answer;
		
	cin >> A;
	if(A == 0) return 0;
	cin >> B >> C >> D >> E >> F >> G >> H >> I >> J;
	answer = A - B - C - D-E-F-G-H-I-J;
	cout << answer << 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<cstdio>
#include<string>
#include<algorithm>
using namespace std;

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

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

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

C++: #include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<bitset>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = (j); i < (k); i++)
typedef long long ll;
typedef pair < int , int > Pii;
int main(){
	int ans;
	while(scanf("%d",&ans),ans){
		rep(i,9){
			int tmp;
			scanf("%d",&tmp);
			ans -= tmp;
		}
		printf("%d\n",ans);
	}
	return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){

	int a[10], sum;
	int sum1 = 0;
	for(int j=0;j<5;j++){
		cin>>sum;
		if(sum == 0) break;
		for(int i=0;i<9;i++){
			cin>>a[i];
			sum1 += a[i];
		}
		cout<<sum - sum1<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <array>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int i = (a); i < (b); i++)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vsort(x) sort(x.begin(),x.end())

using int64 = uint64_t;

using namespace std;
void solve(int* array) {
	int sum = 0;
	rep(i, 1, 10) {
		sum += array[i];
	}
	cout << array[0] - sum << endl;
}
int main() {

	int i, j, k;
	int a[10];
	rep(i, 0, 10) {
		cin >> a[i];
	}
	while (a[0] != 0) {
		solve(a);
		rep(i, 0, 10)
			cin >> a[i];
	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define range(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i, a) range(i, 0, a)
using namespace std;

int main() {
    int sumAll;
    while(cin >> sumAll, sumAll) {
        int a[9], sum = 0;
        rep (i, 9) cin >> a[i], sum += a[i];
        cout << sumAll - sum << endl;
    }
    return 0;
}

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

int main() {
	int a;
	int b[9];
	while (cin >> a&&a != 0) {
		for (int i = 0; i < 9; i++) {
			cin >> b[i];
		}
		for (int i = 0; i < 9; i++) {
			a -= b[i];
		}
		cout << a << endl;
	}
	return 0;
}

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

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

C++: import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		while (true)
		{
			int total = sc.nextInt();
			if (total == 0)break;
			for (int i = 0; i < 9; i++)
			{
				total -= sc.nextInt();
			}
			System.out.println(total);
		}
	}
}