BISHOPS - Bishops


Yesterday was Sam's birthday. The most interesting gift was definitely the chessboard. Sam quickly learned the rules of chess and defeated his father, all his friends, his little sister, and now no one wants to play with him any more.

So he decided to play with another birthday gift – a Book of Math Problems for Young Mathematicians. He opened the book somewhere in the middle and read the following problem: "How many knights can be placed on a chessboard without threatening each other?" After a while he realized that this was trivial and moved on to the next problem: "How many bishops can be placed on a chessboard without threatening each other?". Sam is in trouble here. He is not able to solve this problem and needs your help./p>

Sam's chessboard has size N × N. A bishop can move to any distance in any of the four diagonal directions. A bishop threatens another bishop if it can move to the other bishop's position. Your task is to compute the maximum number of bishops that can be placed on a chessboard in such a way that no two bishops threaten each other.

Input

The input file consists of several lines. The line number i contains a single positive integer N representing the size of the i-th chessboard. [1 ≤ N ≤ 10100]

Output

The output file should contain the same number of lines as the input file. The i-th line should contain one number – the maximum number of bishops that can be placed on i-th chessboard without threatening each other.

Example

Input:
2
3

Output:
2
4

hide comments
nikoo28: 2012-08-10 22:16:45

got AC finally...silly mistake..

Last edit: 2012-08-10 22:50:46
NZEC: 2012-07-08 18:24:28

how many test cases are there??

:D: 2012-05-30 07:03:14

Certainly. N=0 doesn't appear in the input. It's not clarified but that value wouldn't make sense for board size.

Shubham: 2012-05-27 20:33:31

thanks hamza7.yours was the only comment helpful :)

hamza007: 2012-02-27 07:44:40

finally got AC .. the catch lies in the fact that inputs are relatively large nd for input case 1 ans should be 1 ( weird though as they even consider 1X1 a chessboard !!)

Charizard_: 2012-02-05 05:08:07

using long multiplication gives me TLE....any one can help...???

Prashant Golash: 2012-01-24 02:48:47

Hi, I wanted to know when to stop reading input, as it has been mentioned several numbers.

Aditya Muttur: 2011-12-12 12:22:44

what does "from itertools import imap" do?

Jesús Gómez: 2009-11-25 02:32:31

7 lines in Python, and includes a "from itertools import imap"

Daniel Ampuero: 2009-11-19 06:53:50

A bishop is the one that moves diagonally :D


Added by:Roman Sol
Date:2005-04-17
Time limit:1s
Source limit:10000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:IPSC 2004