public int mini(int[] input) {
        if (input == null || input.length == 0)
            return 0;
        if (input.length == 1)
            return input[0];
        PriorityQueue<Integer> min = new PriorityQueue<Integer>();
        for (int i : input) {
            min.offer(i);
        }
        int ans = 0;
        while (min.size() != 1) {
            int first = min.poll(), second = min.poll();
            int sum = first + second;
            ans += sum;
            min.offer(sum);
        }
        return ans;
    }