class Solution:
def getDecimalValue(self, head: ListNode) -> int:
if not head:
return 0
temp=[]
while(head):
temp.append(head.val)
head=head.next
l=len(temp)
ans=0
for i in range(l):
ans+=(temp[~i]*(2**i))
return ans