#include <iostream> #include <algorithm> #include <cstdlib> #include <cstdio> #include <string> #include <cstring> #include <cmath> #include <ctime> using namespace std; #define read() freopen("in.txt", "r", stdin) #define write() freopen("out.txt", "w", stdout) #define rep( i , a , b ) for ( int i = ( a ) ; i < ( b ) ; ++ i ) #define For( i , a , b ) for ( int i = ( a ) ; i <= ( b ) ; ++ i ) #define clr( a , x ) memset ( a , x , sizeof a ) #define cpy( a , x ) memcpy ( a , x , sizeof a ) #define max(a,b) (a>b)?(a):(b) #define LL long long struct daoshu { int n; int e; }; daoshu temp[1002]; daoshu num[1002]; int main() { read(); int x,y; int index=0,k=0; while(scanf("%d%d",&x,&y)!=EOF) { temp[index].n = x; temp[index++].e = y; } for (int i = 0; i < index; ++i) { if (temp[i].e) { num[k].n = temp[i].n*temp[i].e; num[k++].e = temp[i].e - 1; } } if (k == 0) { printf("0 0 "); return 0; } for (int i = 0; i < k; ++i) { printf("%d %d",num[i].n,num[i].e); if (i-k+1) { printf(" "); }else { printf(" "); } } return 0; }