// Arup Guha
// 7/21/2014
// Solution to 2004 MCPC Problem G: Speed Limit
import java.util.*;

public class g {

    public static void main(String[] args) {

        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();

        // Process each case.
        while (n != -1) {

            // Add in distance for each segment.
            int ans = 0, curT = 0;
            for (int i=0; i<n; i++) {
                int speed = stdin.nextInt();
                int nextT = stdin.nextInt();
                ans += (speed*(nextT-curT));
                curT = nextT;
            }

            // Output and move to next case.
            System.out.println(ans+" miles");
            n = stdin.nextInt();
        }
    }
}
