Go: /*
	Problem A: ICPC 得点集計ソフトウェア
	http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1147&lang=jp
*/

package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

// 標準入力を取得するScannerのインスタンスを作成
var sc = bufio.NewScanner(os.Stdin)

// 標準入力で各行を読み込み文字列として返す
func readLine() string {
	if sc.Scan() {
		return sc.Text()
	}
	return ""
}

func average() (avg int) {
	// 審判の人数を取得する
	n, _ := strconv.Atoi(readLine())

	// 得点
	score := make([]int, 0, n)

	// 得点を読み込む
	for n > 0 {
		line, _ := strconv.Atoi(readLine())
		score = append(score, line)
		n--
	}

	if len(score) == 0 {
		return 0
	}

	// ソート
	sort.Ints(score)
	// 先頭を削除
	score = append(score[:0], score[1:]...)
	// 末尾を削除
	score = score[:len(score)-1]

	// 合計
	for i := 0; i < len(score); i++ {
		avg += score[i]
	}

	// 平均
	avg = avg / len(score)
	return avg
}

func main() {
	// 改行区切りから単語(スペース)区切りで読み込むように変更する
	sc.Split(bufio.ScanWords)
	for {
		avg := average()
		if avg != 0 {
			fmt.Println(avg)
		} else {
			break
		}
	}
}

Python: while True:
    n=int(input())
    x=[]
    for i in range(n):
        a=int(input())
        x.append(a)
        i+=1
    if n==0:
        break
    x.sort()
    sum=0
    l=len(x)
    for i in range(1,l-1):
        sum+=x[i]
    y=sum//(l-2)
    print(y)

Python: import math
for i in range(30):
    n = int(input())
    if n == 0:
        break
    else:
        ls = []
        for i in range(n):
            ls.append(int(input()))
        ls.sort()
        ls.remove(ls[0])
        ls.remove(ls[-1])
        print(math.floor(sum(ls)/len(ls)))

Python: str=readlines()
print(str)

Python: while(1):
    n = int(input())
    if n == 0:
        break
    tmp = [int(input()) for i in range(n)]
    print(int((sum(tmp) - max(tmp) - min(tmp)) / (n - 2)))

Python: while True:
	n = int(input())
	if n == 0: break
	s, vmin, vmax = 0, 1001, -1
	for i in range(n):
		a = int(input())
		vmin = min(vmin, a)
		vmax = max(vmax, a)
		s += a
	print((s-vmin-vmax)//(n-2))

Python: ans = []
while True:
    N = int(input())
    if N == 0:
        break
    
    A = sorted([int(input()) for i in range(N)])
    ans.append(sum(A[1:-1]) // (N - 2))
        
[print(i) for i in ans]

Python: while True:
    #審判の数
    n = int(input())
    if n == 0:
        break
    a = [0]*n               #空いてる配列
    for i in range(n):       #空いてる配列に点数を入れる
        s = int(input())
        a[i] = s
    tensu = (sum(a) - min(a) -max(a))/(len(a)-2) #一番でかい点数と一番小さい点数は一つずつ引いて平均
    print(int(tensu))        #平均点！

Python: while True:
    n = int(input())
    if n > 0:
        l = []
        for i in range(n):
            s = int(input())
        
            l.append(s)
        l.remove(max(l))
        l.remove(min(l))
        x = sum(l)
        y = len(l)
        print(int(x/y))
    if n == 0:
        break

Python: while True:
    n=int(input())
    if n==0:break
    a=0
    mi=1145141919
    ma=0
    for i in range(n):
        t=int(input())
        mi=min(mi,t)
        ma=max(ma,t)
        a+=t
    a-=mi+ma
    print(a//(n-2))

Python: while 1:
    n=int(input())
    if n==0:break
    score=[]
    for i in range(n):
        score.append(int(input()))
    score.sort()
    score=score[1:-1]
    print(sum(score)//len(score))

Python: while True:
    n = int(input())
    if n == 0:
        break
    MIN = 1000
    MAX = 0
    points = 0
    for i in range(n):
        p = int(input())
        if MIN > p:
            MIN = p
        if MAX < p:
            MAX = p
        points += p
    print((points - MIN - MAX) // (n - 2))

Python: while True:
    N = int(input())
    if N == 0:
        break
    
    s = [0 for i in range(N)]
    for i in range(N):
        s[i] = int(input())
    print((sum(s) - max(s) - min(s)) // (N - 2))

Python: while True:
    x = int(input())
    if x == 0: break
    y = []
    for i in range(x):
        y.append(int(input()))
    print((sum(y)-max(y)-min(y))//(len(y)-2))

Python: import sys

while 1:
    n = int(sys.stdin.readline().rstrip())

    if n == 0:
        break

    scores = [int(sys.stdin.readline().rstrip()) for i in range(n)]
    ans = (sum(scores) - (max(scores) + min(scores))) // (n - 2)

    print(ans)

Python: while True:
    n=int(input())
    if n == 0 : break
    a,b,c=0,1001,-1
    for i in range(n):
        m=int(input())
        b=min(b,m)
        c=max(c,m)
        a+=m
    print((a-b-c)//(n-2))

Python: while True:
  n = input();
  if n == 0:
    break;
  a = []
  for i in range(n):
    a.append(input());
  print (sum(a) - min(a) - max(a)) / (len(a) - 2)

Python: while True:
    n=int(input())
    x=[]
    if n==0:
        break
    else:
        for i in range(n):
            s=int(input())
            x.append(s)
        a=min(x)
        b=max(x)
        ave=(sum(x)-a-b)/(n-2)
        print(int(ave))

Python: while True:
    n = int(input())
    if n == 0:
        break

    s = [int(input()) for i in range(n)]
    s.sort()
    score = sum(s) - s[0] - s[-1]
    print(score // (n - 2))

Python: from pprint import pprint as pp
from pprint import pformat as pf
import math

def get_data():
    input_data = int(input())
    return input_data

def make_score_list(referee_num):
    score_list = [None] * referee_num
    for i in range(referee_num):
        score_list[i] = get_data()
    return score_list

def calculate_adjusted_average(score_list, referee_num):
    referee_num -= 2
    adjusted_average = (sum(score_list) - max(score_list) - min(score_list)) / referee_num
    return adjusted_average


if __name__ == "__main__":
    while True:
        referee_num = get_data()
        if referee_num == 0:
            break
        score_list = make_score_list(referee_num)
        adjusted_average = math.floor(calculate_adjusted_average(score_list, referee_num))
        print(adjusted_average)

Python: while True:
    n = int(input())
    if n == 0:
        break
    i = [int(input()) for i in range(n)]
    print((sum(i) - min(i) - max(i)) // (n - 2))

Python: import math
while True:
    n = int(input())
    if n == 0 :
        break
    sum = []
    for i in range(n):
        x = int(input())
        sum.append(x)
    sum.sort()
    del sum[n-1]
    del sum[0]
    rsum = 0
    for i in range(n-2):
        rsum = rsum + sum[i]
    average = rsum/(n-2)
    result = math.floor(average)
    print(result)

Python: import statistics

while True:
    n = int(input())
    if n == 0: break
    s = [int(input()) for i in range(n)]
    ave = statistics.mean(sorted(s)[1:-1])
    print(int(ave))

Python: ans = []
while True:
    n = int(input())
    if n == 0:
        break
    score = [int(input()) for i in range(n)]
    score.sort()
    ans.append(sum(score[1:-1]) // len(score[1:-1]))

for i in ans:
    print(i)

Python: while True:
    n = int(input())
    if n == 0:
        break
    else :
        lista = [0]*n
        for i in range (n):
            lista[i] = int(input())
        lista.remove(max(lista))
        lista.remove(min(lista))
        print(sum(lista)//len(lista))

Python: while True:
    n=int(input())
    if n==0:
        break
    else:
        max_s=0
        min_s=2000
        sum_s=0
        for i in range(n):
            s=int(input())
            sum_s=sum_s+s
            if s<min_s:
                min_s=s
            if s>max_s:
                max_s=s
        print((sum_s-max_s-min_s)//(n-2))

Python: def tax(p,x):
    return p*(100+x) // 100
def solve(X,Y,S):
    for a in range(1,S):
        for b in range(1,S):
            sum = tax(a,X)+tax(b,X)
            if sum == S:
                tax(a,Y)+tax(b,Y) 
            if sum > S:
                break
    return best 
while True:
    X,Y,S = map(int, input().strip().split('')) 
    if X == 0:
        break
print(solve(X,Y,S))