[Fixnum, Bignum].each do |klass|
	klass.class_eval do
		alias :orig_plus :+
		alias :orig_mul :*
		alias :orig_sub :-
		remove_method :*, :/, :%, :+, :-, :&
	end
end	

e0 = gets.chomp
results = []

redef = -> op, orig {
	Integer.class_eval { define_method(op){|x| send(orig, x)} }
}

[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)
	redef[op, :orig_plus]

	op = ops[priority[1]].pop
	e.gsub!(?b, op)
	redef[op, :orig_mul]

	op = ops[priority[2]].pop
	e.gsub!(?c, op)
	redef[op, :orig_sub]

	results << eval(e)
end

p results.max