Solution to the problem number 101635F of Codeforces - 101635F.

Any questions do not hesitate to contact.

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int cases;
    while(scanf("%d",&cases)!=EOF)
    {
        long long int num,a,b,res=0; cin>>num;
        for(int i=0; i<num;i++)
        {
            cin>>a>>b;
            res+=(a*b);
        }
        cout<<res/cases<<endl;
    }
    return 0;
}

Don't miss anything.

Keep in touch with Isaac Lozano Osorio!