In a country with N towns and K roads, taxi company i charges Ci and may traverse at most Ri consecutive roads per ride, boarding only at town i. Find the minimum total fare from town 1 to town N.
Input
Line 1: N, K. Next N lines: Ci, Ri. Next K lines: roads.