SRM 621, find missing sum [Dynamic programming]