#include<bits/stdc++.h>
using namespace std;
short n,p;
long long m;
int main(){
    ios_base::sync_with_stdio(false);
 cin.tie(NULL);

cin>>m>>n>>p;
cout<<((m+p)*n*p +m*m)/p+m*m<<endl;


    return 0;
}
