#include using namespace std; #define modulo 1000000007 #define mod(mod_x) ((((long long)mod_x+modulo))%modulo) #define Inf 10000000000000000 struct unionfind{ vector data; vector size; unionfind(int n){ for(int i=0;isize[y])swap(x,y); data[x]=y; size[y]+=size[x]; return true; } bool check(int x,int y){ return (find(x)==find(y)); } int get_size(int x){ int X = find(x); return size[X]; } }; int main(){ int N,Md,Mw; cin>>N>>Md>>Mw; unionfind uf1(N),uf2(N); for(int i=0;i> P; long long ans = 0; for(int x=0;x t = make_pair(uf1.find(x),uf2.find(x)); if(P.count(t))continue; P.insert(t); ans += (long long)uf1.get_size(x)*uf2.get_size(x); } ans-=N; cout<