Program Bamboo;

Const MaxN=100000; //maximal duration

Var f: Text;
    n: LongInt;  // duration
    p: Array [1..MaxN] of Int64;  // array of the prices
    l: Array [1..MaxN] of Int64;  // array of the lengths
    maxp: Int64;  //max price during the remaining days
    result: Int64;
    i, p1, l1: LongInt;
Begin
  {Read datum}
//  Assign(f, 'bamboo.in'); Reset(f);
  Readln(n);
  For i:= 1 To n Do Begin
    Readln(p1, l1);
    p[i]:= p1;
    l[i]:= l1;
  End;
  {Result evaluation}
  {Process last day}
  maxp:= p[n];
  result:= maxp*l[n];
  {Process other days}
  For i:= n-1 DownTo 1 Do Begin
    If p[i]>maxp Then Begin
      maxp:= p[i];
    End;
    Inc(result,maxp*l[i]);
  End;
  {Output}
  Writeln(result);
End.
