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(){
 int h;
 int x;
 int y;
 int z;
 int a;
 int b;
 int c;
 int d;
 int f;
 int g;
 cin>>h>>x>>y>>z>>a>>b>>c>>d>>f>>g;
int e =h-x-y-z-a-b-c-d-f-g;

cout<<e<<endl;
}

C++: 	#include <iostream>

	using namespace std;

	int main()
	{
		
		int all , a , b ;

		cin >> all ;
		cin >> b ;
		a=b;
		cin >> b ;
		a=a+b;
		cin >> b ;
		a=a+b;
		cin >> b ;
		a=a+b;
		cin >> b ;
		a=a+b;
		cin >> b ;
		a=a+b;
		cin >> b ;
		a=a+b;
		cin >> b ;
		a=a+b;
		cin >> b ;
		a=a+b;
	
		cout << all-a << '\n';

		return 0;
	}

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vd = vector<double>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vpii = vector<pii>;
using vvi = vector<vi>;
using vvb = vector<vb>;
using vvpii = vector<vpii>;
template<typename A> using fn = function<A>;
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
constexpr bool odd(const int &n) { return n & 1; }
constexpr bool even(const int &n) { return !odd(n); }
void solve();
main { solve(); return 0; }
// clang-format on

void solve() {
  int n;
  while (cin >> n, n) {
    int s = 0;
    rep(i, 9) {
      int x;
      cin >> x;
      s += x;
    }
    cout << n - s << endl;
  }
}

C++: #include <iostream>
#include<stdio.h>
using namespace std;
 
int main(){
  int a,i;
  int hon[1001];

  i=0;
  hon[0]=0;
  while(1)
    {
      scanf("%d",&a);
      
      i=i+1;
      scanf("%d",&hon[i]);
      if(hon[i]==0)
	{
	  break;
	}

      hon[0]=hon[0]+hon[i];
    }

  i=a-hon[0];
  printf("%d\n",i);

  return 0;
}

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

int main() 
{ 
 int num,a,i; 
 cin >>num;
 i=1;
 while(i<10){
      cin>>a;
      num=num-a;
      i++;
 }
 cout<<num<<"\n"; 
 return 0; 
}

C++: #include<iostream>

using namespace std;

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

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

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

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


 int main()
 {
	int total;
	int books;
		int count=0;

	while(true){
		if(count==0){
		  cin>>total;		
		  if(total==0){
			break;
		  }
		  count++;
		}else{
		 cin>>books;
		 total-=books; 
		 count++;
		}
		if(count==10){
		cout<<total<<'\n';
		count=0;
		}
	}
       return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main() {
	int total;
	int hon;
	int booktotal=0;
	int book[9];
	int i=0;
	scanf("%d", &total);
	while(i<9){
		scanf("%d", &book[i]);
		booktotal = booktotal + book[i];
		i++;
	}
	hon = total - booktotal;
	printf("%d\n", hon);
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  int aa[10] = {0};
  int ans = 0, sum = 0;
  for(int i = 0; i < 10; i++)
    cin >> aa[i];
  for(int i = 1; i < 10; i++)
    sum += aa[i];
  ans = aa[0] - sum;
  cout << ans << 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;
          }else{
            total-=books;
          }
	}
	cout<<total<<'\n';
	return 0;
}

C++: #include <cstdio>

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

C++: #include<iostream>

using namespace std;

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

C++: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>

using namespace std;

typedef unsigned uint;
typedef long long Int;

const int INF = 1001001001;
const Int INFLL = 1001001001001001001LL;

template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<typename T> void chmin(T& a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T& a, T b) { if (a < b) a = b; }

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

    return 0;
}

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

int main()
{
  int a, b, c, d, e, f, g, h, i, j,k;
  
  cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
  k=a-(b+c+d+e+f+g+h+i+j);
  cout<<k<<'\n';
  return 0;
}