import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = Integer.parseInt(sc.next()); List cards = new ArrayList<>(); for (int i = 0; i < N; i++) { cards.add(Integer.parseInt(sc.next())); } int sum = cards.get(0); if (cards.get(0) < 0 && cards.get(1) >= 0) sum = -sum; for (int i = 1; i < N; i++) { if (cards.get(i) < 0) { if (sum < 0) { sum *= cards.get(i); continue; } else { sum -= cards.get(i); continue; } } if (cards.get(i) == 1) { sum += cards.get(i); continue; } if (cards.get(i) > 0) { sum *= cards.get(i); } } System.out.println(sum); } }