Anna has just finished her course project. She has many leftover seven-segment LED displays and one small power source. A display draws power in proportion to the number of lit segments, so a 9 draws twice as much power as a 7.

One display shows one digit from 0 to 9, and the number of segments each digit lights is fixed.
Anna may use as many displays as she likes, and she wants exactly n segments lit in total. Find the largest possible sum of the digits she displays.