uva12577 - [optimization]