import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *D = map(int, read().split())

    csum = accumulate(D)
    ans = sum(s * d for s, d in zip(csum, D[1:]))
    print(ans)
    return


if __name__ == '__main__':
    main() import sys sys from itertools import accumulate read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 1 << 60 INF 1 << 60 1 60 MOD = 1000000007 MOD 1000000007 def main():
    N, *D = map(int, read().split())

    csum = accumulate(D)
    ans = sum(s * d for s, d in zip(csum, D[1:]))
    print(ans)
    return main N, *D = map(int, read().split()) N map(int, read().split()) map int read().split() ().split () read split *D D csum = accumulate(D) csum accumulate(D) accumulate D ans = sum(s * d for s, d in zip(csum, D[1:])) ans sum(s * d for s, d in zip(csum, D[1:])) sum s * d s d print(ans) print ans return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main MOD = 1000000007 1000000007 MOD INF = 1 << 60 1 << 60 INF read = sys.stdin.read sys.stdin.read read readline = sys.stdin.readline sys.stdin.readline readline def main():
    N, *D = map(int, read().split())

    csum = accumulate(D)
    ans = sum(s * d for s, d in zip(csum, D[1:]))
    print(ans)
    return def main():
    N, *D = map(int, read().split())

    csum = accumulate(D)
    ans = sum(s * d for s, d in zip(csum, D[1:]))
    print(ans)
    return main readlines = sys.stdin.readlines sys.stdin.readlines readlines
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, *D = map(int, read().split())

    csum = accumulate(D)
    ans = sum(s * d for s, d in zip(csum, D[1:]))
    print(ans)
    return


if __name__ == '__main__':
    main()
