a = [int(g) for g in input().split()]
b = 0
for i in a:
print(a[i-1])
b += a[i-1]
print(b)
>>> "sss".split()
['sss']
>>> "s|s|s".split("|")
['s', 's', 's']
>>>
a = [int(g) for g in input().split()]
b = 0
for i in range(0, len(a) - 1):
print(a[i])
b += a[i]
print(b)