Work and energy gain of heat-pumped quantized amplifiers