An optimal policy for nonstationary inventory problems with service level constraint