Solve AOJ2440