Sand Castle

image

One of Roger’s favorite activities at the beach is building sand castles. Roger has a bucket that he can fill with wet sand and turn upside down to form a sand block. However, since the sand is slippery, the sand block will fall down unless it is placed on the beach itself, or on top of four stable blocks (as shown in the figure). Today Roger wants to build a sand castle that is as high as possible. Can you help him?

Input

A sequence of integers 0N1090\leq N\leq 10^9, denoting the number of sand blocks that Roger has available to build his castle.

Output

For each input, a single line with an integer denoting the highest castle that Roger can build using that amount of sand blocks.

Problem information

Author: Anders Jonsson

Generation: 2026-01-25T15:25:56.480Z

© Jutge.org, 2006–2026.
https://jutge.org