#include<stdio.h>
int main(void){
	int n, i;
	unsigned long total= 0, c, d;
	
	scanf("%d\n", &n);
	for(i = 0 ; i < n ; i++){
		scanf("%lu %lu\n", &c, &d);
		if(c%2 == 0){
			total += c / 2 * d;
		}else{
			total += ((c-1)/2 + 1) * d;
		}
	}

	printf("%lu\n", total);	
	return 0;
}