n, p = [int(i) for i in input().split()]

X = [int(i) for i in input().split()]



ans = []

S = [0]



for x in X:

    S.append(S[-1] + x)



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

    cur = n - t

    time = 5

    tmp = time * (S[-1] - S[cur]) + (t + n) * p

    cur -= t

    while True:

        tmp += time * (S[cur+t] - S[max(0,cur)])

        if cur <= 0:

            break

        cur -= t

        time += 2



    ans.append(tmp)



print((min(ans)))
n, p = [int(i) for i in input().split()]

X = [int(i) for i in input().split()]



ans = []

S = [0]



for x in X:

    S.append(S[-1] + x)



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

    tmp = 5 * S[n] + (t + n) * p

    cur = n - t * 2

    while cur > 0:

        tmp += 2 * S[cur]

        cur -= t



    ans.append(tmp)



print((min(ans)))
n, p = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = []
S = [0]
for x in X:
    S.append(S[-1] + x)
for t in range(1, n + 1):
    cur = n - t
    time = 5
    tmp = time * (S[-1] - S[cur]) + (t + n) * p
    cur -= t
    while True:
        tmp += time * (S[cur + t] - S[max(0, cur)])
        if cur <= 0:
            break
        cur -= t
        time += 2
    ans.append(tmp)
print((min(ans)))

n, p = [int(i) for i in input().split()]
X = [int(i) for i in input().split()]
ans = []
S = [0]
for x in X:
    S.append(S[-1] + x)
for t in range(1, n + 1):
    tmp = 5 * S[n] + (t + n) * p
    cur = n - t * 2
    while cur > 0:
        tmp += 2 * S[cur]
        cur -= t
    ans.append(tmp)
print((min(ans)))

-    cur = n - t -    time = 5 -    tmp = time * (S[-1] - S[cur]) + (t + n) * p -    cur -= t -    while True: -        tmp += time * (S[cur + t] - S[max(0, cur)]) -        if cur <= 0: -            break +    tmp = 5 * S[n] + (t + n) * p +    cur = n - t * 2 +    while cur > 0: +        tmp += 2 * S[cur] -        time += 2