Mr Lee was selling apples in bags of p apples. 9 customers came and bought 1 bag each. He had 3 apples left. How many apples did he have at first? Express your answer in term of p.