#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <bitset>
using namespace std;
  
  
const double EPS = 1e-9;
  
int main(){
 
    int n;
    while(cin >> n, n){
        priority_queue<int, vector<int>, greater<int> > pq;
        int k;
        for(int i = 0; i < n; i++){
            cin >> k;
            pq.push(k);
        }
        long long wt = 0;
        while(!pq.empty()){
            wt += pq.top()*(pq.size()-1);
            pq.pop();
        }
 
        cout << wt << endl;
    }
  
    return 0;
}