#!/usr/bin/env python3 # -*- coding: utf-8 -*- import collections import itertools def calc(equation): is_operator = lambda x: x in "+*" operators = collections.deque() operands = collections.deque() for key, group in itertools.groupby(equation, is_operator): if key: operators.append("*" if "".join(group) == "+" else "+") else: operands.append(int("".join(group))) value = operands.popleft() while operators and operands: operand = operands.popleft() if operators.popleft() == "+": value += operand else: value *= operand return value def main(): print(calc(input())) if __name__ == '__main__': main()