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>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
int main(){
	int a;
	while(cin>>a,a){
		int sum=0;
		rep(i,9){
			int b;cin>>b;
			sum+=b;
		}
		cout<<a-sum<<endl;
	}
}

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

int main()
{
	int num1,num2,num3,num4,num5,num6,num7,num8,num9,num10,num11;

	cin>>num1>>num2>>num3>>num4>>num5>>num6>>num7>>num8>>num9>>num10;
	num11=num1-num2-num3-num4-num5-num6-num7-num8-num9-num10;
	cout<<num11;
	cout<<"\n";
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  int all;
  while(cin>>all){
    if(all == 0) break;
    for(int i=0; i<9; i++){
      int a; cin>>a;
      all-=a;
    }
    cout << all << endl;
  }
  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;
	if(k=0){
		break;
	}
	}
	cout<<m<<endl;
	return 0;A
}

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

C++: 
#include <iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a[9],n,sum=0;
    while(cin>>n){
        if(n==0)break;
        for(int i=0;i<9;i++){
            cin>>a[i];
            sum+=a[i];
        }
        cout<<n-sum<<endl;
        sum=0;
    }
    return 0;
}

C++: #include <iostream>

int main() {

	int sum = 1, book[9] = {};

	while(sum != 0) {

		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;

	}

	return 0;
}

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

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

using namespace std;

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

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;


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

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

C++: #include <stdio.h>

main()
{
	int S,a,b,i;
	a=0;
	for(i=1;i<12;i++){
		scanf("%d",&S);
		scanf("%d",&b);
		a+=b;
	}
	printf("%d",S-a);
}

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

int main(){
  int N, x[50];
  int X = 0;
  cin>>N;

  for(int i=0;i < 50;i++){
    cin>>x[i];
    if(x[i] == 0) break;

    X += x[i];
  }
  cout<<N - X<<endl;

  return 0;
}

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

int main(){


  while(1){

    int T;
    cin>>T;

    
    if(T == 0){
      break;
    }
    
    for(int i=0;i<9;i++){

      int y;
      cin>>y;

      T=T-y;

    }

    

    cout<<T<<endl;
  }   
  
  return 0;
}