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 <bits/stdc++.h>
using namespace std;

#define times(n, i)      uptil(0, n, i)
#define upto(f, t, i)    for(decltype(t) _##i = (t), i = (f); i <= _##i; i++)
#define uptil(f, t, i)   for(decltype(t) _##i = (t), i = (f); i < _##i; i++)
#define downto(f, t, i)  for(decltype(t) _##i = (t), i = (f); i >= _##i; i--)
#define downtil(f, t, i) for(decltype(t) _##i = (t), i = (f); i > _##i; i--)
#define unless(c) if(!(c))
#define until(c) while(!(c))
#define loop while(true)

#define all(v) v.begin(), v.end()
#define ln << "\n"

struct line{};

template<class T> istream& operator>>(istream& in, vector<T>& v) {
    times(v.capacity(), i) in >> v[i];
    return in;
}

template<class T> const ostream& operator<<(ostream& out, const vector<T>& v) {
    times(v.size(), i) out << (i ? " " : "") << v[i];
    return out;
}

template<class T, class...U> typename enable_if<is_same<T, line>::value, string>::type next(istream& in, const U&... args) {
    string s;
    getline(in, s, args...);
    return move(s);
}

template<class T, class...U> typename enable_if<!is_same<T, line>::value, T>::type next(istream& in, const U&... args) {
    T t(args...);
    in >> t;
    return move(t);
}
template<class T, class...U> auto next(const U&... args) -> decltype(next<T>(cin)) {
    return next<T>(cin, args...);
}

template<class T> T sum(const vector<T>& v) {
    T ans = T();
    for(const T& t : v) ans += t;
    return ans;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);

    loop {
        int s = next<int>();
        unless(s) break;
        cout << s - sum(next<vector<int>>(9)) ln;
    }

    return 0;
}

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

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

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

C++: #include<iostream>
using namespace std;
int main(){

int total;
cin>>total;
int a=0;
int b=0;
int buy=0;

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

cout<<total<<'\n';

return 0;
}

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

int main(){

  int books;
  int cnt=0,res;

  while(1){
  cin >> res;
  if(res == 0) break;
  for(int i = 0; i < 9; i++){
    cin >> books;
    cnt+=books;
    //    if(i == 9) break;
  }

  books = res - cnt;
  cout << books << endl;
  }
  return 0;
}

C++: #include <stdio.h>

int total, a[10];

int main(void) {
	scanf("%d", &total);
	for (int i = 0; i < 9; ++i) { scanf("%d", &a[i]); }

	for (int i = 0; i < 9; ++i) { total -= a[i]; }

	printf("%d\n", total);
	return 0;
}

C++: #include<cstdio>

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