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, len: Int64;
    i, l1, p1: LongInt;
Begin
  {Read datum}
  Readln(n);
  For i:= 1 To n Do Begin
    Readln(p1, l1);
    p[i]:= p1;
    l[i]:= l1;
  End;
//  Close(f);
  {Result evaluation}
  {Process last day}
  maxp:= p[n];
  len:= l[n];
  result:= 0;
  {Process other days}
  For i:= n-1 DownTo 1 Do Begin
    If p[i]>maxp Then Begin
      Inc(result, maxp*len);
      maxp:= p[i];
      len:= l[i];
    End
    Else Begin
      Inc(len, l[i]);
    End;
  End;
  Inc(result, maxp*len);
  Writeln(result);
End.
