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>
int main(){
    int ins;
    for(;;){
        int sum=-1;
        scanf("%d",&sum);
        if(sum==0)break;
        for(int i=0;i<9;i++){
            scanf("%d",&ins);
            sum-=ins;
        }
        printf("%d\n",sum);
    }
}

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

int main()
{
	//??¬?????????
	int num1=0,num2=0,num3=0,num4=0,num5=0,num6=0,num7=0,num8=0,num9=0,num10=0,num11=0,num12=0;
	for(int i=0;i<1000;i++){
	cin>>num1>>num2>>num3>>num4>>num5>>num6>>num7>>num8>>num9>>num10>>num12;
	num11=num1-num2-num3-num4-num5-num6-num7-num8-num9-num10;
	cout<<num11;
	cout<<"\n";
	if(num12==0){
		return 0;
	}
	}
}

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

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

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


int main(){
  
   int n;
 while(cin>>n){
  int sum = 0;

  while(1){
  int x;
  cin>>x;
  
  if(x == 0) break;

 sum = sum + x;
 }
  cout<<n-sum<<endl;
 }
  return 0;
}

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
	int t,x,sum[5];
	for(int j=0;j<5;j++){
sum[j]=0;
	cin>>t;
	if(t==0)break;
	
for(int i=0;i<9;i++){
	cin>>x;
	sum[j]=sum[j]+x;
}

	cout<<t-sum[j]<<endl;
}
return 0;
}

C++: #include <cstdio>

using namespace std;

int v,k;

main(){
  scanf("%d", &v);

  if(v==0) return 0;

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

  main();
}

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

int main(){
  int a ,c,sum,ans;
  int b[9] ={};
  sum =0;
while(1){
  cin >> a;

if(a == 0)break;

  for(int i=0;i<9;i++){
    cin >> b[i];
  }


  for(int i=0;i<9;i++){
    sum += b[i];
  }

  ans = a -sum;

  cout << ans << endl;

}

}

C++: #include<stdio.h>

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

C++: #include <iostream>
#include <string>
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(cin >>a){
if(a==0){break;}
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;
}
}

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

int main()
{
	//レシート

	int N;
	int sum = 0;
	int ans[5];
	int a;

	while (true)
	{
		cin >> N;
		if (N == 0) break;
		for (int j = 0; j < 9; j++) {
			cin >> a;
			sum += a;
		}
		cout << N - sum << endl;
	}

	//コンテスト	
	/*
	int W[10], K[10];
	for (int i = 0; i < 10; i++) {
		cin >> W[i];
	}
	for (int i = 0; i < 10; i++) {
		cin >> K[i];
	}
	sort(W, W + 10);
	reverse(W, W + 10);
	sort(K, K + 10);
	reverse(K, K + 10);
	cout << W[0] + W[1] + W[2] << " " << K[0] + K[1] + K[2] << endl;
	*/
	//ポイントカード
	/*
	int N, M;
	cin >> N >> M;
	int a;
	int A[5000];
	int b = 0;
	int x = 0;
	for (int i = 0; i <  M; i++) {
		cin >> a;
		if (a < N) {
			A[x]=a;
			x++;
		}
		else
		{
			b++;
		} 
		cin >> a;
	}
	int sum = 0;
	if (b < M - 1) {
		sort(A, A+x);
		reverse(A, A+x);
		for (int i = 0; i < M - 1 - b; i++) {
			sum += N - A[i];
		}
	}
	cout << sum << endl;
	*/

	//合計時間
	/*
	int sum=0, n;
	for (int i = 0; i < 4; i++) {
	cin >> n;
	sum += n;
	}
	cout << sum / 60 << endl;
	cout << sum % 60 << endl;
	//平均点
	/*
	int P[5];
	int sum=0;
	for (int i = 0; i < 5; i++) {
	cin >> P[i];
	if (P[i] < 40) P[i] = 40;
	sum += P[i];
	}
	cout << sum / 5 << endl;
	*/
	//投票
	/*
	int N, M;
	cin >> N >> M;
	int A[1000], vote[1000];
	for (int i = 0; i < N; i++) {
	cin >> A[i];
	vote[i] = 0;
	}
	int b;
	for (int i = 0; i < M; i++) {
	cin >> b;
	for (int j = 0; j < N; j++) {
	if (A[j] <= b) {
	vote[j]++;
	break;
	}
	}
	}
	int temps = 0, ans;
	for (int i = 0; i < N; i++) {
	if (vote[i] > temps) {
	temps = vote[i];
	ans = i;
	}
	}
	cout << ans + 1 << endl;
	*/

	//2.すごろく	
	/*
	int n;
	cin >> n;
	int A, _A = 1;
	int k = 0;
	int A_count[100];
	A_count[0] = 1;
	for (int i = 0; i < n; i++)
	{
	cin >> A;
	if (A == 1)
	{
	if (A == _A)
	{
	A_count[k]++;
	}
	else
	{
	k++;
	A_count[k] = 2;
	}
	}
	_A = A;
	}
	sort(A_count, A_count + k + 1);
	cout << A_count[k] << endl;
	*/

	//タイムカード
	/*
	int t[2][3];
	int x[3][3];
	for (int n=0; n < 3; n++)
	{
	for (int i=0; i < 2; i++)
	for (int k=0; k < 3; k++)
	cin >> t[i][k];

	for (int m = 2; m >= 0; m--)
	{
	x[n][m] = t[1][m] - t[0][m];
	if (t[0][m] > t[1][m])
	{
	x[n][m] += 60;
	t[1][m - 1]--;
	}
	}
	}
	for (int n= 0; n < 3; n++)
	{
	cout << x[n][0] << ' ' << x[n][1] <<' '<< x[n][2] << endl;
	}
	*/



	return 0;
}

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

int main() {

  int a, b;
  cin >> a;
  for(int i=0; i<9; i++) {
    cin >> b;
    a -= b;
  }

  cout << a << endl;
}

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;
	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;
}

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

int main()
{

	int sum;
	int value[9];

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

	return 0;

}

C++: #include <stdio.h>

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

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

using namespace std;

int main(){
	int m,k;
	cin>>m;
	for(int n=0; n<9; n++ ){
	cin>>k;
	m-=k;
	}
	cout<<m<<endl;
	return 0;
}