#include<iostream> #include<cstdio> using namespace std; int main(){ int n,sum,s[15],t[15]; while(scanf("%d",&n)&&n!=-1){ for(int i=1;i<=n;i++){ scanf("%d%d",&s[i],&t[i]); } sum = 0; t[0] = 0; for(int i=1;i<=n;i++){ sum += s[i]*(t[i]-t[i-1]); } printf("%d miles\n",sum); } return 0; }