zscoder wants to generate an input file for some programming competition problem.His input is a string consisting of n letters 'a'. He is too lazy to write a generator so he will manually generate the input in a text editor.Initially, the text editor is empty. It takes him x seconds to insert or delete a letter 'a' from the text file and y seconds to copy the contents of the entire text file, and duplicate it.zscoder wants to find the minimum amount of time needed for him to create the input file of exactly n letters 'a'. Help him to determine the amount of time needed to generate the input.

The only line contains three integers n, x and y (1 ≤ n ≤ 107, 1 ≤ x, y ≤ 109) — the number of letters 'a' in the input file and the parameters from the problem statement.

Print the only integer t — the minimum amount of time needed to generate the input file.

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

x = x + 0.0
y = y + 0.0

DP = [0.0]*(n+2)
DP[-1] = None
for i in range(1,n+1):
    DP[i] = min(DP[i-1] + x, DP[(i+1)//2] + y + (x if i&1 else 0.0))

print int(DP[n])

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

x = x + 0.0
y = y + 0.0

DP = [0.0]*(n+2)
DP[-1] = 'banana'
for i in range(1,n+1):
    DP[i] = min(DP[i-1] + x, DP[(i+1)//2] + y + (x if i&1 else 0.0))

print int(DP[n])

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

import _numpypy
zero = _numpypy.multiarray.dtype('int64').type()

x = x + zero
y = y + zero

DP = [zero]*(n+1)
for i in range(1,n+1):
    DP[i] = DP[(i+1)//2] + y + (x if i&1 else zero)
    if DP[i] > DP[i-1] + x:
        DP[i] = DP[i-1] + x

print DP[n]

N, X, Y = map(int, raw_input().split())
X *= 1.; Y *= 1.
memo = {0.: 0, 1.: X}
def f(n):
    if n not in memo:
        if n%2 < 0.01:
            a = min(X*n, Y+f(n/2))
        else:
            a = min(X*n, X+f(n-1), X+f(n+1))
        memo[n] = a
    return memo[n]
print int(f(N * 1.))

n,x,y = map(int, raw_input().split())
x *= 1.; y *= 1.
DP = [0.]*(n+1)
for i in xrange(1,n+1):
    DP[i] = min(DP[i-1] + x, DP[(i+1)//2] + y + (x if i&1 else 0.))

print int(DP[n])

N, X, Y = map(int, raw_input().split())
memo = {0: 0, 1: X}
def f(n):
    if n not in memo:
        if n % 2 == 0:
            ans = min(X * n, Y + f(n / 2))
        else:
            ans = min(X * n, X + f(n-1), X + f(n+1))
        memo[n] = ans
    return memo[n]
print f(N)

import sys

n, x, y = map(int, input().split())
size = 10**7
dq_x, dq_y, dq_i = [0]*size, [0]*size, [0]*size
l, r = 0, 0
cx, cy = 0, 0

for i in range(1, n+1):
    cx += 1
    while l < r and dq_i[l] < i:
        l += 1
    if l < r and (dq_x[l]-i-cx)*x + (dq_y[l]-cy)*y < 0:
        cx = dq_x[l] - i
        cy = dq_y[l]

    tx, ty = cx + i*2, cy+1
    while l < r and (dq_x[r]-tx)*x + (dq_y[r]-ty)*y > 0:
        r -= 1
    dq_x[r] = tx
    dq_y[r] = ty
    dq_i[r] = i*2
    r += 1

print(cx*x + cy*y)

#import sys
#sys.stdin = open('in', 'r')
#n = int(input())
#a = [int(x) for x in input().split()]

n,x,y = map(int, input().split())
import heapq
h = []
d = {}
heapq.heappush(h, (0, n))

r = -1
while r == -1:
    xh,nh = heapq.heappop(h)
    if nh not in d:
        d[nh] = xh
        if nh == 1:
            r = xh + x
        elif nh * x < y:
            r = xh + nh*x
        else:
            if (nh - 1) not in d:
                heapq.heappush(h, (xh + x, nh - 1))
            if nh & 1 == 0 and (nh // 2) not in d and y < (nh//2)*x:
                heapq.heappush(h, (xh + y, nh // 2))
            if (nh + 1) not in d:
                heapq.heappush(h, (xh + x, nh + 1))

print(r)

def recursion(n):
    if n == 1:
        return x
    if n == 2:
        return x + min(x , y)
    if n % 2 == 0:
        return recursion(n // 2) + min(y, x * (n - n//2))
    else:
        return min(recursion(n + 1), recursion(n - 1)) + x

import sys
sys.setrecursionlimit(10000000)
n, x, y = list(map(int, input().split()))
print(recursion(n))

import sys
sys.setrecursionlimit(1000000)

def f(dp,x,y,n):
    if dp[n]!=-1:
        return dp[n]
    if n%2==1:
        ans=x+min(f(dp,x,y,n-1) ,f(dp,x,y,n+1))
    else:
        ans=f(dp,x,y,n//2)+min(y,x*n//2)
    dp[n]=ans
    return ans

n,x,y=map(int,input().split())
dp=[-1 for i in range(n+10)]
dp[1]=x
print(f(dp,x,y,n))

__author__ = 'Think'
n, x, y=[int(i) for i in input().split()]
def worth(num):
	if num%2==0:
		dub=y
		alt=x*(num//2)
	else:
		dub=y+x
		alt=x*((num//2)+1)
	return dub<alt, dub, alt

time=0
while n>0:
	parity=n%2
	should_double, dub, alt=worth(n)
	if should_double:
		time+=dub
		if parity==0:
			# print("Doubled, even,", n, n//2, time)
			n=n//2
			continue
		else:
			half=n//2
			if half%2==0:
				# print("Doubled, 1 mod 4,", n, half, time)
				n=half
				continue
			else:
				if ((half//2+1)*x+y)<half*x:
					# print("Doubled, 3 mod 4, continued", n, half+1, time)
					n=half+1
					continue
				else:
					# print("Doubled, 3 mod 4, end", n, half, time)
					time+=half*x
					break
	else:
		# print("Haven't doubled, ", n, time)
		time+=n*x
		break

print(time)

def fi(n):
    if n == 1:
        return x
    elif n == 2:
        return x + min(x, y)
    else:
        if n % 2 == 1:
            return min(fi(n-1), fi(n+1)) + x
        else:
            return fi(n//2) + min(y, x * (n//2))

n,x,y = map(int, input().split())
print(fi(n))

n, a, b = input().split(' ')
n = int(n)
a = int(a)
b = int(b)
tk = tk2 = dk = dk2 = hg = hg2 = tag = tag2 = k1 = k2 = 0
kg = n
while kg >= 2:
    if kg % 2 != 0:
        tag = 1
        if tag == 1 and (kg-kg//2-1)*a < b:
            break
        hg2 = kg
        hg = (kg+1)//2
        while hg >= 2:
            if hg % 2 != 0:
                tag2 = 1
            if tag2 == 1 and (hg-hg//2-1)*a < b:
                break
            if tag2 == 0 and (hg-hg//2)*a < b:
                break
            if hg % 2 != 0:
                tk2 += 1
            hg //= 2
            tag2 = 0
            tk += 1
        t0 = b*tk + a*hg + a*tk2
        tag2 = 0
        hg = (hg2 - 1)//2
        while hg >= 2:
            if hg % 2 != 0:
                tag2 = 1
            if tag2 == 1 and (hg - hg//2 - 1) * a < b:
                break
            if tag2 == 0 and (hg - hg//2) * a < b:
                break
            if hg % 2 != 0:
                dk2 += 1
            hg //= 2
            tag2 = 0
            dk += 1
        t1 = b*dk + a*hg + a*dk2
        if t0 <= t1:
            kg += 1
        else:
            kg -= 1
        tk = tk2 = dk = dk2 = hg2 = 0
    if tag == 1:
        k2 += 1
    if (kg-kg//2)*a <= b:
        break
    kg //= 2
    tag = 0
    k1 += 1
t = b*k1 + k2*a + kg*a
print(t)

import sys
sys.setrecursionlimit(1000000)

def f(n):
    if n == 1:
        return x
    elif n == 2:
        return x + min(x, y)
    else:
        if n % 2 == 0:
            return f(n // 2) + min(y, x * (n - n // 2))
        else:
            return min(f(n + 1), f(n - 1)) + x

n, x, y = map(int, input().split())

print(f(n))

def main():
    def f(t):
        if t & 1:
            return x if t == 1 else min(f(t - 1), f(t + 1)) + x
        else:
            u = x * t
            return f(t // 2) + y if y * 2 < u else u

    n, x, y = map(int, input().split())
    print(f(n))

if __name__ == '__main__':
    main()

def main():
    def f(t):
        u = cache.get(t)
        if u is None:
            if t & 1:
                u = min(f(t - 1), f(t + 1)) + x
            else:
                u = x * t
                if y * 2 < u:
                    u = f(t // 2) + y
            cache[t] = u
        return u

    n, x, y = map(int, input().split())
    cache = {1: x}
    print(f(n))

if __name__ == '__main__':
    main()

import sys
sys.setrecursionlimit(100000)

from functools import lru_cache

@lru_cache()
def best(a):
    if a == 1:
        return x
    elif a > 0:
        if a == 2:
            return x + min(x, y)
        elif a % 2 == 0:

            return best(a//2) + min(y, (a - a//2) * x)
        else:
            return min(best(a-1) , best(a+1) ) + x

n, x, y = map(int, input().split())

print(best(n))

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

import _numpypy
zero = _numpypy.multiarray.dtype('int64').type()

x = x + zero
y = y + zero

DP = _numpypy.multiarray.zeros(n+1, dtype = 'int64')
for i in range(1,n+1):
    DP[i] = min(DP[i-1] + x, DP[(i+1)//2] + y + (x if i&1 else zero))

print DP[n]

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

import _numpypy

zero = _numpypy.multiarray.dtype('int64').type()

x = x + zero
y = y + zero

DP = [zero]*(n+1)
for i in range(1,n+1):
    DP[i] = min(DP[i-1] + x, DP[(i+1)//2] + y + (x if i&1 else zero))

print DP[n]

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

x = x + 0.0
y = y + 0.0

DP = [0.0]*(n+1)
for i in range(1,n+1):
    DP[i] = min(DP[i-1] + x, DP[(i+1)//2] + y + (x if i&1 else 0.0))

print int(DP[n])

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

x = x + 0.0
y = y + 0.0

DP = [0.0]*(n+2)
DP[-1] = 1
for i in range(1,n+1):
    DP[i] = min(DP[i-1] + x, DP[(i+1)//2] + y + (x if i&1 else 0.0))

print int(DP[n])

N, X, Y = map(int, raw_input().split())
memo = {0: 0, 1: X}
def f(n):
    if n not in memo:
        if n % 2 == 0:
            ans = min(X * n, Y + f(n / 2))
        else:
            ans = min(X * n, X + f(n/2), X + f((n+1)/2))
        memo[n] = ans
    return memo[n]
print f(N)

import sys

n, x, y = map(int, input().split())
dp = [0] + [-1] * n
prev = [0]*n
div = 2
while n % div == 0:
    prev[n // div] = n // div
    div *= 2
for i in range(1, n):
    if prev[i] < prev[i-1]:
        prev[i] = prev[i-1]

for i in range(n):
    if dp[i+1] == -1 or dp[i+1] > dp[i]+x:
        dp[i+1] = dp[i]+x
    if i*2 <= n:
        if dp[i*2] == -1 or dp[i*2] > dp[i]+y:
            dp[i*2] = dp[i]+y
    else:
        if dp[n] == -1 or dp[n] > dp[i]+y+(i*2-n)*x:
            dp[n] = dp[i]+y+(i*2-n)*x

    cost = dp[i] + (i - prev[i])*x + y
    if dp[prev[i]*2] > cost:
        dp[prev[i]*2] = cost

print(dp[-1])

import sys

n, x, y = map(int, input().split())
dp = [0] + [10**18] * n

for _ in range(3):
    for i in range(n):
        if dp[i+1] > dp[i]+x:
            dp[i+1] = dp[i]+x
        if i*2 <= n:
            if dp[i*2] > dp[i]+y:
                dp[i*2] = dp[i]+y
        else:
            if dp[n] > dp[i]+y+(i*2-n)*x:
                dp[n] = dp[i]+y+(i*2-n)*x

    for i in range(n-1, 0, -1):
        if dp[i-1] > dp[i] + x:
            dp[i-1] = dp[i] + x

print(dp[-1])

import sys

n, x, y = map(int, input().split())
dp = [0] + [-1] * n

for i in range(n):
    if dp[i+1] == -1 or dp[i+1] > dp[i]+x:
        dp[i+1] = dp[i]+x
    if i*2 <= n and (dp[i*2] == -1 or dp[i*2] > dp[i]+y):
        dp[i*2] = dp[i]+y

for i in range(n-1, 0, -1):
    if dp[i-1] > dp[i] + x:
        dp[i-1] = dp[i] + x

for i in range(n):
    if dp[i+1] > dp[i]+x:
        dp[i+1] = dp[i]+x
    if i*2 <= n:
        if dp[i*2] > dp[i]+y:
            dp[i*2] = dp[i]+y
    else:
        if dp[n] > dp[i]+y+(i*2-n)*x:
            dp[n] = dp[i]+y+(i*2-n)*x

print(dp[-1])

import sys

n, x, y = map(int, input().split())
dp = [0] + [-1] * n

for i in range(n):
    if dp[i+1] == -1 or dp[i+1] > dp[i]+x:
        dp[i+1] = dp[i]+x
    if i*2 <= n:
        if dp[i*2] == -1 or dp[i*2] > dp[i]+y:
            dp[i*2] = dp[i]+y
    else:
        if dp[n] == -1 or dp[n] > dp[i]+y+(i*2-n)*x:
            dp[n] = dp[i]+y+(i*2-n)*x

print(dp[-1])

#import sys
#sys.stdin = open('in', 'r')
#n = int(input())
#a = [int(x) for x in input().split()]
n0,x,y = map(int, input().split())

d = {}

def solve(n):
    if n == 1:
        return x
    if n == 0:
        return 0
    if n not in d:
        if n & 1:
            d[n] = solve(n-1) + x
        else:
            d[n] = min(solve(n-1) + x, solve(n//2) + y)
    return d[n]

if n0 == 1:
    print(x)
else:
    r0 = solve(n0)
    st2 = 1
    while st2 < n0:
        st2 *= 2
    for i in range(n0 + 1, st2 + 1):
        deccost = (i - n0)*x
        if deccost > r0:
            break
        else:
            r0 = min(r0, solve(i)+deccost)
    print(r0)

#import sys
#sys.stdin = open('in', 'r')
#n = int(input())
#a = [int(x) for x in input().split()]
n,x,y = map(int, input().split())

if n == 1:
    print(x)
else:
    t = x
    cnt = 1
    while cnt*2 <= n:
        t += y if y < cnt*x else cnt*x
        cnt *= 2
    t1 = (n - cnt)*x
    t2 = y + (cnt*2-n)*x
    t += min(t1,t2)
    print(t)

#import sys
#sys.stdin = open('in', 'r')
#n = int(input())
#a = [int(x) for x in input().split()]
class minheap:
    def __init__(self, n):
        self.a = [0 for i in range(n)]
        self.n = 0

    def __init__(self):
        self.a = []
        self.n = 0

    def load(self, initial):
        self.a = [] + initial
        self.n = len(self.a)
        for i in range((self.n-2) // 2, -1, -1):
            self.hdown(i)

    def hup(self, ind):
        if ind > 0:
            parent = (ind - 1) // 2
            if self.a[parent] > self.a[ind]:
                tmp = self.a[ind]
                self.a[ind] = self.a[parent]
                self.a[parent] = tmp
                self.hup(parent)

    def hdown(self, ind):
        l = ind*2 + 1
        r = ind*2 + 2
        newind = ind
        if l < self.n and self.a[newind] > self.a[l]:
            newind = l
        if r < self.n and self.a[newind] > self.a[r]:
            newind = r
        if newind != ind:
            tmp = self.a[ind]
            self.a[ind] = self.a[newind]
            self.a[newind] = tmp
            self.hdown(newind)

    def push(self, v):
        if self.n == len(self.a):
            self.a.append(v)
        else:
            self.a[self.n] = v
        self.hup(self.n)
        self.n += 1

    def pop(self):
        if self.n > 0:
            res = self.a[0]
            self.n -= 1
            if self.n > 0:
                self.a[0] = self.a[self.n]
                self.a[self.n] = 0
                self.hdown(0)
            return res
        else:
            raise "empty heap"

n,x,y = map(int, input().split())

h = minheap()
d = {}
h.push((0, n))

r = -1
while r == -1:
    xh,nh = h.pop()
    if nh not in d:
        d[nh] = xh
        if nh == 1:
            r = xh + x
        elif nh * x < (nh //2)*x + y:
            r = xh + nh*x
        else:
            if (nh - 1) not in d:
                h.push((xh + x, nh - 1))
            if nh & 1 == 0 and (nh // 2) not in d and y < (nh//2)*x:
                h.push((xh + y, nh // 2))
            if (nh + 1) not in d and (((nh + 1) & 1) == 1 or d.get((nh + 1)//2, ((nh + 1)//2)*x) > (xh + x + y)):
                h.push((xh + x, nh + 1))

print(r)

#import sys
#sys.stdin = open('in', 'r')
#n = int(input())
#a = [int(x) for x in input().split()]
class minheap:
    def __init__(self, n):
        self.a = [0 for i in range(n)]
        self.n = 0

    def __init__(self):
        self.a = []
        self.n = 0

    def load(self, initial):
        self.a = [] + initial
        self.n = len(self.a)
        for i in range((self.n-2) // 2, -1, -1):
            self.hdown(i)

    def hup(self, ind):
        if ind > 0:
            parent = (ind - 1) // 2
            if self.a[parent] > self.a[ind]:
                tmp = self.a[ind]
                self.a[ind] = self.a[parent]
                self.a[parent] = tmp
                self.hup(parent)

    def hdown(self, ind):
        l = ind*2 + 1
        r = ind*2 + 2
        newind = ind
        if l < self.n and self.a[newind] > self.a[l]:
            newind = l
        if r < self.n and self.a[newind] > self.a[r]:
            newind = r
        if newind != ind:
            tmp = self.a[ind]
            self.a[ind] = self.a[newind]
            self.a[newind] = tmp
            self.hdown(newind)

    def push(self, v):
        if self.n == len(self.a):
            self.a.append(v)
        else:
            self.a[self.n] = v
        self.hup(self.n)
        self.n += 1

    def pop(self):
        if self.n > 0:
            res = self.a[0]
            self.n -= 1
            if self.n > 0:
                self.a[0] = self.a[self.n]
                self.a[self.n] = 0
                self.hdown(0)
            return res
        else:
            raise "empty heap"

n,x,y = map(int, input().split())

h = minheap()
d = {}
h.push((0, n))
import math

r = -1
while r == -1:
    xh,nh = h.pop()
    if nh not in d:
        d[nh] = xh
        if nh == 1:
            r = xh + x
        elif nh * x < y:
            r = xh + nh*x
        else:
            if (nh - 1) not in d:
                h.push((xh + x, nh - 1))
            if nh & 1 == 0 and (nh // 2) not in d and y < (nh//2)*x:
                h.push((xh + y, nh // 2))
            if (nh + 1) not in d and (((nh + 1) & 1) == 1 or d.get((nh + 1)//2, ((nh + 1)//2)*x) > (xh + x + y)):
                h.push((xh + x, nh + 1))

print(r)

#import sys
#sys.stdin = open('in', 'r')
#n = int(input())
#a = [int(x) for x in input().split()]
n,x,y = map(int, input().split())

a = [x*i for i in range(n*2+2)]

bt = x
for i in range(1, 2*n):
    if a[i] < bt:
        bt = a[i] + x
        j = i - 1
        while j > 0 and a[j] > a[j + 1] + x:
            a[j] = a[j + 1] + x
            j += 1
            if j < n and a[j*2] > a[j] + y:
                a[j*2] = a[j] + y
    else:
        a[i] = bt
        bt += x
    if i < n and a[2*i] > a[i] + y:
        a[2*i] = a[i] + y

print(a[n])

n, x, y = list(map(int, input().split()))
line = [0]
for i in range(1, 2 * n+1):
    if i % 2 != 0:
        line += [line[-1]+x]
    else:
        line += [min(line[-1] + x, line[i // 2] + y)]
for i in range(n, 2 * n + 1):
    line[n] = min(line[i], line[n] + x * (i - n))
print(line[n])

n, x, y = list(map(int, input().split()))
line = [0]
for i in range(1, n+1):
    if i % 2 != 0:
        line += [line[-1]+x]
    else:
        line += [min(line[-1] + x, line[i // 2] + y)]
print(line[-1])

n, x, y = list(map(int, input().split()))
line = [0] * 2 * n
line[1] = x
line[2] = x + min(x, y)
counter = 4
while counter < 2 * n:
   line[counter] = min(line[counter // 2] + y, line[counter // 2] + x * (counter - counter // 2))
   counter = counter * 2
for i in range(3, n + 1):
   if i % 2 != 0:
      line[i] = min(line[i + 1], line[i - 1])
      counter = 2 * i
      while counter < 2 * n:
         line[counter] = min(line[counter // 2] + y, line[counter // 2] + x * (counter - counter // 2))
         counter = counter * 2
print(line[n])

n, x, y = list(map(int, input().split()))
line = [0]
for i in range(1, 2 * n+1):
    if i % 2 != 0:
        line += [line[-1]+x]
    else:
        line += [min(line[-1] + x, line[i // 2] + y)]
for i in range(n, 2 * n + 1):
    line[n] = min(line[n], line[i] + x * (i - n))
print(line[n])

def f(dp,x,y,n):
    if n==0:
        return 1
    if n<0:
        return 0
    if dp[n]!=-1:
        return dp[n]

    if n%2==1:
        ans=min(x+f(dp,x,y,n-1) , x+y+f(dp,x,y,(n+1)//2))
    else:
        ans=min(x+f(dp,x,y,n-1) , y+f(dp,x,y,n//2))
    dp[n]=ans
    return ans

n,x,y=map(int,input().split())
dp=[]
for i in range(n+10):
    dp.append(-1)
dp[1]=1

print(f(dp,x,y,n))

import sys
sys.setrecursionlimit(1000000)

def f(dp,x,y,n):
    if dp[n]!=-1:
        return dp[n]
    if n%2==1:
        ans=x+min(f(dp,x,y,n-1) ,f(dp,x,y,n+1))
    else:
        ans=f(dp,x,y,n//2)+min(y,x*n/2)
    dp[n]=ans
    return ans

n,x,y=map(int,input().split())
dp=[-1 for i in range(n+10)]
dp[1]=x
print(f(dp,x,y,n))

__author__ = 'Think'
n, x, y=[int(i) for i in input().split()]
def worth(num):
	if num%2==0:
		dub=y
		alt=x*(num//2)
	else:
		dub=y+x
		alt=x*((num//2)+1)
	return dub<alt, dub, alt

time=0
while n>0:
	parity=n%2
	should_double, dub, alt=worth(n)
	if should_double:
		time+=dub
		if parity==0:
			n=n//2
			continue
		else:
			half=n//2
			if half%2==0:
				n=half
				continue
			else:
				if ((half//2+1)*x+y)>half*x:
					n=half+1
					continue
				else:
					time+=half*x
					break
	else:
		time+=n*x
		break

print(time)

n, x, y = map(int, input().split())

f = [None] * (n + 1)
f[0] = 0
f[1] = x

for i in range(2, n + 1):
    if i % 2 == 0:
        a = f[i // 2] + y
    else:
        a = f[i // 2] + y + x

    f[i] = min(f[i - 1] + x, a)

print(f[n])

n, x, y = map(int, input().split())

i = n
c = 0

while i > 0:
    if i % 2 == 0 and x >= y:
        i //= 2
        c += y
    else:
        if str(bin(i + 1)) == '1' + '0' * (len(str(bin(i + 1))) - 1):
            i += 1
        else:
            i -= 1
        c += x

print(c)

import sys
range = xrange
input = raw_input

n,x,y = [int(x) for x in input().split()]

DP = [0]*(n+1)
for i in range(1,n+1):
    d = DP[i-1] + x
    if not i&1:
        d = min(d, DP[i//2] + y)
    DP[i] = d

print DP[n]


Chris the Rabbit has been interested in arrays ever since he was a child. At the moment he is researching arrays with the length of n, containing only integers from 1 to n. He is not good at math, that's why some simple things drive him crazy. For example, yesterday he grew keen on counting how many different beautiful arrays there are. Chris thinks that an array is beautiful if it meets one of the two conditions:   each elements, starting from the second one, is no more than the preceding one  each element, starting from the second one, is no less than the preceding one Having got absolutely mad at himself and at math, Chris came to Stewie and Brian to ask them for help. However, they only laughed at him and said that the answer is too simple and not interesting. Help Chris the Rabbit to find the answer at last.

The single line contains an integer n which is the size of the array (1 ≤ n ≤ 105).

You must print the answer on a single line. As it can be rather long, you should print it modulo 1000000007.

MOD=10**9+7
def power(x, a):
    if(a==0):
        return(1)
    z=power(x, a//2)
    z=(z*z)%MOD
    if(a%2):
        z=(z*x)%MOD
    return(z)
def fact(n):
    factn=1
    for i in range(2, n+1):
        factn=(factn*i)%MOD
    return(factn)
def ncr(n, r):
    return((fact(n)*power(fact(r), MOD-2)*power(fact(n-r), MOD-2))%MOD)
n=int(input())
print((2*ncr(2*n-1,n)-n)%MOD)

# from math import factorial
import re

def factorial(n):
    if n == 0:
        return 1
    else:
        for i in range(1, n):
            n = (n * i) % 1000000007
    return n

def exgcd(a, b, c):
    if b == 0:
        c[0] = 1
        c[1] = 0
        return a
    else:
        ret = exgcd(b, a % b, c)
        tmp = c[0] - a // b * c[1]
        c[0] = c[1]
        c[1] = tmp
        return ret

def inv(a, b):
    c = [0, 1]
    exgcd(a, b, c)
    return c[0] % b

def slove(n):
    f2n = factorial(2 * n - 1) % 1000000007
    fn = factorial(n) % 1000000007
    fn1 = factorial(n - 1) % 1000000007
    div = (fn * fn1) % 1000000007
    ninv = inv(div, 1000000007)

    ret = (2 * f2n * ninv - n) % 1000000007
    return ret

n = int(input())
print(slove(n))

def fact(n):
    res=1
    for i in range(2,n+1):
        res=(res*i)%(10**9+7)
    return res

def rev(a):
    return pow(a,10**9+5,10**9+7)

def c2nn(n):
    return fact(2*n)*(rev(fact(n))**2)%(10**9+7)

n=int(input())
print(c2nn(n)-n)

n = int(input())

m = int(1e9 + 7)

# binom(2n - 1, n)

p = 1

for i in range(1, n + 1):

    p *= 2 * n - i

    p *= pow(i, m - 2, m)

    p %= m

print((2 * p - n) % m)

# Made By Mostafa_Khaled

def po(a,b,m):
    if b == 0:
        return 1
    if b % 2 == 0:
        return (po(a, b // 2, m) ** 2) % m
    return (po(a, b - 1, m) * a) % m

def rev(a,m):
    return po(a, m - 2, m)

def fact(a, m):
    t = a
    for i in range(1, a):
        t=(t * i) % m
    return t

def main(n):
    m = 10 ** 9 + 7
    if n == 1:
        return 1
    return (2 * (fact(2 * n - 1, m) * rev(fact(n, m) * fact(n - 1, m), m)) - n) % m

print(main(int(input())))

def po(a,b,m):
    if b == 0:
        return 1
    if b % 2 == 0:
        return (po(a, b // 2, m) ** 2) % m
    return (po(a, b - 1, m) * a) % m

def rev(a,m):
    return po(a, m - 2, m)

def fact(a, m):
    t = a
    for i in range(1, a):
        t=(t * i) % m
    return t

def main(n):
    m = 10 ** 9 + 7
    if n == 1:
        return 1
    return (2*(fact(2 * n - 1, m) * rev(fact(n, m) * fact(n - 1, m), m)) - n) % m

print(main(int(input())))

#love python :)
#medo journy to icpc
n = int(input())
m = int(1e9 + 7)
p = 1
for i in range(1, n + 1):
    p *= 2 * n - i
    p *= pow(i, m - 2, m)
    p %= m
print((2 * p - n) % m)

#!/usr/bin/python
MOD = 1000000007

def ext_gcd(a, b):
    if b == 0:
        return (a, 1, 0)
    (dp, xp, yp) = ext_gcd(b, a % b)
    return (dp, yp, xp - a//b * yp)

def mod_solve(a, b, n):
    (d, xp, yp) = ext_gcd(a, n)
    if b % d == 0:
        x0 = xp * (b/d) % n
        return x0
    else:
        return None

# calculates \choose(2*k-1, k)
def choose(n, nInv):
    result = 1
    for i in range(2*n-1, n-1, -1):
        result = result * i % MOD
    for i in range(n):
        result = result * nInv[i] % MOD
    return result

def solve():
    n = int(raw_input())
    nInv = [mod_solve(i, 1, MOD) for i in range(1, n+1)]
    print (choose(n, nInv) * 2 - n) % MOD

solve()

def readint(): return int(raw_input())

M = 1000000007

def egcd(a, b):
	if (a % b == 0):
		return (0, 1)
	t = egcd(b, a % b)
	return (t[1], t[0] - t[1] * (a / b))

def c(n, k):
	a = 1
	for i in xrange(n, n - k, -1):
		a *= i
		a %= M
	b = 1
	for i in xrange(1, k + 1):
		b *= i
		b %= M
	r = egcd(b, M)[0]
	return (a * r) % M

def run():
	n = readint()
	res = c(n + n - 1, n) * 2 - n
	res += M
	res %= M
	print res
run()

n = int(raw_input())

mod = 1000000007

def a(n):
  if n == 0:
    return 1
  sol = 1
  for x in xrange(n+1, 2*n+1):
    sol = (sol * x) % mod
    #print "!", x, sol

  for x in xrange(1, n+1):
    sol = (sol * pow(x,mod-2,mod)) % mod
    #print x, div, , sol

  return sol

def c(n):
  return (a(n) - n) % mod

print c(n)

n = input()
m = 1000000007
f = lambda a,b: reduce(lambda x,y: (x*y)%m,xrange(a,b),1)
a = f(n+1,n+n)*pow(f(2,n),m-2,m)
print (2*a-n+m)%m

n = input()
m = 1000000007
a = reduce(lambda x,y: (x*y)%m,range(n+1,n+n)+map(lambda x:pow(x,m-2,m),xrange(2,n)),1)
print (2*a-n+m)%m

n = int(raw_input())
mod = 1000000007
num,den = 1,1
for i in xrange(n+1,2*n):  num  = (num*i)%mod
for i in xrange(1,n): den = (den*i)%mod

def evklid(a,b):
    if a == 1: return (1,0)
    u,v = divmod(b,a)
    x,y = evklid(v,a)
    return (y - u * x, x)

den1,dummy = evklid(den,mod)
den1%= mod

print (2*num*den1-n)%mod

p=1000000007
def C(n,m):
	return reduce(lambda x,y:x*(n-y)*pow(y+1,p-2,p)%p,[1]+range(m))
n=input()
print C(2*n,n)-n

M = 1000000007

n = input()

fn = 1
for i in range(1,n+1):
	fn *= i
	fn %= M
f2n = 1
for i in range(n+1,2*n+1):
	f2n *= i
	f2n %= M

# print n,(f2n/fn-n+M)%M
print (f2n*pow(fn,M-2,M)-n+M)%M

"""
def frac(n):
	r = 1
	for i in range(1,n+1):
		r *= i
	return r

n = input()

print (frac(2*n)/frac(n)/frac(n)-n)%1000000007
"""

"""
n = input()
ans = 0

def f(d,v):
	if d==0:
		f1 = True
		f2 = True
		for i in range(1,n):
			if v[i]>v[i-1]:
				f1 = False
			if v[i]<v[i-1]:
				f2 = False
		if f1 or f2:
			global ans
			ans += 1
	else:
		for i in range(1,n+1):
			f(d-1,v+[i])
	return

f(n,[])

print ans

def frac(n):
	r = 1
	for i in range(1,n+1):
		r *= i
	return r

for n in range(1,100):
	# ans = 0
	# fn,[])
	# print n,ans

	print n,frac(2*n)/frac(n)/frac(n)-n
"""

M = 1000000007
n = input()
ans = 1
for i in range(1,n+1):
	ans = ans * (n+i) * pow(i,M-2,M) % M
print (ans-n)%M

n = int(raw_input())
m = 1000000007
res = 1
for i in range(1, n):
    res = (res * (n+i) * pow(i, m-2, m)) % m;
print (2*res-n)%m

#!/usr/bin/python
import sys

MOD = 10 ** 9 + 7

def powmod (a, b, c):
	res = 1
	cur = a
	p = 1
	while p <= b:
		if p & b > 0:
			res = (res * cur) % c
		cur = (cur * cur) % c
		p <<= 1
	return res

def binom (n, k, c):
	k = min (k, n - k)
	f = 1
	for i in range (1, k + 1):
		f = (f * i) % c
	g = f
	for i in range (k + 1, n - k + 1):
		g = (g * i) % c
	h = g
	for i in range (n - k + 1, n + 1):
		h = (h * i) % c
	f = powmod (f, MOD - 2, MOD)
	g = powmod (g, MOD - 2, MOD)
	return (h * f * g) % MOD

while True:
	s = sys.stdin.readline ().strip ()
	if s == '':
		s = sys.stdin.readline ().strip ()
		if s == '':
			break
	n, = [int (x) for x in s.split ()]
	r = binom (n + n - 1, n, MOD)
	r = r * 2 - n
	print ((r % MOD) + MOD) % MOD

mod = 1000000007

def inv(n, p):
    return pow(n,p-2,p)

def comb(n,k):
    res = 1
    for i in range(k+1,n+1): res = (res*i) % mod
    for i in range(1,n-k+1): res = (res * inv(i, mod)) % mod
    return res

n = int(raw_input())
c = comb(2*n-1, n-1)
print (2*c - n) % mod

mod = 1000000007

def inv(a, b):
    tb = b
    x = 0
    lastx = 1
    y = 1
    lasty = 0
    while b != 0:
        quotient = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - quotient * x, x)
        (y, lasty) = (lasty - quotient * y, y)
    if (lastx < 0): lastx = tb + lastx
    return lastx

def comb(n,k):
    res = 1
    for i in range(k+1,n+1): res = (res*i) % mod
    for i in range(1,n-k+1): res = (res * inv(i,mod)) % mod
    return res

n = int(raw_input())
c = comb(2*n-1, n-1)
res = (2*c - n) % mod

print res

from math import factorial as fact
n = input ()
M = 1000000007

def egcd (a, b):
    if a % b == 0:
        return (0, 1)
    x = egcd (b, a % b)
    return (x[1], x[0] - x[1] * (a / b))

def C (n, k):
    a = 1
    for i in xrange (n - k + 1, n + 1):
        a *= i
        a %= M
    b = 1
    for i in xrange (1, k + 1):
        b *= i
        b %= M
    return (a * egcd (b, M)[0]) % M

print (2 * C (n * 2 - 1, n) - n) % M

#the same code using fermat's little theorem
def powe(x,y):
    if y==0:
        return 1
    ans=powe(x,y/2)
    ans*=ans
    ans%=1000000007
    if y%2==1:
        ans*=x
        ans%=1000000007
    return ans

n=input()
answer=1
div=1
for i in range(n+1,2*n):
    answer*=i
    answer%=1000000007
for i in range(2,n):
    div*=i
    div%=1000000007
answer*=powe(div,1000000007-2)
answer%=1000000007
print (((2*answer-n)%1000000007)+1000000007)%1000000007

M=1000000007
n=input()
f=[]
f.append(1)
for i in range(1,200000):
	f.append((f[i-1]*i)%M)
def power(a,b):
	if b==0:
		return 1
	z=power(a,b/2)%M
	if b%2==0:
		return (z*z)%M
	return (((z*z)%M)*a)%M
k=n-1
n=n+k
a=f[n]
b=f[k]
c=f[n-k]
b=power(b,M-2)%M
c=power(c,M-2)%M
ans=(((a*b)%M)*c)%M
print (ans*2-k-1+M)%M

MOD = 1000000007

fact = [1]
for i in range(200000):
    fact.append((fact[-1] * (i+1)) % MOD)

n = input()

nk = (((fact[2 * n - 1] * pow(fact[n], MOD - 2, MOD)) % MOD) * pow(fact[n - 1], MOD - 2, MOD)) % MOD
print (2 * nk - n) % MOD

MOD = 1000000007

n = input()

fn1 = 1
for i in range(2, n):
    fn1 = (fn1 * i) % MOD

fn = (fn1 * n) % MOD
f2n1 = fn
for i in range(n + 1, 2 * n):
    f2n1 = (f2n1 * i) % MOD

nk = (((f2n1 * pow(fn, MOD - 2, MOD)) % MOD) * pow(fn1, MOD - 2, MOD)) % MOD
print (2 * nk - n) % MOD

n = int(raw_input())

mod = 10 ** 9 + 7

p_n = 1
for i in range(2, n + 1):
    p_n *= i
    p_n %= mod

p_2n = p_n
for i in range(n + 1, 2 * n + 1):
    p_2n *= i
    p_2n %= mod

p_n *= p_n
p_n %= mod

p_n = pow(p_n, mod - 2, mod)
ans = p_2n * p_n
ans %= mod

print ans-n

#!/usr/bin/python

n = int (raw_input())
mod = 1000000007
ans = 1
div = 1
for i in range(1, n):
	ans = (n + i) * ans % mod
	div = i * div % mod
ans = ans * 2 % mod * pow(div, mod - 2, mod) % mod - n
ans %= mod
print ans

def choose(m, n, mod):
    factors = (m + 1) * [ 0 ]
    is_prime = (m + 1) * [ True ]
    is_prime[0] = is_prime[1] = False
    p = 0
    while True:
        while p <= m and not is_prime[p]:
            p += 1
        if p > m:
            break
        if p <= n:
            factors[p] -= 1
        elif p > m - n:
            factors[p] += 1
        for i in range(2 * p, m + 1, p):
            x = i
            y = 0
            while x % p == 0:
                x //= p
                y += 1
            if i <= n:
                factors[p] -= y
            elif i > m - n:
                factors[p] += y
            is_prime[i] = False
        p += 1
    #print(m, n, factors, is_prime)
    x = 1
    for p in range(2, m + 1):
        for i in range(factors[p]):
            x = (x * p) % mod
    return x

n = int(raw_input())
mod = 1000000007
result = (2 * choose(2 * n - 1, n - 1, mod) - n) % mod
print(result)

# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
from math import gcd, ceil

def prod(a, mod=10**9+7):
    ans = 1
    for each in a:
        ans = (ans * each) % mod
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y

def modInverse(a, m) :
    a = a % m;
    for x in range(1, m) :
        if ((a * x) % m == 1) :
            return x
    return 1

for _ in range(int(input()) if not True else 1):
    n = int(input())
    #n, k = map(int, input().split())
    #a, b = map(int, input().split())
    #c, d = map(int, input().split())
    #a = list(map(int, input().split()))
    #b = list(map(int, input().split()))
    #s = input()
    mod = 10**9 + 7
    if 1:
        max_n = 250000
        fact, inv_fact = [0] * (max_n + 1), [0] * (max_n + 1)
        fact[0] = 1
        for i in range(max_n):
            fact[i + 1] = fact[i] * (i + 1) % mod

        inv_fact[-1] = pow(fact[-1], mod - 2, mod)
        for i in reversed(range(max_n)):
            inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod

        def nCr_mod(n, r):
            res = 1
            while n or r:
                a, b = n % mod, r % mod
                if a < b:
                    return 0
                res = res * fact[a] % mod * inv_fact[b] % mod * inv_fact[a - b] % mod
                n //= mod
                r //= mod
            return res

        print((nCr_mod(2*n,n) - n)%mod)

def fact(n):
    if n==1:
        return 1
    return fact(n-1)*n%(10**9+7)

def rev(a):
    return pow(a,10**9+5,10**9+7)

def c2nn(n):
    return fact(2*n)*rev(fact(n)**2)%(10**9+7)

n=int(input())
print(c2nn(n)*2-n)

def fact(n):
    res=1
    for i in range(2,n+1):
        res=(res*i)%(10**9+7)
    return res

def rev(a):
    return pow(a,10**9+5,10**9+7)

def c2nn(n):
    return fact(2*n+1)*(rev(fact(n))*rev(fact(n+1)))%(10**9+7)

n=int(input())
print(c2nn(n-1)*2-n)

n = int(input())
m = int(1e9 + 7)
# binom(2n - 1, n)
p = 1
for i in range(1, n + 1):
    p  *= 2 * n - i
    p //= i
print(2 * p - n)

n = int(input())
m = int(1e9 + 7)
# binom(2n - 1, n)
p = 1
for i in range(1, n + 1):
    p  *= 2 * n - i
    p //= i
    p  %= m
print((2 * p - n) % m)

def po(a,b,m):
    if b == 0:
        return 1
    if b % 2 == 0:
        return (po(a, b // 2, m) ** 2) % m
    return (po(a, b - 1, m) * a) % m

def rev(a,m):
    return po(a, m - 2, m)

def fact(a, m):
    t = a
    for i in range(1, a):
        t=(t * i) % m
    return t

def main(n):
    m = 10 ** 9 + 7
    return (2*(fact(2 * n - 1, m) * rev(fact(n, m) * fact(n - 1, m), m)) - n) % m

print(main(int(input())))

#!/usr/bin/python
MOD = 1000000007

def ext_gcd(a, b):
    if b == 0:
        return (a, 1, 0)
    (dp, xp, yp) = ext_gcd(b, a % b)
    return (dp, yp, xp - a//b * yp)

def mod_solve(a, b, n):
    (d, xp, yp) = ext_gcd(a, n)
    if b % d == 0:
        x0 = xp * (b/d) % n
        return x0
    else:
        return None

# calculates \choose(2*k-1, k)
def choose(n, nInv):
    result = 1
    for i in range(2*n-1, n-1, -1):
        result = result * i % MOD
    for i in range(n):
        result = result * nInv[i] % MOD
    return result

def solve():
    n = int(raw_input())
    nInv = [mod_solve(i, 1, MOD) for i in range(1, n+1)]
    print choose(n, nInv) * 2 - n

solve()

from math import factorial
def readint(): return int(raw_input())

def c(n, k):
	return factorial(n) / factorial(k) / factorial(n - k)

def run():
	n = readint()
	res = c(n + n - 1, n) * 2 - n
	print res
run()

n = int(raw_input())

mod = 1000000007

def egcd(a, b):
    u, u1 = 1, 0
    v, v1 = 0, 1
    g, g1 = a, b
    while g1:
        q = g // g1
        u, u1 = u1, u - q * u1
        v, v1 = v1, v - q * v1
        g, g1 = g1, g - q * g1
    return u, v, g

def a(n):
  if n == 0:
    return 1
  sol = 1
  for x in xrange(n+1, 2*n+1):
    sol = (sol * x) % mod
    #print "!", x, sol

  for x in xrange(1, n+1):
    div = egcd(x, mod)[0] % mod
    sol = (sol * div) % mod
    #print x, div, pow(x,mod-2,mod), sol

  return sol / 2

def c(n):
  return (2*a(n) - n) % mod

print c(n)

n = int(raw_input())

def a(n):
  if n == 0:
    return 1
  return 2*(2*n+1)*a(n-1)/(n+1)

def c(n):
  return 2 * a(n-1) - n

#for x in range(1, 10):
#  print x, c(x)

print c(n)

n = int(raw_input())

mod = 1000000007

def a(n):
  if n == 0:
    return 1
  sol = 1
  for x in xrange(1, n+1):
    sol = (2*(2*x+1)*sol/(x+1)) % mod
  return sol

def c(n):
  return (2 * a(n-1) - n) % mod

#for x in range(1, 10):
#  print x, c(x)

print c(n)

n = int(raw_input())

mod = 1000000007

def a(n):
  if n == 0:
    return 1
  sol = 1
  for x in xrange(n+1, 2*n+1):
    sol = (sol * x) % mod
    #print "!", x, sol

  for x in xrange(1, n+1):
    sol = (sol * pow(x,mod-2,mod)) % mod
    #print x, div, , sol

  return sol / 2

def c(n):
  return (2*a(n) - n) % mod

print c(n)

M = 1000000007
n = input()
ans = 1
for i in range(1,n+1):
	ans = ans * (n+i) * pow(i,M-2,M) % M
print ans