[이코테2021] 곱하기 혹은 더하기 - Python

import sys
input=sys.stdin.readline

n = input()
result = int(n[0])

for i in range(1,len(n)-1):
    num = int(n[i])
    
    if num <= 1 or result <= 1:
        result += num
    else:
        result *= num
        
print(result)