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>

main()
{
	int S,a,b,i;
	a=0;
	scanf("%d",&S);
	for(i=1;i<11,b>0;i++){
		scanf("%d",&b);
		a+=b;
	}
	int A;
	A = S - a;
	printf("%d",A);
}

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

int main(){
	int t;
	int sum;
	int ret;
	
	while(cin >> sum && sum){
		ret = 0;
		for(int i=0;i<10;i++){
			cin >> t;
			ret+=t;
		}
		cout << sum-ret << endl;
	}
}

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

int main(){

  while(1){
    int ans; cin >> ans;
    if(ans == 0) break;
    for(int i=0;i<9;i++){
      int tmp; cin >> tmp;
      ans -= tmp;
    }
    cout << ans << "\n"; 
  }

}

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

using pii = pair<int, int>;
using vi = vector<int>;
using ll = long long;

int main() {
    int total;
    while(cin >> total, total) {
        for(int i = 0; i < 9; ++i) {
            int x; cin >> x;
            total -= x;
        }
        cout << total << 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()
{
  while(1) {
    int sum; cin >> sum;
    if(sum == 0) break;
    FOR(i,0,9) {
      int in;
      cin >> in;
      sum -= in;
    }
    cout << sum << endl;
  }
  return 0;
}

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

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

C++: 
#include <iostream>
#include<string>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a[9],n,sum=0;
    while(cin>>n){
        if(n==0)break;
        for(int i=0;i<9;i++){
            cin>>a[i];
            sum+=a[i];
        }
        cout<<n-sum<<endl;
    }
    return 0;
}

C++: #include <stdio.h>

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

C++: #include<stdio.h>

#define rep(i,j) for(int i=0;i<(j);i++)
#define reps(i,j,k) for(int i=j;i<=k;i++)

using namespace std;


int main(){
	int n,t;
	for(;;){
		scanf("%d",&t);
		if(t==0)break;
		rep(i,9){
			scanf("%d",&n);
			t-=n;
		}
		printf("%d\n",t);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
     int a,b,n=1,i=0;
     cin>>a;
do{
    if(a>10000){
        break;
}  
     cin>>b;
     a=a-b;i++;
if(i==9*n){
     cout<<a<<endl;n++;
}
}while(i<=9*n);


return 0;
}

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

int main(){
  int N, x[50];
  int X = 0;
  cin>>N;

  for(int i=0;i < 50;i++){
    cin>>x[i];
    if(x[i] == 0) break;
    X += x[i];
  }

  cout<<N - X<<endl;

  return 0;
}

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

int main(){
	int total;
	int books;
	int lostbook=0;
	for(){
		if(i==0){
			cin>>total;
		}else{
			cin>>books;
                         if(books==0){
                            break;
                         }
			total-=books;
		}
	}
	cout<<total<<'\n';
	return 0;
}

C++: #include<iostream>
main(){int s,p,i;while(std::cin>>s,s){for(i=9;i--;s-=p)std::cin>>p;std::cout<<s<<'\n';}}

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

int main(){
 int total;
 int books;

        
 while(true){
  cin>>total;
  if(total==0){
    break;
  }
 for(int i=0;i<9;i++){
   cin>>books;
   total-=books;
 }
}	
return 0;
}

C++: #include<iostream>

using namespace std;

int main(){
  while(true){
  int aa[10] = {0};
  int ans = 0, sum = 0;
  for(int i = 0; i < 10; i++)
    cin >> aa[i];
  if(!aa[0])
    break;
  for(int i = 1; i < 10; I++)
    sum += aa[i];
  ans = aa[0] - sum;
  cout << ans << endl;
}
  return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
   int resurt,book;
   while(1){
        cin>>resurt;
        if(resurt==0)break;
        for(int i=0;i<9;i++){
            cin>>book;
            resurt-=book;
        }
        cout<<resurt<<endl;
   }
}

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

C++: #include <iostream>
using namespace std;
int main(){
    int a;
    int b[10];
    while(cin>>a){
    for(int i=0;i<10;i++){
        cin>>b[i];
        a-=b[i];
    }
    cout<<a<<endl;
    }
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int A,b;
	cin>>A;
	for(int i=0;i<9;i++){
		cin>>b;
		A=A-b;
	}
	cout<<A<<endl;
}

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

C++: #include <bits/stdc++.h>
#define fo(i,a) for(i = 0;i < a;i++)
using namespace std;
int kansu(int a,int b) ;
int main(void)
{
	int n,o[9]={0},t=0,i;
	
	cin >> n ;
	while(n != 0){
		fo(i,9) cin >> o[i] ;
		t = accumulate(o,o + 9,0) ;
		cout << n - t << endl ;
		cin >> n ;
	}
	
	return 0 ;
}

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