n = int(input())
a = list(map(int, input().split()))
res = []
mid = sum(a) // 3
for i in range(n):
    suma = 0
    for h in range(i, n):
        suma += a[h]
        if suma > mid:
            break
        if suma == mid:
            if not res:
                res.append(i + 1)
                res.append(h + 2)
                break
            else:
                res.append(h + 2)
                break
    if len(res) == 3:
        break
print(*res)