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 <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
#define ll long long
#define PL pair<long long, long long>
#define P pair<int,int>
#define mk make_pair
#define en endl;
#define WHITE 0
#define BLACK 2
#define GRAY 1
#define RE return 0;
#define HERE cout<<"    "<<"HERE"<<en

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

C++: #include <stdio.h>

int r, a;

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

C++: #include<string>
#include<cstdio>
#include<cctype>
#include<iostream>
#include <algorithm>
#include<cmath>
#include<queue>
using namespace std;

int main(){
        int ans, book[15]={0}, s;
        cin >>s;
        for(int i=0;i<9;i++){
                scanf("%d",&book[i]);
                s-=book[i];
            }
        cout <<s<<endl;
    return 0;
}

C++: #include<cstdio>

using namespace std;
int main(void)
{
	int a,b;
	while(scanf("%d",&a))
	{
		if(a == 0) break;
		int c = 0;
		for(int i = 1;i < 10;i++)
		{
			scanf("%d",&b);
			c += b;
		}
		c = a - c;
		printf("%d\n",c);
	}
	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;

 cin>>h>>x>>y>>z>>a>>b>>c>>d>>f>>g;
if(h ==0) break;
int e =h-x-y-z-a-b-c-d-f-g;

cout<<e<<endl;
return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main() {
	while (1) {
		int sum, a[9];
		cin >> sum;
		if (sum == 0) break;
		for (int i = 0; i < 9; ++i) {
			cin >> a[i];
		}
		cout << sum - accumulate(a, a + 9, 0) << endl;
	}

	return 0;
}

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

int main(){
int books=0;
int book=0;
cin>>books;
for(int i=0; i<9;i++){
cin>>book;
books-=book;
book=0;
    }
cout<<books<<'\n';

return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int sum;
	int a;
	while (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>

#define rep_(v, f, l) for (int v = (f), v##_ = (l); v < v##_; ++v)
#define rep(v, n) rep_(v, 0, n)
#define lep(v, n) rep_(v, 1, n + 1)
#define rrep_(v, f, l) for (int v = (l), v##_ = (f); v >= v##_; --v)
#define rrep(v, n) rrep_(v, 0, n - 1)
#define rlep(v, n) rrep_(v, 1, n)
#define show_a(a, size) rep(a##_it, size) std::cout << a[a##_it] << " \n"[a##_it == a##_it_ - 1];
#define show_v(v) show_a(v, v.size())
#define eachv(v, i) rep(i, v.size())
#define reachv(v, i) rrep(i, v.size())
#define debug(x) std::cerr << #x << " = " << x << "\n";

using namespace std;

typedef long long int lint;

static inline int in(){ int x; scanf("%d", &x); return x; }
static inline lint inl(){ lint x; scanf("%lld", &x); return x; }

int main()
{
    int n = in();
    int sum = 0;
    rep(i, 9) sum += in();
    printf("%d\n", n - sum);
    return (0);
}

C++: #include<iostream>
using namespace std;
int main(){
  
  int money[9],all,sum=0;

  cin >>all;
  
  for(int i=0 ; i < 9 ; i++){
    cin >>money[i];
    sum+=money[i];
  }
  
  cout <<all-sum<<endl;

  return 0;
}

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

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

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

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

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

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

C++: #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int main(){
  int sum, p;
  while(scanf("%d", &sum) && sum){
    rep(i, 9){
      scanf("%d", &p);
      sum -= p;
    }

    printf("%d\n", sum);
  }
  return 0;
}

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