| title | Sum of an reversed list with odd index item modification | |||
|---|---|---|---|---|
| tags |
|
Given a space separated string of numbers, reverse the list and add the odd index's square to the number at the odd index in the new reversed list.
Print the sum of this new list.
Assume the numbers are non-negative integers.
<template>
<sol>
nums = list(map(int, input().split()))
new_nums = nums[::-1]
for i in range(len(new_nums)):
if(i%2 != 0):
new_nums[i] += i**2
print(sum(new_nums))
</sol>
</template>1 1 1 1 1
15
2 3 1 2 2
20
22 32 12 22 22
120
0 0 0
1