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>
using namespace std;	
 
	int main(){
		int goke;
		int hon;
		int count=0;

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

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

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

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

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

C++: #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
typedef long long int lli;
using namespace std;

int main(){
	int sum,result;
	while(cin >> sum&&sum){
		result=sum;
		for(int i=0; i<9; ++i){
			int tmp;
			cin >> tmp;
			result-=tmp;
		}
		cout << result << "\n";
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a[9],goukei,kyuusum = 0;
	cin >> goukei;
	for(int i = 0; i < 9; i++){
		cin >> a[i];
		kyuusum = kyuusum + a[i];
	}
	cout << goukei - kyuusum;
}

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

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

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

int main() 
{ 
 int num; 
 int a;
 while(1){
  cin >>num; 
  if(num==0){
   break;}
  else
  {
  for(int i=1;i<10;i++)
    {
    cin>>a;
    num=num-a;
    }
  }
  cout<<num<<"\n";
 }
 return 0; 
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)):((m)-(n))),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)
#define loop for(;;)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;
typedef vector<int> vi;
typedef vector<string> vs;
typedef map<string,int> Dictionary;
const Real PI = acos(-1);

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  if (v.size() == 0) {
    os << "(empty)";
    return os;
  }
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

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

int main() {

  int s; cin >> s;
  rep (i, 9) {
    int x; cin >> x;
    s -= x;
  }
  cout << s << endl;

  return 0;
}

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

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

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int total, tmp;
	
	while(1){
		cin >> total;
		if(total == 0){
			break;
		}
		
		for(int i = 2; i <= 10; i++){
			cin >> tmp;
			total -= tmp;
		}
		
		cout << total << endl;
	}
	
	return 0;
}

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

int main(){
  int sum,x;
  cin >> sum;
  while(1){
    cin >> x;
    if(x == 0)break;
    sum -= x;
  }

  cout << sum << endl;

  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0};
const int dx[] = {0,-1,0,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

void Ans(bool f){
  if(f) cout << "YES"<<endl;
  else cout << "NO"<<endl;
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll sum,a;
  cin >> sum;
  rep(i,9){
    cin >> a;
    sum -= a;
  }
  cout << sum << endl;
  return 0;
}

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

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

int main(){
    int ten_sum;

    while(cin >> ten_sum, ten_sum != 0){
        int sum = 0;
        for(int i=1; i<=9; i++){
            int tmp;
            cin >> tmp;
            sum += tmp;
        }

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