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 <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <bitset>
#include <numeric>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

#define rep(i,n) for(int i = 0; i<n ; i++)
#define FOR(i,a,n) for(int i=a; i<n; i++)
#define REPSTR(i,s) for(int i=0; (s)[i]; i++)
#define REPITR(i,s) for(auto i=(s)begin(); i!=(s).end();i++)

#define RANGE(a,i,b) ((a)<=(i)&&(i)<=(b))

#define pb push_back
#define mp make_pair

#define ALL(a) (a).begin(), (a).end()

#define EXIST(s,x) ((s).find(x)!=(s).end())

#define SET(a,c) memset(a,c,sizeof(a))
#define CLR(a) memset(a,0,sizeof(a))

#define DEBUG(x) cerr<<#x<<":"<<x<<endl
#define PRINTJOIN(x,n) rep(i,n){if(i)cout<<" ";cout<<x[i];}cout<<endl 

#define INF 1001001001
#define LLINF 1001001001001001001LL

typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef stringstream SS;

#define PQ priority_queue

#define FST first
#define SEC second

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

//------------------HEAD---------------------

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(true){
    int n;
    cin>>n;
    if(n==0)return 0;
    rep(i,9){
        int t;cin>>t;
        n-=t;
    }
    cout<<n<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>

using namespace std;

    int main(){
        int price[11]={0},allprice,Ans;
        cin>>allprice;
        for(int i=0;i<9;i++){
            cin>>price[i];
        }
        for(int i=0;i<9;i++){
            price[10]+=price[i];
        }
        Ans=allprice-price[10];
        cout<<Ans;
     return 0;
    }

C++: #include <bits/stdc++.h>
using namespace std;
// #define int long long
typedef long long ll;
typedef pair<int,int> pii;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define RREP(v,n) for(int v=(int)(n);v>=0;v--)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;
const ll INFLL = 1e18;
template<class T,class U>ostream&operator<<(ostream &os,const pair<T,U> &p){
    os<<"("<<p.first<<","<<p.second<<")";return os;}
template<class T>ostream&operator<<(ostream &os,const vector<T> &v){
    ITR(i,v)os<<*i<<(i==end(v)-1?"":" ");return os;}
//------------------------------------------------------------------------------

signed main() {
    int s=0,all;
    cin>>all;
    REP(i,9) {
        int a;
        cin>>a;
        s+=a;
    }
    cout<<all-s<<endl;
    return 0;
}

C++: //2009年　情報オリンピック予選　1問目
#include<iostream>
using namespace std;
int main(){

	int a,sum=0,b;
	cin>>a;
	for(int i=0;i<9;i++){
	cin>>b;
	sum+=b;
	}

	cout<<a-sum<<endl;


	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int cost[10],sum;

  while(cin >>sum && sum != 0){
 
  for(int i=0;i<9;i++){
    cin >>cost[i];
    sum-=cost[i];
  }
  cost[9] = sum;
  cout <<cost[9]<<endl;
  }

  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() {
	int n=in();
	int i;
	for(i=0;i<9;i++){
		n-=in();
	}
	cout<<n<<endl;
	return 0;
}

C++: #include <iostream>
using namespace std;
int main () {
int a,b,c,d,e,f,g,h,i,j;
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
    if (a==0) break;
cout<<a-(b+c+d+e+f+g+h+i+j)<<endl;
return 0;
}

C++: #include <stdio.h>

int main(){
	int sum, flg = 0, hiku;
	scanf("%d", &sum);
	while(int i = 0; i < 9; i++){
		scanf("%d", &hiku);
		sum -= hiku;
	}
	printf("%d", sum);
	return 0;
}

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

int main()
{
 int a; int b; int c; int d; int e; int f; int g; int h; int i; int j;
 cin >>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
 cout<<a-b-c-d-e-f-g-h-i-j; 
 return 0;
}

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

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

    return 0;
}

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

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

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

int main() {
	int m;
	int num[10];
	cin >> m;
	int sum = 0;
	for (int i = 1; i < 10; ++i) {
		cin >> num[i];
		sum += num[i];
	}
	cout << m - sum << endl;
}

C++: #include <iostream>

using namespace std;

int main() {
    while(true) {
        int sum;
        cin >> sum;
        if(!sum) break;
        for(int i = 0; i < 9; ++i) {
            int n;
            cin >> n;
            sum -= n;
        }
        cout << sum << endl;
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int total;
cin>>total;
int a,b,c,d,e,f,g,h,i,j;
while(total!=0){
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
j=total-(a+b+c+d+e+f+g+h+i);
cout<<j<<'\n';
cin>>total;
}
return 0;
}

C++: #include "stdio.h"

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