Kiki's favorite Magic Hole consists of coin slots arranged in a circle.
Kiki has coins to place in the slots. All coins share an integer , and coin has two integers and . The values are . The front of coin shows , and its back shows . Initially, every coin shows its front.
Kiki may choose any coins to flip. Each coin may be flipped at most once, and flipping coin earns points. Unflipped coins show their fronts, while flipped coins show their backs.
After deciding which coins to flip, Kiki places the coins into the circular slots of Magic Hole in any order. For every pair of neighboring coins in the circle, the sum of their currently visible numbers must be at least . The first and last coins are also neighbors.
Find the maximum total score obtainable by choosing coins to flip so that they can be arranged to satisfy this condition.
The input is given in the following format:
Print the maximum score obtainable by choosing coins to flip while allowing a valid circular arrangement.
Flipping only coin makes the visible numbers and , satisfying the condition and earning points.