After giving 16 coins to Melissa, Juan had twice as many coins as Melissa. If they had 144 coins altogether, how many coins did Juan have at first?