Solve AOJ2007