Weighing balance#7110

Weighing balance

1 секунда
128 мегабајти
Многу лесно
prb7110

Measurement of the weight of an object is carried out using laboratory scales. Using a set of weights weighing g, g, g, g, g, g and g, you can measure the weight of any item with a whole weight from to g in a single way. For example, to measure an object weighing g, you need to put weights of and g on one bowl, and on the other the object itself. For an object weighing g add to the cup with it the weights of , and g, and on another cup - put the weight of g.

Determine how many weights from this set should be used to weigh an item of a given weight.

Влез

One positive integer (1 \le x \le 1000) - the weight of the item.

Излез

Print the number of weights needed to weigh the item.

Примери

Пример 1

Loading
Loading

Пример 2

Loading
Loading