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:
            suma = 0
            for j in range(h + 1, n):
                suma += a[j] 
                if suma > mid:
                    break
                if suma == mid:
                    res.append(i + 1)
                    res.append(h + 2)
                    res.append(j + 2)
                    print(*res)
                    exit()
