Solved AOJ 2186 and 2272