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 <vector>
#include <array>
#include <numeric>

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int d;
    std::vector<int> data;

    while (std::cin >> d && d != 0) data.push_back(d);

    for (int i = 0; i < data.size() / 10; i++) {
        std::cout << data.at(i * 10) - std::accumulate(data.begin() + 1 + i * 10, data.begin() + 9 + i * 10, 0) << "\n";
    }

    return 0;
}

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

int main(){
 int h;
 int x;
 int y;
 int z;
 int a;
 int b;
 int c;
 int d;
 int f;
 int g;
 int i;
 cin>>h>>x>>y>>z>>a>>b>>c>>d>>f>>g>>i;
int e =h-x-y-z-a-b-c-d-f-g-i;

cout<<e<<endl;
}

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

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

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

C++: #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};
 
int main()
{
	while (1){
		int n;
		cin >> n;
		if (!n) return 0;
		int sum = 0, tmp;
		REP(i, 9){
			cin >> tmp;
			sum += tmp;
		}
		cout << n - sum << endl;
	}
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int sum,a;
    while(1){
        cin >> sum;
        if(sum==0){break;}
        for(int i=0;i<9;i++){
            cin >> a;
            sum-=a;
        }
        cout << sum << endl;
    }
    
    return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

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

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

int main(){
	int total;
	int books;

         cin>>total;
	while(true){
		
            cin>>books;
           if(books==0){
              break;
           }
	   total-=books;
	}
	cout<<total;
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <limits>
typedef long long ll;
#define REP(i,n)   for(int i=0; i<(int)(n); ++i)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); ++i)

#define in cin
#define out cout
#define pb push_back
using namespace std;

int main(){
	int sum;
	while (in >> sum) {
		if (!sum)break;
		int a, b = 0;
		REP(i, 9) {
			in >> a;
			b += a;
		}
		out << sum - b << endl;
	}
	return 0;

}

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

int main()
{
	int n1,n2,n3,n4,n5,n6,n7,n8,n9,Kei;
while(true){

	cin >> Kei;
	if (Kei==0)
		break;



	cin >> n1;
	cin >> n2;
	cin >> n3;
	cin >> n4;
	cin >> n5;
	cin >> n6;
	cin >> n7;
	cin >> n8;
	cin >> n9;
	cout << Kei-(n1+n2+n3+n4+n5+n6+n7+n8+n9) << endl;
}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int n, total;
    while (cin>>n, n) {
        total = 0;
        for (int i = 0; i < 9; ++i) {
            int tmp;
            cin>>tmp;
            total += tmp;
        }
        cout<<n - total<<endl;
    }
    return 0;
}

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

int main(){
	int total,book;
	int c=0;
	while(true){
	if(c==0){
		cin >> total;	
	}
	if(total==0){
		break;
	}
	c++;
	}else{
	cin >> book ;
	total -= book;
	c++;
	}
	if(c==10){
	cout << total << '\n';
	c==0;
	}	
	return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

	int book , sum;
	cin >> sum;

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

	cout << sum << endl;

	return 0;
}