package volume_X;
import java.util.Scanner;
public class Id_1939 {
/**
* @param args
*/
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
int n = input.nextInt();
int a [] [] = new int [15] [2];
while ( n != -1 ) {
for ( int i = 0; i < n; i++ ) { a [i] [0] = input.nextInt(); a [i] [1] = input.nextInt(); } int speed = a [0] [0] * a [0] [1]; for ( int i = 1; i < n; i++ ) speed += ( a [i] [0] * (a [i] [1] - a [i - 1] [1])); System.out.printf ("%d miles\n", speed); n = input.nextInt(); } } } [/sourcecode]