Optimal allocation of pandemic influenza vaccine depends on age, risk and timing