Snuke wants to use a robot to clean his room. There are N pieces of trash on a number line, each at position xi. The goal is to move all trash to position 0. The robot can move left or right, pick up trash, and deposit it at position 0. It consumes X energy to pick up or deposit trash, and (k+1)^2 energy to move a distance of 1 while carrying k pieces of trash. Find the minimum energy required to move all N pieces of trash to position 0. Constraints: 1 ≤ N ≤ 2 × 10^5, 0 < x1 < ... < xN ≤ 10^9, 1 ≤ X ≤ 10^9.

# Buggy version:
n,x=map(int,input().split())
line=list(map(int,input().split()))
Sum=[0]
sum=0
for i in range(n):
  sum+=line.pop()
  Sum.append(sum)
Ans=10**18
for k in range(1,n):
  p=0
  for i in range(n//k):
    if i==0:
      if n>=k:
        p+= (Sum[k])*5
      else:
        p+=(Sum[n])*5
        break
    else:
      if n> (k*i +k):
        p+= (Sum[k*i +k]-Sum[k*(i-1) +k])*(2*i +3)
      else:
        p+= (Sum[n]-Sum[k*(i-1) +k])*(2*i +3)
        break
  ans=(n+k)*x + p
  Ans=min(Ans,ans)
print(Ans)

# Fixed version:
n,x=map(int,input().split())
line=list(map(int,input().split()))
Sum=[0]
sum=0
for i in range(n):
  sum+=line.pop()
  Sum.append(sum)
Ans=10**18
for k in range(1,n):
  p=0
  for i in range(n+k-1//k):
    if i==0:
      if n>=k:
        p+= (Sum[k])*5
      else:
        p+=(Sum[n])*5
        break
    else:
      if n> (k*i +k):
        p+= (Sum[k*i +k]-Sum[k*(i-1) +k])*(2*i +3)
      else:
        p+= (Sum[n]-Sum[k*(i-1) +k])*(2*i +3)
        break
  ans=(n+k)*x + p
  Ans=min(Ans,ans)
print(Ans)

# Buggy version:
# coding:utf-8


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N, X = inpl()
A = inpl()
B = [0]
for a in A:
    B.append(B[-1] + a)

ans = INF
for k in range(1, N + 1):
    tmp = 0
    i = 0
    cur = N - k
    while True:
        e = 5 if i == 0 else 2 * i + 3
        tmp += e * (B[cur + k] - B[max(cur, 0)])
        if cur - k <= 0:
            break
        i += 1
        cur -= k

    ans = min(ans, tmp + (N + k) * X)

print(ans)

# Fixed version:
# coding:utf-8


INF = float('inf')


def inpl(): return list(map(int, input().split()))


N, X = inpl()
A = inpl()
B = [0]
for a in A:
    B.append(B[-1] + a)

ans = INF
for k in range(1, N + 1):
    e = 5
    cur = N - k
    tmp = e * (B[N] - B[cur]) + (N + k) * X
    cur -= k
    while True:
        tmp += e * (B[cur + k] - B[max(cur, 0)])
        if cur <= 0:
            break
        e += 2
        cur -= k

    ans = min(ans, tmp)

print(ans)

# Buggy version:
iN ,iX  = [int(x) for x in input().split()]

aCum = [0]
for x in input().split():
    aCum += [aCum[-1] + int(x)]

def fCeil(iT,iR):
    return -1 * iT // iR * -1

def fCalcCost(iN,iX,aCum,iK):
    iCost = (iN + iK ) * iX + 5 * aCum[-1]
    for i in range(2,fCeil(iN,iK) ):
        iCost += 2 * aCum[- i * iK]
    return iCost

iTotalCost = fCalcCost(iN,iX,aCum,1)
for iK in range(2,fCeil(iN,2) + 1):
    iThisCost = fCalcCost(iN,iX,aCum,iK)
    if iThisCost > iTotalCost:
        break
    else:
        iTotalCost = iThisCost
print(iTotalCost)


# Fixed version:

iN ,iX  = [int(x) for x in input().split()]
aCum = [0]
for x in input().split():
    aCum += [aCum[-1] + int(x)]

def fCeil(iT,iR):
    return -1 * iT // iR * -1

def fCalcCost(iN,iX,aCum,iK):
    iCost = (iN + iK ) * iX + 5 * aCum[iN]
    for i in range(2,fCeil(iN,iK) ):
        iCost += 2 * aCum[iN - i * iK ]
    return iCost

#枝刈り
iTotalCost = fCalcCost(iN,iX,aCum,1)
for iK in range(2,fCeil(iN,2) + 1):
    iThisCost = fCalcCost(iN,iX,aCum,iK)
    if iThisCost > iTotalCost:
        break
    else:
        iTotalCost = iThisCost
print(iTotalCost)

# Buggy version:
import sys
n,x= map(int,input().split())
a = list(map(int, sys.stdin.readline().split()))
ru = [0]*(n+1)
for i in range(1,n+1):
  ru[i] = ru[i-1]+a[i-1]
ans = float("inf")
for i in range(1,n+1):
  tmp = x*i+ru[n]*5
  j = n-i*2
  k = 2
  while j > 0:
    tmp+= ru[j]*k
    k += 2
    j -= i
  ans = min(ans,tmp)
print(ans+n*x)

# Fixed version:
import sys
n,x= map(int,input().split())
a = list(map(int, sys.stdin.readline().split()))
ru = [0]*(n+1)
for i in range(1,n+1):
  ru[i] = ru[i-1]+a[i-1]
ans = float("inf")
for i in range(1,(n+1)//2+1):
  tmp = x*i+ru[n]*5
  j = n-i*2
  while j > 0:
    tmp += ru[j]*2
    j -= i
  ans = min(ans,tmp)
print(ans+n*x)

# Buggy version:
N, X = map(int, input().split())
x = list(map(int, input().split()))

y = [x[0]]
for i in range(N-1):
    x[i+1] += x[i]
    y.append(x[i+1])

ans = 10**21
for k in range(1, N+1):
    num = N
    memo = k * X + X * N
    i = 0
    while num > k:
        memo += max(i+3, 5) * (y[num-1] - y[num-1-k])
        num -= k
    memo += max(i+3, 5) * (y[num-1])
    ans = min(ans, memo)

print(ans)


# Fixed version:
N, X = map(int, input().split())
x = list(map(int, input().split()))

y = [x[0]]
for i in range(N-1):
    x[i+1] += x[i]
    y.append(x[i+1])

ans = 10**21
for k in range(1, N+1):
    num = N
    memo = k * X + X * N
    i = 0
    while num > k:
        memo += max(i+3, 5) * (y[num-1] - y[num-1-k])
        num -= k
        i += 2
    memo += max(i+3, 5) * (y[num-1])
    ans = min(ans, memo)

print(ans)

# Buggy version:
n,x = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b,ans = [0],float("inf")
for i in range(n): b.append(b[-1]+a[i])
def f(k):
	m = 5*(b[n]-b[n-2*k])
	for i in range((n-k)//k): m+=(2*i+7)*(b[n-(2+i)*k]-b[max(0,n-(3+i)*k)])
	return m+k*x
for i in range(1,(n+1)//2+1): ans = min(f(i),ans)
print(ans+n*x)

# Fixed version:
n,x = (int(i) for i in input().split())
a = [int(i) for i in input().split()]
b,ans = [0],float("inf")
for i in range(n): b.append(b[-1]+a[i])
def f(k):
	m = 5*(b[n]-b[max(0,n-2*k)])
	for i in range((n-k)//k): m+=(2*i+7)*(b[n-(2+i)*k]-b[max(0,n-(3+i)*k)])
	return m+k*x
for i in range(1,(n+1)//2+1): ans = min(f(i),ans)
print(ans+n*x)