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
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long, long> PLL;
typedef long long LL;
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const double EPS = 1e-12;
const double INF = 1e12;


int main(){
	int N;
	while(cin>>N){
		if(N==0)break;
		REP(i,9){
			int t;
			cin>>t;
			N-=t;
		}
		cout<<N<<endl;
	}
	return 0;
}

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

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

C++: #include<iostream>
using namespace std;
	int main(){
	int a,b;int sum=0;
	int sums[5000];int k=0;
	while(cin>>sum){
	if(sum==0)break;
	for(int i=0;i<9;i++){
		cin>>b;
		sum-=b;
	}
	cout<<sum<<endl;
	}
 return 0;
}

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

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

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

  
  while(cin >>all){

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

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

int main() {

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

C++: #include<iostream>
#include<cstdio>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
	int g,s;
	while(1)
	{
		cin>>g;
		if(g==0)
			break;
		for(int i=0;i<9;i++)
		{
			cin>>s;
			g-=s;
		}
		cout<<g<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
	int sougaku, money, nazo;
	scanf_s("%d", &sougaku);
	nazo = sougaku;
	for (int i = 0; i < 9; i++){
		scanf_s("%d", &money);
		nazo = nazo - money;
	}
	printf("%d\n", nazo);
	return 0;
}

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

int main(){

  int val;
  int in;

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

  return 0;
}

C++: #define _USE_MATH_DEFINES
#define INF 100000000
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>

using namespace std;

typedef long long ll;
typedef pair <int,int> P;

static const double EPS = 1e-8;


int tx[] = {-1,0,1,0};
int ty[] = {0,1,0,-1};

int main(){
	int sum;
	while(~scanf("%d",&sum)){
		if(sum==0) break;
		for(int i=0;i<9;i++){
			int val;
			scanf("%d",&val);
			sum-=val;
		}
		printf("%d\n",sum);
	}
}

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

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

int solve(int price){
  int temp;
  for(int i=0;i<9;i++){
    cin>>temp;
    price-=temp;
  }
  return price;
}

int main(){
  int price;
  cin>>price;
  while(price){
    cout<<solve(price)<<endl;
    cin>>price;
  }
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

/*-------------------------------*/
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define RREP(i, n) for(int i = (n) - 1; i >= 0; i--)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define pb push_back
#define mp make_pair

typedef long long ll;
typedef pair<int, int> pint;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef vector<long long> llv;
typedef vector<pint> vpint;

/*-------------------------------*/

int main(void)
{
  int n;
  int m, x;

  while (true){
    cin >> n;
    x = 0;
    if (n == 0) break;
    rep(i, 9){
      cin >> m;
      x += m;
    }
    cout << n - x << endl;
  }
  return 0;
}

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

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

  return 0;
}