12. A person travels from location A to location B. If he rides a motorcycle from A for 12 hours, then switches to a bicycle for 9 hours, he will arrive at B exactly. If he rides a bicycle from A for 21 hours, then switches to a motorcycle for 8 hours, he will also arrive at B exactly. How many hours would it take to travel the entire distance by motorcycle?