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

int main() {

	//ifstream cin("INPUT.txt");
	//ofstream cout("OUTPUT.txt");

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

	return 0;

}

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

C++: #include <stdio.h>

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

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

C++: #include <iostream>
#include <cstdio>

int main(void){
  int sum, price[10], pay;
  while(1){
    sum = 0;
    scanf("%d", &pay);
    if(pay == 0) break;
    for(int i = 0; i < 9; i++){
      scanf("%d", &price[i]);
      sum += price[i];
    }
    price[9] = pay - sum;
    printf("%d\n", price[9]);
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int goukei;
	cin >> goukei;
	for(int i = 0; i < 9; i++){
		int a;
		cin >> a;
		goukei = goukei - a;
	}
	cout << goukei << endl;
	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<stdio.h>
int main(void)
{
	int a,i,x=0,s=0;
	scanf("%d",&a);
	s=a;
	for(i=0;i<9;i++){
		scanf("%d",&a);
		x+=a;
	}
	printf("%d\n",s-x);
	return 0;
}

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

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

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

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

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

int main() {
	int n;
	while(1){
		cin >> n;
		if(n == 0) break;
		int p[9], sum = 0;
		for(int i=0; i<9; i++){
			cin >> p[i];
			sum += p[i];
		}
		int ans = n - sum;
		cout << ans << endl;
	}
	return 0;
}

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

using namespace std;

int main(){

  
  int t1;
  int t2;

  while(cin>>t1,t1){

	int t=0;
	
	for(int i=0;i<9;++i){

	  cin>>t2;
	  
	  t+=t2;
	  
	}

	cout<<t1-t<<endl;
	
  }

  return 0;
  
}

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

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

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;

int n,m;

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

C++: #include<iostream>

using namespace std;
int main(){
	for(int i=0;i<5;i++){
		int B[10];
		for(int i=0;i<10;i++){
			cin >> B[i];
			if(B[i] == 0){
				return 0; //プログラムの強制終了
			}
		}

		int sum = 0;

		for(int i=1;i<9;i++){
			sum += B[i];
		}

		cout << B[0] - sum << endl;
	}
	return 0;

}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



int tot, A[10];

int main() {
    while (cin >> tot) {
        if (tot == 0) break;
        for (int i = 0; i < 9; ++i) {
            cin >> A[i];
            tot -= A[i];
        }
        cout << tot << endl;
    }
    return 0;
}

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

using namespace std;

int solve(int m){

	
	
	return m;
}

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

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

int main() {
	// your code goes here
	int sum,r[10],real=0;
	cin >> sum;
	for(int i=0;i<10;i++){
	cin >> r[i];
	real+=r[i];
	}
	for(int i=0;i<10;i++){
		if(real-r[i]==sum)
		cout << r[i] << endl;
	}
	
	return 0;
}