Solution to the problem number 13287 of UVA - 13287.

Any questions do not hesitate to contact.

//Problema F Swerc 2017 Shattered Cake

#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!