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

e0 = gets.chomp
results = []

[0, 1, 2].repeated_permutation(3) do |priority|
    tmp = priority.sort.uniq
    next unless tmp == (0..tmp.size-1).to_a

    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