function minimumWaitingTime(queries) {
queries.sort((a, b) => a - b);
let totalWaitingTime = 0;
let watingTime = 0;
for (const q of queries) {
totalWaitingTime += watingTime;
watingTime += q;
}
x
return totalWaitingTime;
}
// Do not edit the line below.
exports.minimumWaitingTime = minimumWaitingTime;