class Fixnum
    alias :orig_plus :+
    alias :orig_mul :*
    alias :orig_sub :-
end

e0 = gets.chomp
results = []

[0, 1, 2].repeated_permutation(3) do |priority|
    next if ! priority.include?(0)
    next if priority.sort.uniq == [0, 2]

    e = e0.tr("+*-", "abc")
    ops = [[?*, ?/, ?%], [?+, ?-], [?&]]

    op = ops[priority[0]].pop
    e.gsub!(?a, op)
    Fixnum.class_eval { alias_method(op, :orig_plus) }

    op = ops[priority[1]].pop
    e.gsub!(?b, op)
    Fixnum.class_eval { alias_method(op, :orig_mul) }

    op = ops[priority[2]].pop
    e.gsub!(?c, op)
    Fixnum.class_eval { alias_method(op, :orig_sub) }

    results << eval(e)
end

p results.max