ÀÂÒ
Language: Russian
English

Remote Training on Programming

Problems Online status Contests
News FAQ E-learning
For authors:
Register  ||  Login
 
Hello, Guest! Please login or register.

1257. Evil & Odious

Time Limit: 1 seconds
Memory Limit:65536KB
Points:100
View Problem Statistics Submit Problem added 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

View Problem Statistics Submit Problem discussion Author/source:
Problems from Contests and Camps / World Championship in Programming (ICPC) / Rybinsk-2013 /
1256. E - Number Game 1257. 1258. G - Checkers 1259. H - Redirect 1260. I - Klingon Battle Bagel
time generating 0.204 sec.
© Copyright VSU, AVT, Nosov D.A., Andrianov I.A.