АВТ
Язык:

Дистанционный практикум по программированию

Задачи Online статус Соревнования
Новости Справка СДО
 
Здравствуйте, Гость! Войдите с паролем или зарегистрируйтесь.

1257. Evil & Odious

Ограничение времени: 1 сек.
Ограничение памяти:65536 КБайт
Баллы:100
Статистика Послать на проверку Задачу добавил debug

A non-negative integer is called evil if has an even number of ones in its binary representation. Similarly, a non-negative integer is called odious if has an odd number of ones in its binary representation. Let us write down evil and odious numbers in ascending order.

Number index

1

2

3

4

5

6

7

8

9

10

11

12

13

14

Evil number

0

3

5

6

9

10

12

15

17

18

20

23

24

27

Odious
number

1

2

4

7

8

11

13

14

16

19

21

22

25

26

Let E(n) be the n-th evil number in this list. Similarly, let O(n) be the n-th odious number.

Write a program to calculate the sum of n-th evil and odious numbers E(n) + O(n) given their index n.

Limitations

1 ≤ n ≤ 1 000 000.

Input

The input file contains a single integer, n.

Output

The output file should contain a single integer, the sum E(n) + O(n).

Example

Input

Output

1

1

Input

Output

10

37

 

All Rybinsk-2013 problems

Статистика Послать на проверку Обсуждение задачи Автор/источник:
Задачи с соревнований и сборов / Чемпионат мира по программированию (ICPC) / Рыбинск-2013 /
1256. E - Number Game 1257. 1258. G - Checkers 1259. H - Redirect 1260. I - Klingon Battle Bagel
 
время генерации 0.078 сек.
© Copyright ВоГУ, АВТ, Носов Д.А., Андрианов И.А.