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 <cstdio>

int main(){
	int a,b,i;
	for(;scanf("%d",&a),a;printf("%d\n",a)){
		for(i=9;i--;a-=b){
			scanf("%d",&b);
		}
	}
}

C++: #include <iostream>
 
using namespace std;
 
int main()
{
	int total,books;
	while(true){
		cin>>total;
		if(total==0)
			break;
		}
	for(int i=1;i<=9;i++){
	cin>>books;
	total-=books;
	cout<<total<<"\n";
	}

    return 0;
}

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

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)

int main(void){
  int sum;
  while(cin>>sum){
    if(sum==0) break;
    REP(i,9){
      int tmp;
      cin>>tmp;
      sum-=tmp;
    }
    cout<<sum<<endl;
  }
  return 0;
}

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);

    int sum = 0;

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

    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <string>
#include <string.h>
#include <cstring>
#include <sstream>
#include <iomanip>
#include <stdlib.h>

using namespace std;

int main (void)
{
	for (int u = 0; u < 5; u++)
	{
		long n,a[9];

		cin >> n;
		if (n == 0)
		{
			break;
		}

		for (int i = 0; i < 9; i++)
		{
			cin >> a[i];
		}

		int o = 0;

		for (int i = 0; i < 9; i++)
		{
			o += a[i];
		}

		cout << n - o << endl;
	}
}

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

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

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

#define CEIL(a,b) ((a) / (b) + ((a) % (b) == 0 ? 0 : 1))

using namespace std;
using ll = long long;
using pii = pair<int, int>;

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'000'000'001;
constexpr ll LLINF = 4'000'000'000'000'000'001;
// constexpr int INF = 2147483647; // 2 * 1e9
// constexpr ll LLINF = 9223372036854775807; // 9 * 1e18

const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1, 0};
const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1, 0};

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    while(true){
        int n;
        cin >> n;
        if(n == 0) break;
        vector<int> a(9);
        for(int i = 0; i < 9; ++i){
            cin >> a[i];
        }
        cout << n - accumulate(begin(a), end(a), 0)  << "\n";
    }
    return 0;
}

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(){
	while (cin >> sum&&sum){
		REP(i, 9){
			cin >> n;
			sum -= n;
		}
		cout << sum << endl;
	}
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
typedef long long ll;

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

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <fstream>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toStr(T x) { ostringstream sout; sout << x; return sout.str(); }
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / 10;

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

	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;
return 0;
}