Solution to the problem number 540 of AceptaelReto - 540.

Any questions do not hesitate to contact.

#include <bits/stdc++.h>
using namespace std;

int main(){
    int cases; scanf("%d",&cases);
    while(cases--){
        long long int n,m,p,d; scanf("%lld %lld %lld %lld",&n,&m,&p,&d);
        printf("%lld %lld\n",m*p+d,n*m+m*p+d);
    }
    return 0;
}

Don't miss anything.

Keep in touch with Isaac Lozano Osorio!