4223 {
4224 map<int, double> A;
4225 map<int, double> B;
4226 int n;
4227 cin >> n;
4228 for(int i = 0; i < n; i++) {
4229 int exponent;
4230 double coefficient;
4231 cin >> exponent >> coefficient;
4232 A[exponent] = coefficient;
4233 }
4234 cin >> n;
4235 for(int i = 0; i < n; i++) {
4236 int exponent;
4237 double coefficient;
4238 cin >> exponent >> coefficient;
4239 B[exponent] = coefficient;
4240 }
4241 map<int, double> C;
4242 for(auto &[exponent, coefficient]: A) {
4243 for(auto &[exponent2, coefficient2]: B) {
4244 C[exponent + exponent2] += coefficient * coefficient2;
4245 }
4246 }
4247 int cnt = 0;
4248 for(auto &[exponent, coefficient]: C) {
4249 if(coefficient != 0) {
4250 cnt++;
4251 }
4252 }
4253 cout << cnt;
4254 for(auto it = C.rbegin(); it != C.rend(); ++it) {
4255 if(it->second != 0) {
4256 cout << ' ' << it->first << ' ' << fixed << setprecision(1) << it->second;
4257 }
4258 }
4259 return 0;
4260 }