The sentences of two teenagers who avoided jail for raping two girls have been referred to the Court of Appeal, the prime minister has said.