/*
PKU 2017
by Dev-C++ 4.9.9.0
*/
#include <stdio.h>
#include <stdlib.h>
int compute(int n)
{
int start,stop,v;
int tot;
start = 0;
tot = 0;
while(n--)
{
scanf(" %d",&v);
scanf(" %d",&stop);
tot += v * ( stop - start );
start = stop;
}
return tot;
}
int main(int argc, char *argv[])
{
int n;
int tot;
scanf(" %d",&n);
while(-1 != n)
{
tot = compute(n);
printf("%d miles\n",tot);
scanf(" %d",&n);
}
/* system("PAUSE"); */
return 0;
}