main :-	read_num(N),
        read_n_num_data(N, M),
        write_ans(M).

write_ans(N) :-
        N > 1000000000000000000, !,
        write(-1), nl.
write_ans(N) :-
        write(N), nl.

read_n_num_data(N, M) :-
        read_n_num_data_aux(N, 1, M).
read_n_num_data_aux(0, Acc, Acc).
read_n_num_data_aux(N, Acc, M) :-
        read_num(InNum),
        NewN is N - 1,
        NewAcc is Acc * InNum,
        read_n_num_data_aux(NewN, NewAcc, M).

read_str(S) :-
        read_string(current_input, ' \n', '', _, S).

read_num(N) :-
        read_str(S),
        number_string(N, S).

:- main.
