https://pintia.cn/problem-sets/994805260223102976/problems
#include <iostream>
using namespace std;
int main() {
int a, b, flag = 0;
while (cin >> a >> b) {
if (b != 0) { //当b!=0时,因为给出的是所有非零项系数,所以必定会有输出
if (flag == 1) cout << " ";
cout << a * b << " " << b - 1;
flag = 1;
}
}
if (flag == 0) cout << "0 0";
return 0;
}