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 <stdio.h>

int main(void) {
  int a, max, i;
  while( 1 ) {
    scanf("%d", &max);
    if(!max) break;
    for(i = 0; i < 9; ++i) {
      scanf("%d", &a);
      max -= a;
    }
    printf("%d\n", max);
  }
  return 0;
}

C++: #include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
 
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)

int main(){
    int sum;
    int m;

    while(1){
    scanf("%d",&sum);
    if(sum == 0)
        break;
    REP(i,9){
        scanf("%d",&m);
        sum -= m;
    }
    printf("%d\n",sum);
    }
    return 0;
}

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

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

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

int main() {
	cout<<in()-in()-in()-in()-in()-in()-in()-in()-in()-in()<<endl;
	return 0;
}

C++: #include <stdio.h>
int main(){
  int i,sum,n;

  scanf("%d",&sum);
  for(i=0;i<9;i++){
    scanf("%d",&n);
    sum -= n;
  }
  printf("%d\n",sum);
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const ll mod = 1e9 + 7;


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

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

int main() {
	int all, b1, b2, b3, b4, b5, b6, b7, b8, b9;
	cin >> all >> b1 >> b2 >> b3 >> b4 >> b5 >> b6 >> b7 >> b8 >> b9;
	cout << all - b1 - b2 - b3 - b4 - b5 - b6 - b7 - b8 - b9 << endl;
}

C++: #include<iostream>
using namespace std;
int main()
{
	int add;
	int sum = 0;
	int ans;
	int re[8] = {};
	cin >> add;
	for (int i = 0; i < 9; i++){
		cin >> re[i];
		sum += re[i];
	}
	ans = add - sum;
	cout << ans << endl;

	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
	int n;
	while(cin>>n &n){
	for(int i=0;i<9;i++){
		int x;
		cin>>x;
		n-=x;
	}
	
	cout<<n<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int main()
{
    while(1)
    {
        int tm;
        cin>>tm;if(!tm)return 0;
        for(int i=0;i<9;++i){
            int buf;
            cin>>buf;
            tm-=buf;
        }
        cout<<tm<<endl;
    }
}

C++: #include <vector>
#include <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n;
    while(cin>>n,n){
        int t;
        rep(i,9){cin>>t;n-=t;}
        cout<<n<<endl;
    }
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
using namespace std;
int main()
{
	int a=0;
	int b;
	int c;
	int d;
	int e;
	int f;
	int g;
	int h;
	int i;
	int j;
	while (a != 0)
	{
		cin >> a;
		cin >> b;
		cin >> c;
		cin >> d;
		cin >> e;
		cin >> f;
		cin >> g;
		cin >> h;
		cin >> i;
		cin >> j;
		cout << a - b - c - d - e - f - g - h - i - j << endl;
	}
	return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
  int n,t,ans=0;
  while(1){
  cin >> t;
  if(t==0) break;
  for(int i=0; i<9; i++){
	cin >> n;
	ans += n;
  }
  if(t==0){
  } else {
  cout << t-ans << endl;
  }
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int t,x,sum=0;
	while(1){
	cin>>t;
	if(t==0)break;
	
for(int i=0;i<9;i++){
	cin>>x;
	sum=sum+x;
}

	cout<<t-sum<<endl;
}
return 0;
}