import std.stdio;
import std.string;
import std.conv;
import std.algorithm;

void main() {
    int n = readln.chomp.to!int;
    int price = 0;
    int[][] apList;
    for (int i = 0; i < n; i++) {
        auto ap = readln.chomp.split.map!(to!int);
        int a = ap[0];
        int p = ap[1];
        apList ~= [a, p];
    }

    for (int i = 1; i < n; i++) {
        if (apList[i - 1][1] < apList[i][1]) {
            apList[i][1] = apList[i - 1][1];
        }
    }

    int answer = 0;
    foreach (e; apList) {
        answer += e[0] * e[1];
    }

    writeln(answer);
}