A ship is on a W wide sea area. N enemy submarines numbered from 1 to N are underwater moving from west to east at
depth of D. Every two seconds the submarine can move one unit distance. The ship is equipped with unlimited bombs.
At each second, the ship can do one of the following actions:
1. Move one unit.
2. Release a bomb, and destroy the first submarine vertically under the ship.
3. Do nothing.
At first, the ship's moving direction is from west to east. It changes its moving direction if and only if the bomb destroys a
special type of submarine.
At no time can submarines overlap at each other.
Every submarine has an important degree. Given the time each submarine enters the sea area at the most west side, and
whether the submarine is the special type, please calculate the maximum sum of destroyed submarines' important degree in
time [0, S] inclusive.