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); List input = new ArrayList<>(); while (sc.hasNext()) { input.add(sc.nextLine()); } System.out.println(solve(input)); sc.close(); } public static int solve(List in) { int N = Integer.valueOf(in.get(0)); int[][] cc = new int[N][]; for (int i = 1; i < N + 1; i++) { cc[i - 1] = new int[2]; cc[i - 1][0] = Integer.valueOf(in.get(i).split(" ")[0]); cc[i - 1][1] = Integer.valueOf(in.get(i).split(" ")[1]); } int total = 0; for (int i = 0; i < N; i++) { if (cc[i][0] % 2 == 0) { total += (cc[i][0] / 2) * cc[i][1]; } else { total += (cc[i][0] + 1) / 2 * cc[i][1]; } } return total; } }