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>
#include <utility>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
//vo(string &s){for (char c: s) pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
//template <typename T> vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);out('\n');}
#undef vo


int main() {
	for (int p; (p = in());) {
		for (int i = 9; i--;)
			p -= in();
		out(p, '\n');
	}
}

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>
#include<stdio.h>
using namespace std;
 
int main(){
  int a,i;
  int hon[1001];

  i=0;
  hon[0]=0;
  scanf("%d",&a);
  while(1)
    {
      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<bits/stdc++.h>
using namespace std;

int main(){
  int num;
  int work;


  while(true){
    cin >> num;

    if(num == 0) break;
    
    for(int i = 0; i<9; ++i){
      cin >> work;

      num -= work;
    }
    cout << num << 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;
 
  cout<<a-(b+c+d+e+f+g+h+i+j)<<'\n';
  return 0;
}

C++: #include <stdio.h>

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

C++: #include<iostream>
using namespace std;	
 
	int main(){
		int goke;
		int hon;
		int count=0;

	while(1){
		if(count==0){
		cin>>goke;
		if(goke==0){
		break;
		}
	count++; 
		}else{
		cin>>hon;
		goke-=hon;
		count++;
		}
		if(count==10){
		cout<<goke<<'\n';
		count=0;
		}
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
	int sum;
	int a;
	cin >> 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 sum,tmp;
	cin >> sum;
	for (int i = 0; i < 9; i++){
		cin >> tmp;
		sum -= tmp;
	}
	cout << sum << endl;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){

	int a[1000];
	int sum = 0, sum1 = 0;
	cin>>sum;
	for(int i=0;;i++){
		cin>>a[i];
		if(a[i] == 0) break;
		sum1 += a[i];
	}
	cout<<sum - sum1<<endl;

	return 0;
}

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

main(){
  int total, sum, x;
  while( cin >> total && total ){
    sum = 0;
    for ( int i = 1; i < 10; i++ ){
      cin >> x; sum += x;
    }
    cout << total - sum << endl;
  }
}

C++: #include "bits/stdc++.h"
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define inv(i, a, b) for (int i = (int)(a); i >= (int)(b); i--)
#define ALL(obj) begin(obj), end(obj)
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define LOWER_BOUND(A, key) distance(A.begin(), lower_bound(ALL(A), key))
#define UPPER_BOUND(A, key) distance(A.begin(), upper_bound(ALL(A), key))
#define endl "\n"
#define Endl "\n"

using namespace std;
const int MOD = (int)(1e9 + 7);
const int INF = (int)(1e13 + 7);

int CEIL(int a, int b) { return (a >= 0 ? (a + (b - 1)) / b : (a - (b - 1)) / b); } //ceil() for int
int mod(int a, int b) { return a >= 0 ? a % b : a - (b * CEIL(a, b)); }             //always return positive num
int bpm(int x, unsigned int y) {                                                    //return x^y in order(log(y))
  if (x == 0) return 0;
  if (y == 0) return 1;
  int ans   = 1;
  int digit = (int)((log((double)y) / log((double)2) / 1 + 1));
  x %= MOD;
  for (int i = 0; i < digit; i++) {
    if (((y >> i) & 1u) == 1) ans = ans * x % MOD;
    x = x * x % MOD;
  }
  return ans;
}
template<class T>
void cumulative_sum(T &container) {
  for (int i = 0; i < container.size() - 1; i++) container[i + 1] += container[i];
}

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int sum;
  cin >> sum;
  while (sum != 0) {
    int sum2 = 0;
    rep(i, 9) {
      int temp;
      cin >> temp;
      sum2 += temp;
    }
    cout << sum - sum2 << endl;
    cin >> sum;
  }
}

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

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

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

int main(){
	int total;
	int books;

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

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
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;
	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;
}