Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n=input()
num = list(map(int, input().split()))

ans = 1
for i in num:
  ans *= i
  if ans > 1000000000000000000:
    ans = -1
  
if ans > 1000000000000000000:
  ans = -1
print(ans)

Fixed submission:
n=input()
num = list(map(int, input().split()))

num.sort()

ans = 1
for i in num:
  ans *= i
  if ans > 1000000000000000000:
    print(-1)
    exit()
  
if ans > 1000000000000000000:
  ans = -1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=input()
num = list(map(int, input().split()))

ans = 1
for i in num:
  ans *= i
if ans > 1000000000000000000:
  ans = -1
print(ans)

Fixed submission:
n=input()
num = list(map(int, input().split()))

num.sort()

ans = 1
for i in num:
  ans *= i
  if ans > 1000000000000000000:
    print(-1)
    exit()
  
if ans > 1000000000000000000:
  ans = -1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input(),split())
print(a * b)

Fixed submission:
a, b = map(int, input().split())
print(a * b)

Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print(a * b)

Fixed submission:
a, b = map(int, input().split())
print(a * b)
Buggy python submission (verdict: Runtime Error):
n = int(input())
num_list = map(int, input().split())

max = pow(10, 18)
result = 1
for num in num_list:
  if num == 0:
    print(0)
    break
    else:
      result = result * num
      if result > max:
        print(-1)
        break 
        print(result)

Fixed submission:
def calc(num_list) -> int:
    result = 1
    max = 10**18

    if 0 in num_list:
        return 0

    for num in num_list:
        result *= num
        if result > max:
            return -1
    return result

n = int(input())
num_list = list(map(int, input().split()))

print(str(calc(num_list)))
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal
from math import floor

a_in, b_in= input().split()
a = int(a)
b = Decimal(b_in)

print(floor(a * b))

Fixed submission:
from decimal import Decimal
from math import floor

a_in, b_in= input().split()
a = int(a_in)
b = Decimal(b_in)

print(floor(a * b))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
L = list(map(int,input().split()))
if(0 in L):
    print(0)
    sys.exit()
    
sum_l = 1
for x in L:
    sum_l *= x

if(sum_l > 10** 18):
    print(-1)
else:
    print(sum_l)
    

Fixed submission:
import sys
N = int(input())
L = list(map(int,input().split()))
if(0 in L):
    print(0)
    sys.exit()
    
sum_l = 1
for x in L:
    sum_l *= x
    if(sum_l > 10 **18):
        print(-1)
        sys.exit()

print(sum_l)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
N = int(input())
L = []
for x in range(1,N+1):
    for y in range(1,N+1):
       if(x == y):
           L.append(x)
       elif(x % y == 0):
           L.append(y)
       elif(y % x == 0):
           L.append(x)
       else:
           L.append(gcd(x,y))
for x in L:
    for z in range(1,N+1):
       if(x == z):
           ans += x 
       elif(x % z == 0):
           ans += z
       elif(z % x == 0):
           ans += x
       else:
           ans += gcd(x,z)
print(ans) 

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
N = int(input())
L = []
s_dict = {}
for x in range(1,N+1):
    for y in range(1,N+1):
       if(x == y):
           L.append(x)
           s_dict[(x,y)] = x
       elif(x % y == 0):
           L.append(y)
           s_dict[(x,y)] = y
       elif(y % x == 0):
           L.append(x)
           s_dict[(x,y)] = x
       else:
           tmp = gcd(x,y)
           L.append(tmp)
           s_dict[(x,y)] = tmp

for x in L:
    for z in range(1,N+1):
        ans += s_dict[(x,z)]
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
N = int(input())
L = []
for x in range(1,N+1):
    for y in range(1,N+1):
       L.append(gcd(x,y))
for x in L:
    for z in range(1,N+1):
        ans += gcd(x,z)
print(ans) 

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
N = int(input())
L = []
s_dict = {}
for x in range(1,N+1):
    for y in range(1,N+1):
       if(x == y):
           L.append(x)
           s_dict[(x,y)] = x
       elif(x % y == 0):
           L.append(y)
           s_dict[(x,y)] = y
       elif(y % x == 0):
           L.append(x)
           s_dict[(x,y)] = x
       else:
           tmp = gcd(x,y)
           L.append(tmp)
           s_dict[(x,y)] = tmp

for x in L:
    for z in range(1,N+1):
        ans += s_dict[(x,z)]
        
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
N = int(input())
for x in range(1,N+1):
    for y in range(1,N+1):
        for z in range(1,N+1):
            ans += gcd(x,y,z)
print(ans) 

Fixed submission:
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = 0
N = int(input())
L = []
s_dict = {}
for x in range(1,N+1):
    for y in range(1,N+1):
       if(x == y):
           L.append(x)
           s_dict[(x,y)] = x
       elif(x % y == 0):
           L.append(y)
           s_dict[(x,y)] = y
       elif(y % x == 0):
           L.append(x)
           s_dict[(x,y)] = x
       else:
           tmp = gcd(x,y)
           L.append(tmp)
           s_dict[(x,y)] = tmp

for x in L:
    for z in range(1,N+1):
        ans += s_dict[(x,z)]
        
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
X,Y = map(int,input().spliut())
if(X == 1 or Y == 1):
    print(0)
    sys.exit()
print(int((X * (X-1))/2 + Y))


Fixed submission:
import sys
X,Y = map(int,input().split())
if(X == 1 and Y == 1):
    print(0)
    sys.exit()
elif(Y == 1):
    print(int(X/2))
    sys.exit()
elif(X == 0 and Y ==2):
    print(1)
    sys.exit()
print(int((X * (X-1))/2 + int((Y * (Y-1))/2 )))
Buggy python submission (verdict: Time Limit Exceeded):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K):
    #print(x)
    if (len(L) != 0):
        del L[0]
   # print(L)
print(sum(L))

Fixed submission:
import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))

Buggy python submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K-1):
    del L[0]
   # print(L)
print(sum(L))

Fixed submission:
import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))

Buggy python submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort(reverse=True)
#print(L)
for x in range(K-1):
    del L[0]
    print(L)
print(sum(L))

Fixed submission:
import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))

Buggy python submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
#print(L)
for x in range(K):
    del L[-1]
print(sum(L))

Fixed submission:
import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))

Buggy python submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
#print(L)
for x in range(K):
    del L[-1]
print(sum(L))

Fixed submission:
import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))

Buggy python submission (verdict: Runtime Error):
import math
N,K = map(int,(input().split()))
L = list(map(int,(input().split())))
L.sort()
print(L)
for x in range(K):
    del L[-1]
print(sum(L))

Fixed submission:
import math
N,K = map(int,(input().split()))
#print(N,K)
L = list(map(int,(input().split())))
L.sort()
#print(L)
num = N-K
if(num < 0):
    num = 0
L = L[0:num]
#print(L)
print(sum(L))
Buggy python submission (verdict: Runtime Error):
A,B= map(int, input().split())
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

Fixed submission:
A,B= map(int, input().split())
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(A, B))

Buggy python submission (verdict: Runtime Error):
A,B= map(int, input().split())
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(A, B))

Fixed submission:
A,B= map(int, input().split())
def gcd(a,b):
  while b!=0:
    a,b=b,a%b
  return a

def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(A, B))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N = int(input())
l = list(map(int, input().split()))
a = []
for i in range(N):
    a.append(l.index(i+1)+1)

print(' '.join(map(str, a)))

Fixed submission:
import sys
N = int(input())
l = list(map(int, input().split()))
a = [0] * N
for i in range(N):
    index =l[i] -1
    #print(index)
    a[index] = i+1
    #print(a[index])
    

print(' '.join(map(str, a)))
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=list(map(int,input().split()))
town=1
townhairetu=[1]
n=0
for i in range(K):
	town=A[town-1]
	if(town in townhairetu):
		n=i+1-townhairetu.index(town)
		break
	else:
		townhairetu.append(town)
print(townhairetu[(K-townhairetu.index(town))%n+townhairetu.index(town)])

Fixed submission:
S=input()
T=input()
T=T[:-1]
if(S==T):
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
L=list(map(int,input().split()))
	print(sum(L)-max(L))

Fixed submission:
L=list(map(int,input().split()))
print(sum(L)-max(L))
Buggy python submission (verdict: Runtime Error):
N=int(input())
K=int(input())
a=list(map(int,input().split()))
s=0
for i in range(len(a)):
  if a[i]<=K-a[i]:
    s=s+2*a[i]
  else:
    s=s+2*(K-a[i])
print(s)


Fixed submission:
N=int(input())
A=int(input())
B=N**2-A
print(B)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = []
for i in range(n):
    x = int(input())
    l.append(x)
l.sort()
l = l[::-1]
ans = 0 
ans += l[0]//2
for i in range(1,n):
    ans+=l[i]
print(ans)




Fixed submission:
n = int(input())
l = ["Christmas"]
for i in range(25-n):
    l.append("Eve")
print(*l)
Buggy python submission (verdict: Runtime Error):
n=int(input())
number=[int(x) for x in input().split()]

for numb in number:
  sum *= numb
if(sum > pow(10,18)):
	print(-1)
else:
  print(sum)

Fixed submission:
a,b=(int(x) for x in input().split())
print(a*b)

Buggy python submission (verdict: Runtime Error):
a, b = int(input()), int(input())
print(a * b)

Fixed submission:
a, b = map(int, input().split())
print(a * b)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
n, *a = map(int, open(0).read().split())
ans = reduce(lambda x, y: x*y, a, 1)
print((-1 if ans > 10**18 else ans))


Fixed submission:
n, *a = map(int, open(0).read().split())
ans = 1
for i in range(n):
    if ans == -1:
        if a[i] == 0:
            ans = 0
            break
    else:
        ans *= a[i]
        if ans > 10**18:
            ans = -1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
def solution():
    a, b, h, m  = map(int, input().split())
    return round((a**2 + b**2 -2*a*b*math.cos(2*math.pi*(h/12 - m/60)))**0.5, 9)

print(solution())

Fixed submission:
def solution():
    n = int(input())
    bon = [3]
    pon = [0, 1, 6, 8]
    last = n % 10
    if last in bon:
        return 'bon'
    elif last in pon:
        return 'pon'
    else:
        return 'hon' 
    
print(solution())

Buggy python submission (verdict: Runtime Error):
import math
def solution():
    a, b, h, m  = map(int, input().split())
    return (a**2 + b**2 -2*a*b*round(math.cos(2*math.pi*(h/12 - m/60)), 9))**0.5

print(solution())

Fixed submission:
def solution():
    n = int(input())
    bon = [3]
    pon = [0, 1, 6, 8]
    last = n % 10
    if last in bon:
        return 'bon'
    elif last in pon:
        return 'pon'
    else:
        return 'hon' 
    
print(solution())
Buggy python submission (verdict: Runtime Error):
def solution():
    k = int(input())
    s = int(input())
    if len(s) > k:
        return s[:k] + '...'
    else:
        return s

print(solution())

Fixed submission:
def solution():
    k = int(input())
    s = str(input())
    if len(s) > k:
        return s[:k] + '...'
    else:
        return s

print(solution())
Buggy python submission (verdict: Runtime Error):
import math
def solution():
    a, b, h, m  = map(int, input().split())
    return (a*a+b*b-2*a*b*cos((m*11/360-h/6)*pi))**.5
print(solution())


Fixed submission:
from math import *
def solution():
    a, b, h, m  = map(int, input().split())
    return (a*a+b*b-2*a*b*cos((m*11/360-h/6)*pi))**.5
print(solution())

Buggy python submission (verdict: Runtime Error):
import math
def solution():
    a, b, h, m  = map(int, input().split())
    return math.round((a**2 + b**2 -2*a*b*math.cos(2*math.pi*(h/12 - m/60)))**0.5, 9)

print(solution())

Fixed submission:
from math import *
def solution():
    a, b, h, m  = map(int, input().split())
    return (a*a+b*b-2*a*b*cos((m*11/360-h/6)*pi))**.5
print(solution())

Buggy python submission (verdict: Runtime Error):
import math
def solution():
    a, b, h, m  = map(int, input().split())
    return math.round((a**2 + b**2 -2*a*b*math.cos(2*math.pi*(h/12 - m/60)))**0.5, 9)

print(solution())

Fixed submission:
from math import *
def solution():
    a, b, h, m  = map(int, input().split())
    return (a*a+b*b-2*a*b*cos((m*11/360-h/6)*pi))**.5
print(solution())

Buggy python submission (verdict: Runtime Error):
import math
def solution():
    a, b, h, m  = map(int, input().split())
    return (a**2 + b**2 -2*a*b*round(math.cos(2*math.pi*(h/12 - m/60)), 9)**0.5

print(solution())

Fixed submission:
from math import *
def solution():
    a, b, h, m  = map(int, input().split())
    return (a*a+b*b-2*a*b*cos((m*11/360-h/6)*pi))**.5
print(solution())

Buggy python submission (verdict: Runtime Error):
import math
def solution():
    [a, b, h, m] = [int(input()) for _ in range(4)]
    return pow(a**2 + b**2 -2*a*b*round(math.cos(2*math.pi*(h/12 - m/60)), 9), 0.5)

print(solution())

Fixed submission:
from math import *
def solution():
    a, b, h, m  = map(int, input().split())
    return (a*a+b*b-2*a*b*cos((m*11/360-h/6)*pi))**.5
print(solution())

Buggy python submission (verdict: Runtime Error):
import math
def solution():
    a, b, h, m = [int(input()) for i in range(4)]
    return pow(a**a + b*b -2*a*b*math.cos(2*math.pi*(h/12 - m/60)))

print(solution())

Fixed submission:
from math import *
def solution():
    a, b, h, m  = map(int, input().split())
    return (a*a+b*b-2*a*b*cos((m*11/360-h/6)*pi))**.5
print(solution())
Buggy python submission (verdict: Runtime Error):
(n,m),*e=[[*map(int, t.split())] for t in input()]
t=[[]for _ in range(n+1)]
for a,b in e:t[a]+=[b];t[b]+=[a]
q=[1]
a=[0]*-~n
while q:q=[a[j]==0and(a.__setitem__(j,i)or j)for i in q for j in t[i]]
print('Yes',*a[2:])

Fixed submission:
(n,m),*e=[[*map(int, t.split())] for t in open(0)]
t=[[]for _ in range(n+1)]
for a,b in e:t[a]+=[b];t[b]+=[a]
q=[1]
a=[0]*-~n
while q:q=[a[j]==0and(a.__setitem__(j,i)or j)for i in q for j in t[i]]
print('Yes',*a[2:])
Buggy python submission (verdict: Runtime Error):
[n, k], [*a] = [[*map(int, t.split())] for t in open(0)]
count = 0
visited = dict()
tmp = 1
while count <= k and tmp not in visited:
    visited[tmp] = count
    tmp = a[tmp - 1]
    count += 1
if count <= k:
    k = (k - count) % (count - visited[tmp])
    for _ in range(k):
        tmp = a[tmp - 1]
print(tmp)

Fixed submission:
s = str(input())
t = str(input())
ans = 'No'
if s == t[:-1]:
    ans = 'Yes'
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
[n, k], [*a] = [[*map(int, t.split())] for t in open(0)]
ans = 1
for _ in range(k):
    ans = a[ans - 1]
print(ans)


Fixed submission:
[n, k], [*a] = [[*map(int, t.split())] for t in open(0)]
count = 0
visited = dict()
tmp = 1
while count < k:
    visited[tmp] = count
    count += 1
    tmp = a[tmp - 1]
    if tmp in visited:
        break
if count < k:
    k = (k - count) % (count - visited[tmp])
    for _ in range(k):
        tmp = a[tmp - 1]
print(tmp)
Buggy python submission (verdict: Runtime Error):
n, m, k = [int(t) for t in open(0).read().split()]
mod = 998244353


def solve(n):
    if n <= k + 1:
        return pow(m, n, mod)
    elif n == k + 2:
        return (pow(m, n, mod) + mod - m) % mod
    else:
        return (m * solve(n - 1) - (m - 1) * solve(n - k - 2)) % mod


print(solve(n))


Fixed submission:
n, m, k = [int(t) for t in open(0).read().split()]
mod = 998244353
mem = [0] * max(k + 3, n + 1)
for i in range(k + 2):
    mem[i] = pow(m, i, mod)
c = 1
for i in range(k + 2, n + 1):
    mem[i] = (m * mem[i - 1] - m * c * pow(m - 1, i - k - 2, mod)) % mod
    c = (c * (i - 1) * pow(i - k - 1, - 1, mod)) % mod
print(mem[n])
Buggy python submission (verdict: Runtime Error):
a, b, c = sys.stdin.readline().split()

if a + b >= c:
    print("Yes")
else : 
    print("No")

Fixed submission:
import sys

[a, b, c] = map(int,sys.stdin.readline().split())

if a + b >= c :
    print("Yes")
else : 
    print("No")
Buggy python submission (verdict: Runtime Error):
h = int(input(""))
w = int(input(""))
if h*w % 2 == 0:
    print(h*w/2)
else:
    print((h*w+1)/2)

Fixed submission:
H, W = list(map(int, input().split()))
if H==1 or W==1:
    print(1)
    exit()
res = int((H+1)/2) * W
if H%2==1:
    res -= int(W/2)
print(res)

Buggy python submission (verdict: Runtime Error):
h = int(input(""))
w = int(input(""))
if h*w % 2 == 0:
    print(h*w/2)
if h*2%2 == 1:
    print((h*w+1)/2)

Fixed submission:
H, W = list(map(int, input().split()))
if H==1 or W==1:
    print(1)
    exit()
res = int((H+1)/2) * W
if H%2==1:
    res -= int(W/2)
print(res)
Buggy python submission (verdict: Runtime Error):
zimport sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

A,B = MI()
print(A*B)


Fixed submission:
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
from bisect import bisect_left
from itertools import product
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
#文字列を一文字ずつ数字に変換、'5678'を[5,6,7,8]とできる
def LSI(): return list(map(int, list(sys.stdin.readline().rstrip())))
def LSI2(N): return [list(map(int, list(sys.stdin.readline().rstrip()))) for i in range(N)]
#文字列として取得
def ST(): return sys.stdin.readline().rstrip()
def LST(): return sys.stdin.readline().rstrip().split()
def LST2(N): return [sys.stdin.readline().rstrip().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)

A,B = MI()
print(A*B)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from collections import deque
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)
input = sys.stdin.readline

N = I()
l = LI()
array = [i for i in range(N)]
happy = 0
while True:
    for i in range(N-1):
        left = array[i]
        right = array[i+1]
        left_p = 1 if i-left>=0 else -1
        right_p = 1 if i+1-right<=0 else -1
        if left_p*l[left]+right_p*l[right]>0:
            happy += left_p*l[left]+right_p*l[right]
            array[i],array[i+1] = array[i+1],array[i]
            break
    else:
        break
print(happy)


Fixed submission:
import sys
import math
from collections import deque
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h,w): return [[i for j in range(w)] for k in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)
#'0.01'や'1E1'などで指定、整数に戻すならintをかます
MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**6+10)
input = sys.stdin.readline

R = I()
print(2*math.pi*R)