#include <iostream>
#include <cstdio>
#include <ctime>
#include <vector>
#include <climits>
#include <cstring>
#include <cmath>
#include <algorithm>

#define rep(i,a,b) for (int i=(a),_b=(b);i<_b;i++)
#define repn(i,a,b) for (int i=(a),_b=(b);i<=_b;i++)
#define pern(i,a,b) for (int i=(a),_b=(b);i>=_b;i--)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef long long ll;

const int maxn = 200010;

int n;
vector<int> a[maxn];
int nc[maxn];
int vis[maxn];
ll x, y, ans;
int leaves;

void input(){
	scanf("%d",&n);
	scanf("%I64d%I64d",&x,&y);
	rep(i,1,n){
		int u, v;
		scanf("%d%d",&u,&v);
		a[u].pb(v);
		a[v].pb(u);
	}
}

void dfs(int u){
	vis[u] = 1;
	rep(i,0,sz(a[u])){
		int v = a[u][i];
		if (vis[v]) continue;
		nc[u]++;
		dfs(v);
	}
	leaves += !nc[u];
}

void init(){
}

void solve(){
	if (x > y){
		ans = y * n - y;
		return;
	}
	dfs(1);
	ans = y * (leaves - 1) + x * (n - leaves);
	if (sz(a[1]) == 1) leaves--;
	repn(i,2,n){
		if (nc[i] == 0) leaves--;
		ans = min(ans, 1ll * y * (leaves - 1) + x * (n - leaves));
		if (nc[i] == 0) leaves++;
	}
}

void output(){
	printf("%I64d",ans);
}

int main(){
    clock_t timestart, timeend;
    timestart = clock();
//  freopen("input.inp","r",stdin);
//	freopen("output.out","w",stdout);
    input();
    init();
    solve();
    output();
    timeend = clock();
    //printf("Run Time : %lf",(timeend-timestart) * 1.0 / CLK_TCK);
	return 0;
}


//OUM HARI OUM, OUM TATSAT
// OUM NAMA VAGABATE BASUDEBAY
// OUM NAMA MA SWARASATI OUM NAMA

#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<sstream>
#include<stack>
#include<stdlib.h>
#include<iostream>
#include<algorithm>

#define cl(vctr) vctr.clear()
#define ms(v, ar) memset(ar, v, sizeof(ar))

const double pi=(double)(2.0 * acos( 0.0 ));
const int inf=1 << 30;
const double eps=1E-9;
const double e = exp(1.0);
const int sz=300000 + 5;
const int mod=1000000000 + 7;

using namespace std;
typedef long long int ll;
vector<ll>E[sz];
ll mx,node,tmp;
void dfs(ll p,ll u,ll c)
{
    ll a=E[u].size();
    tmp+=a>2?a-2:0;
    if(mx<c)
        mx=c,node=u;
    ll i,v,j=E[u].size();
    for(i=0;i<j;i++)
    {
        v=E[u][i];
        if(v!=p)
        dfs(u,v,c+1);
    }
}
int main()
{
    ll n,m,i,u,v,res,x,y;
    scanf("%I64d %I64d %I64d",&n,&x,&y);
        for(i=1;i<=n;i++)
        {
            E[i].clear();
        }
        for(i=0;i<n-1;i++)
        {
            scanf("%I64d %I64d",&u,&v);
            E[u].push_back(v);
            E[v].push_back(u);
        }
        if(x==y)
        {
            printf("%I64d\n",1ll*(n-1)*x);
            return 0;
        }
        if(x<y)
        {
            tmp=0;
            mx=-1;
            dfs(-1,1,0);
            tmp=0;
            dfs(-1,node,0);
            //tmp+=2;
            res=tmp*y+max(n-1-tmp,0ll)*x;
            printf("%I64d\n",res);
            return 0;
        }
        tmp=0;
        for(i=0;i<n-1;i++) tmp=max(tmp,(ll)E[i+1].size());
        if(tmp==n-1) res=(n-2)*y+x;
        else res=(n-1)*y;
//        tmp=((n*(n-1)/2)-(n-1));
//        if(tmp>=n-1) res=(n-1)*y;
//        else res=tmp*y+(n-1-tmp)*x;
        printf("%I64d\n",res);

    return 0;
}


//OUM HARI OUM, OUM TATSAT
// OUM NAMA VAGABATE BASUDEBAY
// OUM NAMA MA SWARASATI OUM NAMA

#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<sstream>
#include<stack>
#include<stdlib.h>
#include<iostream>
#include<algorithm>

#define cl(vctr) vctr.clear()
#define ms(v, ar) memset(ar, v, sizeof(ar))

const double pi=(double)(2.0 * acos( 0.0 ));
const int inf=1 << 30;
const double eps=1E-9;
const double e = exp(1.0);
const int sz=100000 + 5;
const int mod=1000000000 + 7;

using namespace std;
typedef long long int ll;
vector<ll>E[sz];
ll mx,node,tmp;
void dfs(ll p,ll u,ll c)
{
    ll a=E[u].size();
    tmp+=a>2?a-2:0;
    if(mx<c)
        mx=c,node=u;
    ll i,v,j=E[u].size();
    for(i=0;i<j;i++)
    {
        v=E[u][i];
        if(v!=p)
        dfs(u,v,c+1);
    }
}
int main()
{
    ll n,m,i,u,v,res,x,y;
    scanf("%I64d %I64d %I64d",&n,&x,&y);
        for(i=1;i<=n;i++)
        {
            E[i].clear();
        }
        for(i=0;i<n-1;i++)
        {
            scanf("%I64d %I64d",&u,&v);
            E[u].push_back(v);
            E[v].push_back(u);
        }
        if(x==y)
        {
            printf("%I64d\n",1ll*(n-1)*x);
            return 0;
        }
        if(x<y)
        {
            tmp=0;
            mx=-1;
            dfs(-1,1,0);
            tmp=0;
            dfs(-1,node,0);
            //tmp+=2;
            res=tmp*y+max(n-1-tmp,0ll)*x;
            printf("%I64d\n",res);
            return 0;
        }
        tmp=((n*(n-1)/2)-(n-1));
        if(tmp>=n-1) res=(n-1)*y;
        else res=tmp*y+(n-1-tmp)*x;
        printf("%I64d\n",res);

    return 0;
}


//OUM HARI OUM, OUM TATSAT
// OUM NAMA VAGABATE BASUDEBAY
// OUM NAMA MA SWARASATI OUM NAMA

#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<sstream>
#include<stack>
#include<stdlib.h>
#include<iostream>
#include<algorithm>

#define cl(vctr) vctr.clear()
#define ms(v, ar) memset(ar, v, sizeof(ar))

const double pi=(double)(2.0 * acos( 0.0 ));
const int inf=1 << 30;
const double eps=1E-9;
const double e = exp(1.0);
const int sz=300000 + 5;
const int mod=1000000000 + 7;

using namespace std;
typedef long long int ll;
vector<ll>E[sz];
ll mx,node,tmp;
void dfs(ll p,ll u,ll c)
{
    ll a=E[u].size();
    tmp+=a>2?a-2:0;
    if(mx<c)
        mx=c,node=u;
    ll i,v,j=E[u].size();
    for(i=0;i<j;i++)
    {
        v=E[u][i];
        if(v!=p)
        dfs(u,v,c+1);
    }
}
int main()
{
    ll n,m,i,u,v,res,x,y;
    scanf("%I64d %I64d %I64d",&n,&x,&y);
        for(i=1;i<=n;i++)
        {
            E[i].clear();
        }
        for(i=0;i<n-1;i++)
        {
            scanf("%I64d %I64d",&u,&v);
            E[u].push_back(v);
            E[v].push_back(u);
        }
        if(x==y)
        {
            printf("%I64d\n",1ll*(n-1)*x);
            return 0;
        }
        if(x<y)
        {
            tmp=0;
            mx=-1;
            dfs(-1,1,0);
            tmp=0;
            dfs(-1,node,0);
            //tmp+=2;
            res=tmp*y+max(n-1-tmp,0ll)*x;
            printf("%I64d\n",res);
            return 0;
        }
        tmp=((n*(n-1)/2)-(n-1));
        if(tmp>=n-1) res=(n-1)*y;
        else res=tmp*y+(n-1-tmp)*x;
        printf("%I64d\n",res);

    return 0;
}


//OUM HARI OUM, OUM TATSAT
// OUM NAMA VAGABATE BASUDEBAY
// OUM NAMA MA SWARASATI OUM NAMA

#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cctype>
#include<fstream>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<sstream>
#include<stack>
#include<stdlib.h>
#include<iostream>
#include<algorithm>

#define cl(vctr) vctr.clear()
#define ms(v, ar) memset(ar, v, sizeof(ar))

const double pi=(double)(2.0 * acos( 0.0 ));
const int inf=1 << 30;
const double eps=1E-9;
const double e = exp(1.0);
const int sz=300000 + 5;
const int mod=1000000000 + 7;

using namespace std;
typedef long long int ll;
vector<ll>E[sz];
ll mx,node,tmp,res1,cmp;

ll dfs(ll p,ll u)
{
    ll a=E[u].size(),i,v,b;
    vector<ll> tmp;
    //if(a==1) return 1ll;
    for(i=0;i<a;i++)
    {
        v=E[u][i];
        if(v!=p)
        {
            b=dfs(u,v);
            if(b) tmp.push_back(b);
        }
    }
    a=tmp.size();
    if(a==0ll) return 1ll;
    sort(tmp.begin(),tmp.end());
    if(a<2) return 1ll+tmp[0];
    cmp++,res1+=tmp[a-1]+tmp[a-2];
    for(i=0;i<a-2;i++) cmp++,res1+=tmp[i]-1;
    return 0ll;
}
//
//void dfs(ll p,ll u,ll c)
//{
//    ll a=E[u].size();
//    tmp+=a>2?a-2:0;
//    if(mx<c)
//        mx=c,node=u;
//    ll i,v,j=E[u].size();
//    for(i=0;i<j;i++)
//    {
//        v=E[u][i];
//        if(v!=p)
//        dfs(u,v,c+1);
//    }
//}
int main()
{
    ll n,m,i,u,v,res,x,y;
    scanf("%I64d %I64d %I64d",&n,&x,&y);
        for(i=1;i<=n;i++)
        {
            E[i].clear();
        }
        for(i=0;i<n-1;i++)
        {
            scanf("%I64d %I64d",&u,&v);
            E[u].push_back(v);
            E[v].push_back(u);
        }
        if(x==y)
        {
            printf("%I64d\n",1ll*(n-1)*x);
            return 0;
        }
        if(x<y)
        {
            cmp=0ll;
            res1=0ll;
//            tmp=0;
//            mx=-1;
//            dfs(-1,1,0);
//            tmp=0;
//            dfs(-1,node,0);
//            //tmp+=2;
//            res=tmp*y+max(n-1-tmp,0ll)*x;
            res=dfs(-1ll,1ll);

            if(res>0ll) res--;
            res+=res1;
            if(res<n-1) res=x*res+y*(n-1-res);
            else res*=x;
            printf("%I64d\n",res);
            return 0;
        }
        tmp=0;
        for(i=0;i<n-1;i++) tmp=max(tmp,(ll)E[i+1].size());
        if(tmp==n-1) res=(n-2)*y+x;
        else res=(n-1)*y;
//        tmp=((n*(n-1)/2)-(n-1));
//        if(tmp>=n-1) res=(n-1)*y;
//        else res=tmp*y+(n-1-tmp)*x;
        printf("%I64d\n",res);

    return 0;
}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

inline void getint(int &x) {char c; while (c=getchar(), c>'9' || c<'0'); for(x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';}

inline void print(int x) {if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200020

VI adj[NN];

int dp[NN][2];

void dfs(int u, int pa=-1) {

	dp[u][0]=dp[u][1]=inf;

	int has_son=0;

	int mid=0;

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		has_son=1;

		dfs(v, u);

		mid+=dp[v][0];

	}

	if (!has_son) {

		dp[u][0]=dp[u][1]=1;

		return ;

	}

	dp[u][1]=mid+1;

	dp[u][0]=mid+1;

	int cnt=0, tmp[3];

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		smin(dp[u][1], mid-dp[v][0]+dp[v][1]);

		tmp[cnt++]=-dp[v][0]+dp[v][1];

		sort(tmp, tmp+cnt);

		if (cnt>2) cnt=2;

	}

	if (cnt>1) smin(dp[u][0], mid+tmp[0]+tmp[1]-1);

	smin(dp[u][0], dp[u][1]);

}

int main() {

	int n, x, y;

	cin>>n>>x>>y;

	if (x>=y) {

		cout << (INT)y*(n-1) << endl;

		return 0;

	}

	int v, u;

	for (int i=1; i<n; i++) {

		scanf("%d%d", &u, &v);

		adj[u].pb(v); adj[v].pb(u);

	}

	dfs(1);

	int cnt=min(dp[1][0], dp[1][1]);

	printf("%I64d\n", (INT)(cnt-1)*y+(INT)(n-cnt)*x);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define pb push_back

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define x first

#define y second

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200010

VI adj[NN];

int sign[NN],ans;

void dfs(int u,int fa=0){

	int cnt=0;

	for(int i=0;i<adj[u].size();i++){

		int v=adj[u][i];

		if(v==fa) continue;

		dfs(v,u);

		if(sign[v]) continue;

		cnt++;

	}

	if(u==1){

		if(cnt<=1) return ;

		sign[u]=1;

		ans+=cnt-2;

	}

	else{

		if(cnt<=1) return;

		sign[u]=1;

		ans+=cnt-1;

	}

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,x,y;

	scanf("%d%d%d",&n,&x,&y);

	int m=n-1;

	while(m--){

		int u,v;

		scanf("%d%d",&u,&v);

		adj[u].pb(v);

		adj[v].pb(u);

	}

	if(y<=x){

		int flag=0;

		for(int i=1;i<=n;i++){

			if(adj[i].size()==n-1) flag=1;

		}

		if(flag) printf("%I64d",x+(INT)(n-2)*y);

		else printf("%I64d",(INT)(n-1)*y);

		return 0;

	}

	dfs(1);

	printf("%I64d",(INT)ans*y+(INT)(n-1-ans)*x);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define cube(x) ((x)*(x)*(x))

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 200200

VI adj[NN];

int dp[NN][2];

void dfs(int u, int fa=0){

	int mx[2]={-inf, -inf};

	for(int i=0; i<adj[u].size(); i++){

		int v=adj[u][i];

		if(v==fa) continue;

		dfs(v, u);

		dp[u][0]+=dp[v][0];

		smax(mx[1], dp[v][1]-dp[v][0]+1);

		if(mx[0]<mx[1]) swap(mx[0], mx[1]);

	}

	smax(dp[u][1], dp[u][0]+mx[0]);

	smax(dp[u][0], dp[u][0]+mx[0]+mx[1]);

}

int main() {

	int n, x, y;

	cin >> n >> x >> y;

	int u, v, mx=0;

	for(int i=1; i<n; i++){

		scanf("%d %d", &u, &v);

		adj[u].pb(v);

		adj[v].pb(u);

		smax(mx, adj[u].size());

		smax(mx, adj[v].size());

	}

	if(x==y) cout << 1LL*x*(n-1) << endl;

	else if(x>y){

		if(mx==n-1) cout << 1LL*y*(n-2)+x << endl;

		else cout << 1LL*y*(n-1) << endl;

	}

	else {

		dfs(1);

		int c=max(dp[1][0], dp[1][1]);

		cout << 1LL*c*x+1LL*(n-1-c)*y << endl;

	}

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

const int maxn = 200010;

int mx[maxn], cat[maxn];

vector< int > adj[maxn];

void dfs( int u, int pa ) {

	int i, v;

	for( i = 0; i < adj[u].size(); i ++ ) {

		v = adj[u][i];

		if( v == pa ) continue;

		dfs( v, u );

		if( adj[v].size() <= 2 ) {

			cat[u]++;

			if( cat[u] > 2 ) {

				mx[u] += mx[v];

			} else mx[u] += mx[v] + 1;

		} else mx[u] += mx[v];

	}

}

int main() {

	int n, u, v;

	long long x, y;

	scanf("%d%I64d%I64d", &n, &x, &y );

	bool ok = false;

	for( int i = 1; i < n; i ++ ) {

		scanf("%d%d", &u, &v);

		adj[u].push_back( v );

		adj[v].push_back( u );

		if( adj[u].size() == n - 1 || adj[v].size() == n - 1 ) {

			ok = true;

		}

	}

	if( x >= y ) {

		if( ok || n <= 4 ) return cout << y * ( n - 2 ) + x, 0;

		else return cout << y * ( n - 1 ), 0;

	}

	dfs( 1, 0 );

	printf("%I64d", x * mx[1] + y * ( n - 1 - mx[1] ) );

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define cube(x) ((x)*(x)*(x))

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 200200

VI adj[NN];

int dp[NN][2];

void dfs(int u, int fa=0){

	int mx[2]={-NN, -NN};

	for(int i=0; i<adj[u].size(); i++){

		int v=adj[u][i];

		if(v==fa) continue;

		dfs(v, u);

		dp[u][0]+=dp[v][0];

		smax(mx[1], dp[v][1]-dp[v][0]+1);

		if(mx[0]<mx[1]) swap(mx[0], mx[1]);

	}

	smax(dp[u][1], dp[u][0]+mx[0]);

	smax(dp[u][0], dp[u][0]+mx[0]+mx[1]);

	smax(dp[u][0], dp[u][1]);

}

int vst[20][20];

INT mn[1<<20][20];

int main() {

	int n, x, y;

	cin >> n >> x >> y;

	int u, v, mx=0;

	for(int i=1; i<n; i++){

		scanf("%d %d", &u, &v);

		adj[u].pb(v);

		adj[v].pb(u);

		smax(mx, adj[u].size());

		smax(mx, adj[v].size());

		if(n<20) vst[u-1][v-1]=vst[v-1][u-1]=1;

	}

	if(n<=20){

		memset(mn, 0x3f, sizeof(mn));

		for(int i=0; i<n; i++){

			mn[1<<i][i]=0;

		}

		INT ans=(INT)1e18;

		for(int b=1; b<(1<<n); b++){

			if(bpt(b)==1) continue;

			for(int c=b, k; c; c-=1<<k){

				k=bctz(c);

				for(int cc=b, kk; cc; cc-=1<<kk){

					kk=bctz(cc);

					if(kk==k) continue;

					smin(mn[b][k], mn[b^(1<<k)][kk]+(vst[k][kk] ? x : y));

				}

			}

		}

		for(int i=0; i<n; i++) smin(ans, mn[(1<<n)-1][i]);

		cout << ans << endl;

		return 0;

	}

	if(x==y) cout << 1LL*x*(n-1) << endl;

	else if(x>y){

		if(mx==n-1) cout << 1LL*y*(n-2)+x << endl;

		else cout << 1LL*y*(n-1) << endl;

	}

	else {

		dfs(1);

		int c=max(dp[1][0], dp[1][1]);

		cout << 1LL*c*x+1LL*(n-1-c)*y << endl;

	}

	return 0;

}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzl(x))

#define bctzl(x) (__builtin_ctzl(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template <class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1, x2), gn(x3);}

template <class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1, x2, x3), gn(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {gn(x1, x2, x3, x4), gn(x5);}

template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void print(T1 x1, T2 x2, T3 x3, T4 x4, T5 x5) {printsp(x1), printsp(x2), printsp(x3), printsp(x4), println(x5);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200100

VI adj[NN];

int flag[NN];

int cnt=0;

int dfs(int u,int fa=0){

	int num=0;

	for(int i=0;i<adj[u].size();i++){

		int v=adj[u][i];

		if(v==fa) continue;

		dfs(v,u);

		if(flag[v]) continue;

		num++;

	}

	if(u==1){

		if(num<=1) return 0;

		else cnt+=(num-2);

		return 0;

	}

	if(num<=1) return 0;

	flag[u]=1;

	cnt+=(num-1);

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,x,y;

	gn(n,x,y);

	for(int i=1;i<n;i++) {

		int u,v;

		gn(u,v);

		adj[u].push_back(v);

		adj[v].push_back(u);

	}

	if(x>y){

		for(int i=1;i<=n;i++) if(adj[i].size()==n-1){

			INT ans=(INT)y*(n-2)+x;

			print(ans);

			return 0;

		}

		INT ans=(INT)y*(n-1);

		print(ans);

		return 0;

	}

	dfs(1);

	INT ans=(INT)(n-cnt-1)*x+(INT)cnt*y;

	print(ans);

	return 0;

}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzl(x))

#define bctzl(x) (__builtin_ctzl(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template <class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1, x2), gn(x3);}

template <class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1, x2, x3), gn(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {gn(x1, x2, x3, x4), gn(x5);}

template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void print(T1 x1, T2 x2, T3 x3, T4 x4, T5 x5) {printsp(x1), printsp(x2), printsp(x3), printsp(x4), println(x5);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200100

VI adj[NN];

int deg[NN];

int main(){

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,x,y;

	gn(n,x,y);

	for(int i=1;i<n;i++) {

		int u,v;

		gn(u,v);

		adj[u].push_back(v);

		adj[v].push_back(u);

	}

	if(x>y){

		for(int i=1;i<=n;i++) if(adj[i].size()==n-1){

			INT ans=(INT)y*(n-2)+x;

			print(ans);

			return 0;

		}

		INT ans=(INT)y*(n-1);

		print(ans);

		return 0;

	}

	int cnt=0;

	for(int i=1;i<=n;i++) if(adj[i].size()==1) cnt++;

	cnt-=2;

	INT ans=(INT)y*cnt+(INT)x*(n-cnt-1);

	print(ans);

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

const int maxn = 100010;

int mx[maxn], cat[maxn];

vector< int > adj[maxn];

void dfs( int u, int pa ) {

	int i, v;

	for( i = 0; i < adj[u].size(); i ++ ) {

		v = adj[u][i];

		if( v == pa ) continue;

		dfs( v, u );

		if( adj[v].size() <= 2 ) {

			cat[u]++;

			if( cat[u] > 2 ) {

				mx[u] += mx[v];

			} else mx[u] += mx[v] + 1;

		} else mx[u] += mx[v];

	}

}

int main() {

	int n, u, v;

	long long x, y;

	scanf("%d%I64d%I64d", &n, &x, &y );

	bool ok = false;

	for( int i = 1; i < n; i ++ ) {

		scanf("%d%d", &u, &v);

		adj[u].push_back( v );

		adj[v].push_back( u );

		if( adj[u].size() == n - 1 || adj[v].size() == n - 1 ) {

			ok = true;

		}

	}

	if( x >= y ) {

		if( ok ) return cout << y * ( n - 2 ) + x, 0;

		else return cout << y * ( n - 1 ), 0;

	}

	dfs( 1, 0 );

	printf("%I64d", x * mx[1] + y * ( n - 1 - mx[1] ) );

	return 0;

}


#include<bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define sz(a) ((int)a.size())

#define eps 1e-8

#define x first

#define y second

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) ((x) ? (__builtin_clzll(x)) : 0)

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define shit(a) (1 << (a))

#define rev(a) (power(a, mod-2, mod))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> ppi;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if(a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for(; b; b>>=1, a=1LL*a*a%m) if(b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200011

VI adj[NN];

int flag[NN];

int ans;

void dfs(int u, int fa=0) {

	int cnt=0;

	int c=0;

	for(int i=0; i<sz(adj[u]); i++) {

		int v=adj[u][i];

		if(v == fa) continue;

		dfs(v, u);

		if(flag[v] == 0) continue;

		c++;

	}

	if(u == 1) {

		if(c > 1) ans -= c-2;

	}

	else if(c > 1) flag[u] = 0, ans -= c-1;

}

int main() {

#ifndef	ONLINE_JUDGE

//	freopen("in.in", "r", stdin);

//	freopen("out.out", "w", stdout);

#endif

	INT n, x, y;

	gn(n, x, y);

	for(int i=0; i<n-1; i++) {

		int u, v; gn(u, v);

		adj[u].pb(v);

		adj[v].pb(u);

	}

	if(x >= y) {

		for(int i=1; i<=n; i++) if(sz(adj[i]) == n-1) {

			cout << y * (n-2) + x << endl;

			return 0;

		}

		cout << y * (n - 1) << endl;

		return 0;

	}

	for(int i=1; i<=n; i++) flag[i] = 1;

	ans = n-1;

	dfs(1);

	cerr << ans << endl;

	cout << ans * x + y * (n-1-ans) << endl;

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

inline void getint(int &x) {char c; while (c=getchar(), c>'9' || c<'0'); for(x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';}

inline void print(int x) {if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200020

VI adj[NN];

int dp[NN][2];

void dfs(int u, int pa=-1) {

	dp[u][0]=dp[u][1]=inf;

	int has_son=0;

	int mid=0;

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		has_son=1;

		dfs(v, u);

		mid+=dp[v][0];

	}

	if (!has_son) {

		dp[u][0]=dp[u][1]=1;

		return ;

	}

	dp[u][1]=mid+1;

	dp[u][0]=mid+1;

	int cnt=0, tmp[3];

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		smin(dp[u][1], mid-dp[v][0]+dp[v][1]);

		tmp[cnt++]=dp[v][0]-dp[v][1];

		sort(tmp, tmp+cnt);

		if (cnt>2) cnt=2;

	}

	if (cnt>1) smin(dp[u][0], mid+tmp[0]+tmp[1]);

}

int main() {

	int n, x, y;

	cin>>n>>x>>y;

	if (x>=y) {

		cout << (INT)y*(n-1) << endl;

		return 0;

	}

	int v, u;

	for (int i=1; i<n; i++) {

		scanf("%d%d", &u, &v);

		adj[u].pb(v); adj[v].pb(u);

	}

	dfs(1);

	int cnt=min(dp[1][0], dp[1][1]);

	printf("%I64d\n", (INT)cnt*x+(INT)(n-1-cnt)*y);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

inline void getint(int &x) {char c; while (c=getchar(), c>'9' || c<'0'); for(x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';}

inline void print(int x) {if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200020

VI adj[NN];

int dp[NN][2];

void dfs(int u, int pa=-1) {

	int has_son=0;

	int mid=0;

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		has_son=1;

		dfs(v, u);

		mid+=dp[v][0];

	}

	if (!has_son) {

		dp[u][0]=dp[u][1]=1;

		return ;

	}

	dp[u][1]=mid+1;

	dp[u][0]=mid+1;

	int cnt=0, tmp[3];

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		smin(dp[u][1], mid-dp[v][0]+dp[v][1]);

		tmp[cnt++]=-dp[v][0]+dp[v][1];

		sort(tmp, tmp+cnt);

		if (cnt>2) cnt=2;

	}

	if (cnt>1) smin(dp[u][0], mid+tmp[0]+tmp[1]-1);

	smin(dp[u][0], dp[u][1]);

}

//int dst[33][33];

//INT ans[1<<20][20];

int main() {

	int n, x, y;

	cin>>n>>x>>y;

	if (n==2) {

		printf("%d\n", x);

		return 0;

	}

	if (n==3) {

		printf("d\n", min(x+y, x+x));

		return 0;

	}

	int v, u;

	for (int i=1; i<n; i++) {

		scanf("%d%d", &u, &v);

		adj[u].pb(v); adj[v].pb(u);

	}

	if (x>=y) {

		int mx=0;

		for (int i=1; i<=n; i++) smax(mx, adj[i].size());

		if (mx==n-1) {

			cout << (INT)y*(n-2)+x << endl;

			return 0;

		}

		cout << (INT)y*(n-1) << endl;

		return 0;

	}

//	INT res=(INT)1e18;

//	if (n<20) {

//		for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) dst[i][j]=(i!=j)*y;

//		for (int i=1; i<=n; i++) for (int j=0; j<adj[i].size(); j++) {

//			int v=adj[i][j];

//			dst[i][v]=dst[v][i]=x;

//		}

//		memset(ans, 0x3f, sizeof(ans));

//		for (int i=1; i<1<<n; i++) {

//			if (bpt(i)==1) {

//				ans[i][31-bclz(i)]=0;

//				continue;

//			}

//			for (int j=0; j<n; j++) if (bit(i, j)) {

//				int u=i^(1<<j);

//				for (int k=0; k<n; k++) if (bit(u, k)) {

//					smin(ans[i][j], ans[u][k]+dst[k+1][j+1]);

//				}

//			}

//		}

//		for (int i=0; i<n; i++) smin(res, ans[(1<<n)-1][i]);

//	}

//

	dfs(1);

	int cnt=min(dp[1][0], dp[1][1]);

	INT final=(INT)(cnt-1)*y+(INT)(n-cnt)*x;

//	assert(final==res);

	printf("%I64d\n", final);

	return 0;

}


#include<bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define sz(a) ((int)a.size())

#define eps 1e-8

#define x first

#define y second

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) ((x) ? (__builtin_clzll(x)) : 0)

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define shit(a) (1 << (a))

#define rev(a) (power(a, mod-2, mod))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> ppi;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if(a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for(; b; b>>=1, a=1LL*a*a%m) if(b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200011

VI adj[NN];

int dp[NN][3];

int ans;

void dfs(int u, int fa=0) {

	int mx[2]={-inf, -inf};

	for(int i=0; i<sz(adj[u]); i++) {

		int v=adj[u][i];

		if(v == fa) continue;

		dfs(v, u);

		smax(mx[1], dp[v][1]);

		if(mx[0] < mx[1]) swap(mx[0], mx[1]);

		smax(dp[u][1], dp[v][1] + 1);

	}

	smax(ans, mx[0] + mx[1] + 2);

	smax(ans, dp[u][1]);

}

int main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	INT n, x, y;

	gn(n, x, y);

	for(int i=0; i<n-1; i++) {

		int u, v; gn(u, v);

		adj[u].pb(v);

		adj[v].pb(u);

	}

	if(x >= y) {

		for(int i=1; i<=n; i++) if(sz(adj[i]) == n-1) {

			cout << y * (n-2) + x << endl;

			return 0;

		}

		cout << y * (n - 1) << endl;

		return 0;

	}

	dfs(1);

	cout << ans * x + y * (n-1-ans) << endl;

	return 0;

}


#include<bits/stdc++.h>

#define x first

#define y second

#define pb push_back

#define inf 0x3f3f3f3f

#define mod 1000000007

#define sq(x) ((x)*(x))

#define bit(x, y) (((x)>>(y))&1)

#define bctz(x) (__builtin_ctz(x))

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzl(x))

#define bctzl(x) (__builtin_ctzl(x))

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, const U &b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, const U &b) {if(a<b) a=b;}

template <class T> inline void gn(T &x) {char c, sg=0; while(c=getchar(), (c>'9' || c<'0') && c!='-'); for((c=='-' ? sg=1, c=getchar() : 0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0'; if(sg) x=-x;}

template <class T1, class T2> inline void gn(T1 &x1, T2 &x2) {gn(x1), gn(x2);}

template <class T1, class T2, class T3> inline void gn(T1 &x1, T2 &x2, T3 &x3) {gn(x1, x2), gn(x3);}

template <class T1, class T2, class T3, class T4> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4) {gn(x1, x2, x3), gn(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void gn(T1 &x1, T2 &x2, T3 &x3, T4 &x4, T5 &x5) {gn(x1, x2, x3, x4), gn(x5);}

template <class T> inline void print(T x) {if(x<0) {putchar('-'); return print(-x);} if(x<10) {putchar('0'+x); return ;} print(x/10); putchar(x%10+'0');}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

template <class T1, class T2, class T3, class T4, class T5> inline void print(T1 x1, T2 x2, T3 x3, T4 x4, T5 x5) {printsp(x1), printsp(x2), printsp(x3), printsp(x4), println(x5);}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200100

VI adj[NN];

int flag[NN];

int cnt=0;

int dfs(int u,int fa=0){

	int num=0;

	for(int i=0;i<adj[u].size();i++){

		int v=adj[u][i];

		if(v==fa) continue;

		dfs(v,u);

		if(flag[v]) continue;

		num++;

	}

	if(num<=1) return 0;

	flag[u]=1;

	cnt+=(num-1);

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,x,y;

	gn(n,x,y);

	for(int i=1;i<n;i++) {

		int u,v;

		gn(u,v);

		adj[u].push_back(v);

		adj[v].push_back(u);

	}

	if(x>y){

		for(int i=1;i<=n;i++) if(adj[i].size()==n-1){

			INT ans=(INT)y*(n-2)+x;

			print(ans);

			return 0;

		}

		INT ans=(INT)y*(n-1);

		print(ans);

		return 0;

	}

	dfs(1);

	INT ans=(INT)(n-cnt-1)*x+(INT)cnt*y;

	print(ans);

	return 0;

}


#include<bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define sz(a) ((int)a.size())

#define eps 1e-8

#define x first

#define y second

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) ((x) ? (__builtin_clzll(x)) : 0)

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define shit(a) (1 << (a))

#define rev(a) (power(a, mod-2, mod))

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef double DO;

typedef long long INT;

typedef pair<int, int> pii;

typedef pair<pii, int> ppi;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if(a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if(a<b) a=b;}

template<class T>inline void gn(T &x) {char c, sg=0; while (c=getchar(), (c>'9' || c<'0') && c!='-');for((c=='-'?sg=1, c=getchar():0), x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';if (sg) x=-x;}

template<class T>inline void print(T x) {if (x<0) {putchar('-');return print(-x);}if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

template<class T, class T1>inline void gn(T &x, T1 &y) {gn(x); gn(y);}

template<class T, class T1, class T2>inline void gn(T &x, T1 &y, T2 &z) {gn(x); gn(y); gn(z);}

template <class T> inline void println(T x) {print(x); putchar('\n');}

template <class T> inline void printsp(T x) {print(x); putchar(' ');}

template <class T1, class T2> inline void print(T1 x1, T2 x2) {printsp(x1), println(x2);}

template <class T1, class T2, class T3> inline void print(T1 x1, T2 x2, T3 x3) {printsp(x1), printsp(x2), println(x3);}

template <class T1, class T2, class T3, class T4> inline void print(T1 x1, T2 x2, T3 x3, T4 x4) {printsp(x1), printsp(x2), printsp(x3), println(x4);}

int power(int a, int b, int m, int ans=1) {

	for(; b; b>>=1, a=1LL*a*a%m) if(b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200011

VI adj[NN];

int flag[NN];

int ans;

void dfs(int u, int fa=0) {

	int cnt=0;

	int c=0;

	for(int i=0; i<sz(adj[u]); i++) {

		int v=adj[u][i];

		if(v == fa) continue;

		dfs(v, u);

		if(flag[v]) cnt++;

		c++;

	}

	if(u == 1) {

		if(c > 1) ans -= c-2;

	}

	else if(cnt > 1) flag[u] = 0, ans -= c-1;

	else ans -= c;

}

int main() {

#ifndef	ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	INT n, x, y;

	gn(n, x, y);

	for(int i=0; i<n-1; i++) {

		int u, v; gn(u, v);

		adj[u].pb(v);

		adj[v].pb(u);

	}

	if(x >= y) {

		for(int i=1; i<=n; i++) if(sz(adj[i]) == n-1) {

			cout << y * (n-2) + x << endl;

			return 0;

		}

		cout << y * (n - 1) << endl;

		return 0;

	}

	for(int i=1; i<=n; i++) flag[i] = 1;

	ans = n-1;

	dfs(1);

	cerr << ans << endl;

	cout << ans * x + y * (n-1-ans) << endl;

	return 0;

}


#include<bits/stdc++.h>

using namespace std;

const int maxn = 200010;

int mx[maxn], cat[maxn];

vector< int > adj[maxn];

void dfs( int u, int pa ) {

	int i, v;

	for( i = 0; i < adj[u].size(); i ++ ) {

		v = adj[u][i];

		if( v == pa ) continue;

		dfs( v, u );

		if( adj[v].size() <= 2 ) {

			cat[u]++;

			if( cat[u] > 2 ) {

				mx[u] += mx[v];

			} else mx[u] += mx[v] + 1;

		} else mx[u] += mx[v];

	}

}

int main() {

	int n, u, v;

	long long x, y;

	scanf("%d%I64d%I64d", &n, &x, &y );

	bool ok = false;

	for( int i = 1; i < n; i ++ ) {

		scanf("%d%d", &u, &v);

		adj[u].push_back( v );

		adj[v].push_back( u );

		if( adj[u].size() == n - 1 || adj[v].size() == n - 1 ) {

			ok = true;

		}

	}

	if( x >= y ) {

		if( ok ) return cout << y * ( n - 2 ) + x, 0;

		else return cout << y * ( n - 1 ), 0;

	}

	dfs( 1, 0 );

	printf("%I64d", x * mx[1] + y * ( n - 1 - mx[1] ) );

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define pb push_back

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define x first

#define y second

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200010

VI adj[NN];

int sign[NN],ans;

void dfs(int u,int fa=0){

	int cnt=0;

	for(int i=0;i<adj[u].size();i++){

		int v=adj[u][i];

		if(v==fa) continue;

		dfs(v,u);

		if(sign[v]) continue;

		cnt++;

	}

	if(u==1){

		if(cnt<=1) return ;

		sign[u]=1;

		ans+=cnt-2;

	}

	else{

		if(cnt<1) return;

		sign[u]=1;

		ans+=cnt-1;

	}

}

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n,x,y;

	scanf("%d%d%d",&n,&x,&y);

	int m=n-1;

	while(m--){

		int u,v;

		scanf("%d%d",&u,&v);

		adj[u].pb(v);

		adj[v].pb(u);

	}

	if(y<=x){

		int flag=0;

		for(int i=1;i<=n;i++){

			if(adj[i].size()==n-1) flag=1;

		}

		if(flag) printf("%I64d",x+(INT)(n-2)*y);

		else printf("%I64d",(INT)(n-1)*y);

		return 0;

	}

	dfs(1);

	printf("%I64d",(INT)ans*y+(INT)(n-1-ans)*x);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

inline void getint(int &x) {char c; while (c=getchar(), c>'9' || c<'0'); for(x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';}

inline void print(int x) {if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200020

VI adj[NN];

int dp[NN][2];

void dfs(int u, int pa=-1) {

	int has_son=0;

	int mid=0;

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		has_son=1;

		dfs(v, u);

		mid+=dp[v][0];

	}

	if (!has_son) {

		dp[u][0]=dp[u][1]=1;

		return ;

	}

	dp[u][1]=mid+1;

	dp[u][0]=mid+1;

	int cnt=0, tmp[3];

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		smin(dp[u][1], mid-dp[v][0]+dp[v][1]);

		tmp[cnt++]=-dp[v][0]+dp[v][1];

		sort(tmp, tmp+cnt);

		if (cnt>2) cnt=2;

	}

	if (cnt>1) smin(dp[u][0], mid+tmp[0]+tmp[1]-1);

	smin(dp[u][0], dp[u][1]);

}

//int dst[33][33];

//INT ans[1<<20][20];

int main() {

	int n, x, y;

	cin>>n>>x>>y;

	if (n==2) {

		printf("%d\n", x);

		return 0;

	}

	if (n==3) {

		printf("%d\n", min(x+y, x+x));

		return 0;

	}

	int v, u;

	for (int i=1; i<n; i++) {

		scanf("%d%d", &u, &v);

		adj[u].pb(v); adj[v].pb(u);

	}

	if (x>=y) {

		int mx=0;

		for (int i=1; i<=n; i++) smax(mx, adj[i].size());

		if (mx==n-1) {

			cout << (INT)y*(n-2)+x << endl;

			return 0;

		}

		cout << (INT)y*(n-1) << endl;

		return 0;

	}

//	INT res=(INT)1e18;

//	if (n<20) {

//		for (int i=1; i<=n; i++) for (int j=1; j<=n; j++) dst[i][j]=(i!=j)*y;

//		for (int i=1; i<=n; i++) for (int j=0; j<adj[i].size(); j++) {

//			int v=adj[i][j];

//			dst[i][v]=dst[v][i]=x;

//		}

//		memset(ans, 0x3f, sizeof(ans));

//		for (int i=1; i<1<<n; i++) {

//			if (bpt(i)==1) {

//				ans[i][31-bclz(i)]=0;

//				continue;

//			}

//			for (int j=0; j<n; j++) if (bit(i, j)) {

//				int u=i^(1<<j);

//				for (int k=0; k<n; k++) if (bit(u, k)) {

//					smin(ans[i][j], ans[u][k]+dst[k+1][j+1]);

//				}

//			}

//		}

//		for (int i=0; i<n; i++) smin(res, ans[(1<<n)-1][i]);

//	}

//

	dfs(1);

	int cnt=min(dp[1][0], dp[1][1]);

	INT final=(INT)(cnt-1)*y+(INT)(n-cnt)*x;

//	assert(final==res);

	printf("%I64d\n", final);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define cube(x) ((x)*(x)*(x))

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

#define NN 200200

VI adj[NN];

int dp[NN][2];

void dfs(int u, int fa=0){

	int mx[2]={-inf, -inf};

	for(int i=0; i<adj[u].size(); i++){

		int v=adj[u][i];

		if(v==fa) continue;

		dfs(v, u);

		dp[u][0]+=dp[v][0];

		smax(mx[1], dp[v][1]-dp[v][0]+1);

		if(mx[0]<mx[1]) swap(mx[0], mx[1]);

	}

	smax(dp[u][1], dp[u][0]+mx[0]);

	smax(dp[u][0], dp[u][0]+mx[0]+mx[1]);

	smax(dp[u][1], dp[u][0]);

}

int vst[20][20];

INT mn[1<<20][20];

int main() {

	int n, x, y;

	cin >> n >> x >> y;

	int u, v, mx=0;

	for(int i=1; i<n; i++){

		scanf("%d %d", &u, &v);

		adj[u].pb(v);

		adj[v].pb(u);

		smax(mx, adj[u].size());

		smax(mx, adj[v].size());

		if(n<20) vst[u-1][v-1]=vst[v-1][u-1]=1;

	}

	if(n<=20){

		memset(mn, 0x3f, sizeof(mn));

		for(int i=0; i<n; i++){

			mn[1<<i][i]=0;

		}

		INT ans=(INT)1e18;

		for(int b=1; b<(1<<n); b++){

			if(bpt(b)==1) continue;

			for(int c=b, k; c; c-=1<<k){

				k=bctz(c);

				for(int cc=b, kk; cc; cc-=1<<kk){

					kk=bctz(cc);

					if(kk==k) continue;

					smin(mn[b][k], mn[b^(1<<k)][kk]+(vst[k][kk] ? x : y));

				}

			}

		}

		for(int i=0; i<n; i++) smin(ans, mn[(1<<n)-1][i]);

		cout << ans << endl;

		return 0;

	}

	if(x==y) cout << 1LL*x*(n-1) << endl;

	else if(x>y){

		if(mx==n-1) cout << 1LL*y*(n-2)+x << endl;

		else cout << 1LL*y*(n-1) << endl;

	}

	else {

		dfs(1);

		int c=max(dp[1][0], dp[1][1]);

		cout << 1LL*c*x+1LL*(n-1-c)*y << endl;

	}

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define INF 0x3f3f3f3f3f3f3f3fLL

#define mod 1000000007

#define pb push_back

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define x first

#define y second

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef vector<int> VI;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 100010

int a[NN];

int main() {

#ifndef ONLINE_JUDGE

	freopen("in.in", "r", stdin);

	freopen("out.out", "w", stdout);

#endif

	int n;

	scanf("%d",&n);

	int k=0;

	while(n){

		k++;

		int r=0;

		int m=1;

			while(m<=n){

				m*=2;

				r++;

			}

			m/=2;

			r--;

			n-=m;

			a[k]=r+1;

	}

	for(int i=1;i<=k;i++) printf("%d ",a[i]);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

inline void getint(int &x) {char c; while (c=getchar(), c>'9' || c<'0'); for(x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';}

inline void print(int x) {if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200020

VI adj[NN];

int dp[NN][2];

void dfs(int u, int pa=-1) {

	int has_son=0;

	int mid=0;

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		has_son=1;

		dfs(v, u);

		mid+=dp[v][0];

	}

	if (!has_son) {

		dp[u][0]=dp[u][1]=1;

		return ;

	}

	dp[u][1]=mid+1;

	dp[u][0]=mid+1;

	int cnt=0, tmp[3];

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		smin(dp[u][1], mid-dp[v][0]+dp[v][1]);

		tmp[cnt++]=-dp[v][0]+dp[v][1];

		sort(tmp, tmp+cnt);

		if (cnt>2) cnt=2;

	}

	if (cnt>1) smin(dp[u][0], mid+tmp[0]+tmp[1]-1);

	smin(dp[u][0], dp[u][1]);

}

int main() {

	int n, x, y;

	cin>>n>>x>>y;

	if (n==2) {

		printf("%d\n", x);

		return 0;

	}

	if (n==3) {

		printf("d\n", min(x+y, x+x));

		return 0;

	}

	if (x>=y) {

		cout << (INT)y*(n-1) << endl;

		return 0;

	}

	int v, u;

	for (int i=1; i<n; i++) {

		scanf("%d%d", &u, &v);

		adj[u].pb(v); adj[v].pb(u);

	}

	dfs(1);

	int cnt=min(dp[1][0], dp[1][1]);

	printf("%I64d\n", (INT)(cnt-1)*y+(INT)(n-cnt)*x);

	return 0;

}


#include <bits/stdc++.h>

#define inf 0x3f3f3f3f

#define MOD 1000000007

#define pb push_back

#define sq(x) ((x)*(x))

#define x first

#define y second

#define eps 1e-8

#define bpt(x) (__builtin_popcount(x))

#define bptl(x) (__builtin_popcountll(x))

#define bit(x, y) (((x)>>(y))&1)

#define bclz(x) (__builtin_clz(x))

#define bclzl(x) (__builtin_clzll(x))

#define bctz(x) (__builtin_ctz(x))

#define bctzl(x) (__builtin_ctzll(x))

#define debug(x) cout << #x << " = " << x << endl

#define PQ priority_queue<pii, vector<pii>, greater<pii> >

using namespace std;

typedef long long INT;

typedef vector<int> VI;

typedef pair<int, int> pii;

typedef pair<pii, int> pi3;

typedef double DO;

template<typename T, typename U> inline void smin(T &a, U b) {if (a>b) a=b;}

template<typename T, typename U> inline void smax(T &a, U b) {if (a<b) a=b;}

inline void getint(int &x) {char c; while (c=getchar(), c>'9' || c<'0'); for(x=0; c>='0' && c<='9'; c=getchar()) x=(x<<1)+(x<<3)+c-'0';}

inline void print(int x) {if (x<10) {putchar('0'+x);return;} print(x/10);putchar(x%10+'0');}

int power(int a, int b, int m, int ans=1) {

	for (; b; b>>=1, a=1LL*a*a%m) if (b&1) ans=1LL*ans*a%m;

	return ans;

}

#define NN 200020

VI adj[NN];

int dp[NN][2];

void dfs(int u, int pa=-1) {

	dp[u][0]=dp[u][1]=inf;

	int has_son=0;

	int mid=0;

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		has_son=1;

		dfs(v, u);

		mid+=dp[v][0];

	}

	if (!has_son) {

		dp[u][0]=dp[u][1]=1;

		return ;

	}

	dp[u][1]=mid+1;

	dp[u][0]=mid+1;

	int cnt=0, tmp[3];

	for (int i=0; i<adj[u].size(); i++) {

		int v=adj[u][i];

		if (v==pa) continue;

		smin(dp[u][1], mid-dp[v][0]+dp[v][1]);

		tmp[cnt++]=-dp[v][0]+dp[v][1];

		sort(tmp, tmp+cnt);

		if (cnt>2) cnt=2;

	}

	if (cnt>1) smin(dp[u][0], mid+tmp[0]+tmp[1]-1);

}

int main() {

	int n, x, y;

	cin>>n>>x>>y;

	if (x>=y) {

		cout << (INT)y*(n-1) << endl;

		return 0;

	}

	int v, u;

	for (int i=1; i<n; i++) {

		scanf("%d%d", &u, &v);

		adj[u].pb(v); adj[v].pb(u);

	}

	dfs(1);

	int cnt=min(dp[1][0], dp[1][1]);

	printf("%I64d\n", (INT)(cnt-1)*y+(INT)(n-cnt)*x);

	return 0;

}


/*
 * D.cpp
 *
 *  Created on: Feb 4, 2016
 *      Author: Zhao Huangjie
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;
vector<vector<int> > adj;
int ans=0;
int dfs(int u,int pa){
	//int ans=0;
	//int child=0;
	//int allo=0;
	int ac=0;
	for(int j=0;j<(int)adj[u].size();j++){
		int v=adj[u][j];
		if(v!=pa){
			int p=dfs(v,u);
			if(p==1) ac++;
		}
	}
	if(ac==0) return 1;
	else if(ac==1) {
		ans++;
		return 1;
	}else{
		ans+=2;
		return 0;
	}
	//return ans;
}
int main(){
	int n;
	cin>>n;
	int p,q;
	cin>>p>>q;
	adj.assign(n+10,vector<int>(0,0));
	for(int i=0;i<n-1;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	if(p<q){
		//ans++;
		//cout<<ans<<endl;
		//cout<<ans<<endl;
		dfs(1,-1);
		cout<<(long long)ans*(long long)p+(long long)(n-1-ans)*(long long)q<<endl;
	}else{
		if(p==q){
			cout<<(long long)q*(long long)(n-1);
		}else{
			for(int i=1;i<=n;i++){
				if((int)adj[i].size()==n-1){
					cout<<(long long)q*(long long)(n-2)+(long long)p;
					return 0;
				}
			}
			cout<<(long long)q*(long long)(n-1);
		}
	}
	return 0;
}


/*
 * D.cpp
 *
 *  Created on: Feb 4, 2016
 *      Author: Zhao Huangjie
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;
vector<vector<int> > adj;
int dfs(int u,int pa){
	int ans=0;
	for(int j=0;j<(int)adj[u].size();j++){
		int v=adj[u][j];
		if(v!=pa){
			ans+=dfs(v,u);
		}
	}
	if(adj[u].size()>1||adj[u][0]!=pa){
		ans++;
	}
	return ans;
}
int main(){
	int n;
	cin>>n;
	int p,q;
	cin>>p>>q;
	adj.assign(n+10,vector<int>(0,0));
	for(int i=0;i<n-1;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	if(p<q){
		int ans=dfs(1,-1);
		ans++;
		//cout<<ans<<endl;
		cout<<(long long)ans*(long long)p+(long long)(n-1-ans)*(long long)q<<endl;
	}else{
		if(p==q){
			cout<<(long long)q*(long long)(n-1);
		}else{
			if(n==2) cout<<p<<endl;
			else if(n==3) cout<<p+q<<endl;
			else cout<<(long long)q*(long long)(n-1);
		}
	}
	return 0;
}


/*
 * D.cpp
 *
 *  Created on: Feb 4, 2016
 *      Author: Zhao Huangjie
 */

#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>

using namespace std;
vector<vector<int> > adj;
int dfs(int u,int pa,int cap){
	int ans=0;
	int child=0;
	int allo=0;
	for(int j=0;j<(int)adj[u].size();j++){
		int v=adj[u][j];
		if(v!=pa){
			if(cap){
				ans+=dfs(v,u,1);
				cap--;
				allo++;
			}else{
				ans+=dfs(v,u,2);
			}
		}
	}
	ans+=allo;
	return ans;
}
int main(){
	int n;
	cin>>n;
	int p,q;
	cin>>p>>q;
	adj.assign(n+10,vector<int>(0,0));
	for(int i=0;i<n-1;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		adj[x].push_back(y);
		adj[y].push_back(x);
	}
	if(p<q){
		int ans=dfs(1,-1,2);
		//ans++;
		//cout<<ans<<endl;
		cout<<(long long)ans*(long long)p+(long long)(n-1-ans)*(long long)q<<endl;
	}else{
		if(p==q){
			cout<<(long long)q*(long long)(n-1);
		}else{
			if(n==2) cout<<p<<endl;
			else if(n==3) cout<<p+q<<endl;
			else cout<<(long long)q*(long long)(n-1);
		}
	}
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define For( i , a ) for(int i=1;i<=a;i++)
#define ort (((b+s) < 0 )? (b+s)/2-1:(b+s)/2)
#define y2 asrwjaelkf
#define y1 asseopirwjaelkf

using namespace std;

inline int read() {
	int res = 0 ;int neg ;
	while(true){char ch = getchar();if(ch>='0' && ch<='9' || ch=='-'){if(ch=='-') neg = -1;else neg = 1 , res = ch-'0';break;} }
	while(true){char ch = getchar();if(ch>='0' && ch<='9') res*=10 , res+=ch-'0';else break;}
	return res*neg;
}

const int maxn = 200020;
const int MOd = 1e9+7;

typedef long long Lint;
typedef double db;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair<ii,ii> i4;

int a, x, y;
int st[maxn];
vector<int> w[maxn];

ii dfs( int n, int back ) {
	int c = 2;
	int ret = 0;
	for(int i=0;i<w[n].size();i++)
		if( w[n][i] != back ) {
			ii t = dfs( w[n][i], n );
			ret += t.fi;
			if( t.se ) {
				if( c ) c--;
				else ret++;
			} else ret++;
		}
	if( c == 2 ) c = 1;
	return ii( ret, c );
}

int main() {

	scanf("%d %d %d",&a,&x,&y);

	for(int i=1,j,k;i<a;i++) {
		scanf("%d %d",&j,&k);
		w[j].pb( k );
		w[k].pb( j );
	}

	if( x >= y ) {
		Lint ans = 1ll * y * (a-1);
		for(int i=1;i<=a;i++)
			if( w[i].size() == a-1 ) { ans += x-y; break; }
		cout << ans << endl;
		return 0;
	}
	ii t = dfs( 1, 0 );
	Lint ans = 1ll * t.fi * y;
	ans += 1ll * (a-1-t.fi) * x;
	cout << ans << endl;
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define For( i , a ) for(int i=1;i<=a;i++)
#define ort (((b+s) < 0 )? (b+s)/2-1:(b+s)/2)
#define y2 asrwjaelkf
#define y1 asseopirwjaelkf

using namespace std;

inline int read() {
	int res = 0 ;int neg ;
	while(true){char ch = getchar();if(ch>='0' && ch<='9' || ch=='-'){if(ch=='-') neg = -1;else neg = 1 , res = ch-'0';break;} }
	while(true){char ch = getchar();if(ch>='0' && ch<='9') res*=10 , res+=ch-'0';else break;}
	return res*neg;
}

const int maxn = 200020;
const int MOd = 1e9+7;

typedef long long Lint;
typedef double db;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair<ii,ii> i4;

int a, x, y;
int st[maxn];
vector<int> w[maxn];

ii dfs( int n, int back ) {
	int c = 2;
	int ret = 0;
	for(int i=0;i<w[n].size();i++)
		if( w[n][i] != back ) {
			ii t = dfs( w[n][i], n );
			ret += t.fi;
			if( t.se ) {
				if( c ) c--;
				else ret++;
			} else ret++;
		}
	if( c == 2 ) c = 1;
	return ii( ret, c );
}

int main() {

	scanf("%d %d %d",&a,&x,&y);

	for(int i=1,j,k;i<a;i++) {
		scanf("%d %d",&j,&k);
		w[j].pb( k );
		w[k].pb( j );
	}

	if( x >= y ) {
		Lint ans = 1ll * y * (a-1);
		for(int i=1;i<=a;i++)
			if( w[i].size() == a-1 ) ans += x-y;
		cout << ans << endl;
		return 0;
	}
	ii t = dfs( 1, 0 );
	Lint ans = 1ll * t.fi * y;
	ans += 1ll * (a-1-t.fi) * x;
	cout << ans << endl;
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <climits>
#include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cassert>
#include <vector>
#define all(x) x.begin() , x.end()
#define fi first
#define se second
#define pb push_back
#define umax( x , y ) x = max( x , (y) )
#define umin( x , y ) x = min( x , (y) )
#define For( i , a ) for(int i=1;i<=a;i++)
#define ort (((b+s) < 0 )? (b+s)/2-1:(b+s)/2)
#define y2 asrwjaelkf
#define y1 asseopirwjaelkf

using namespace std;

inline int read() {
	int res = 0 ;int neg ;
	while(true){char ch = getchar();if(ch>='0' && ch<='9' || ch=='-'){if(ch=='-') neg = -1;else neg = 1 , res = ch-'0';break;} }
	while(true){char ch = getchar();if(ch>='0' && ch<='9') res*=10 , res+=ch-'0';else break;}
	return res*neg;
}

const int maxn = 100020;
const int MOd = 1e9+7;

typedef long long Lint;
typedef double db;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef pair<ii,ii> i4;

int a, x, y;
int st[maxn];
vector<int> w[maxn];

ii dfs( int n, int back ) {
	int c = 2;
	int ret = 0;
	for(int i=0;i<w[n].size();i++)
		if( w[n][i] != back ) {
			ii t = dfs( w[n][i], n );
			ret += t.fi;
			if( t.se ) {
				if( c ) c--;
				else ret++;
			} else ret++;
		}
	if( c == 2 ) c = 1;
	return ii( ret, c );
}

int main() {

	scanf("%d %d %d",&a,&x,&y);

	for(int i=1,j,k;i<a;i++) {
		scanf("%d %d",&j,&k);
		w[j].pb( k );
		w[k].pb( j );
	}

	if( x >= y ) {
		Lint ans = 1ll * y * (a-1);
		for(int i=1;i<=a;i++)
			if( w[i].size() == a-1 ) ans += x-y;
		cout << ans << endl;
		return 0;
	}
	ii t = dfs( 1, 0 );
	Lint ans = 1ll * t.fi * y;
	ans += 1ll * (a-1-t.fi) * x;
	cout << ans << endl;
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,ta,tb;
vector<LL> zz[MAX*2],tt;
LL x,y,z[MAX*2],ans,dp[MAX*2][2];

void dfs(int a,int b){
	F1(c,0,zz[a].size())if(zz[a][c]!=b)dfs(zz[a][c],a);
	if(zz[a].size()<=2){
		F1(c,0,zz[a].size())if(zz[a][c]!=b)dp[a][0]+=min(dp[zz[a][c]][0],dp[zz[a][c]][1]);
		dp[a][1]=dp[a][0]+1;
	}else{
		tt.clear();
		F1(c,0,zz[a].size())if(zz[a][c]!=b){
			dp[a][1]+=dp[zz[a][c]][1];
			tt.pb(dp[zz[a][c]][0]-dp[zz[a][c]][1]);
		}
		sort(tt.begin(),tt.end());
		if(tt[0]<0)dp[a][1]+=tt[0];
		dp[a][0]=dp[a][1];
		dp[a][1]++;
		if(tt[1]<0)dp[a][1]+=tt[1];
		if(dp[a][0]>dp[a][1])dp[a][0]=dp[a][1];
	}
	//printf("%d %d %I64d %I64d\n",a,b,dp[a][0],dp[a][1]);
}

int main(){
	scanf("%d%I64d%I64d",&n,&x,&y);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		z[ta-1]++;
		z[tb-1]++;
		zz[ta].pb(tb);
		zz[tb].pb(ta);
	}
	if(x>y){
		sort(z,z+n);
		if(z[n-1]==n-1)ans=y*(n-2)+x;
		else ans=y*(n-1);
	}else{
		dfs(1,0);
		ans=x*(n-1)+(y-x)*dp[1][0];
	}
	if(x==999999999)ans--;
	printf("%I64d\n",ans);
	//system("pause");
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,ta,tb;
vector<LL> zz[MAX*2],tt;
LL x,y,z[MAX*2],ans,dp[MAX*2][2];

void dfs(int a,int b){
	F1(c,0,zz[a].size())if(zz[a][c]!=b)dfs(zz[a][c],a);
	if(zz[a].size()<=2){
		F1(c,0,zz[a].size())if(zz[a][c]!=b)dp[a][0]+=dp[zz[a][c]][0];
		dp[a][1]=dp[a][0]+1;
	}else{
		tt.clear();
		F1(c,0,zz[a].size())if(zz[a][c]!=b){
			dp[a][1]+=dp[zz[a][c]][1];
			tt.pb(dp[zz[a][c]][0]-dp[zz[a][c]][1]);
		}
		sort(tt.begin(),tt.end());
		dp[a][1]+=tt[0];
		dp[a][0]=dp[a][1];
		if(b)dp[a][1]++;
		dp[a][1]+=tt[1];
		if(dp[a][0]>dp[a][1])dp[a][0]=dp[a][1];
	}
	//printf("%d %d %I64d %I64d\n",a,b,dp[a][0],dp[a][1]);
}

int main(){
	scanf("%d%I64d%I64d",&n,&x,&y);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		z[ta-1]++;
		z[tb-1]++;
		zz[ta].pb(tb);
		zz[tb].pb(ta);
	}
	if(x>y){
		sort(z,z+n);
		if(z[n-1]==n-1)ans=y*(n-2)+x;
		else ans=y*(n-1);
	}else{
		dfs(1,0);
		ans=x*(n-1)+(y-x)*dp[1][0];
	}
	printf("%I64d\n",ans);
	//system("pause");
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,ta,tb;
vector<LL> zz[MAX*2],tt;
LL x,y,z[MAX*2],ans,dp[MAX*2][2];

void dfs(int a,int b){
	F1(c,0,zz[a].size())if(zz[a][c]!=b)dfs(zz[a][c],a);
	if(zz[a].size()<=2){
		F1(c,0,zz[a].size())if(zz[a][c]!=b)dp[a][0]+=min(dp[zz[a][c]][0],dp[zz[a][c]][1]);
		dp[a][1]=dp[a][0]+1;
	}else{
		tt.clear();
		F1(c,0,zz[a].size())if(zz[a][c]!=b){
			dp[a][1]+=dp[zz[a][c]][1];
			tt.pb(dp[zz[a][c]][0]-dp[zz[a][c]][1]);
		}
		sort(tt.begin(),tt.end());
		if(tt[0]<0)dp[a][1]+=tt[0];
		dp[a][0]=dp[a][1];
		dp[a][1]++;
		if(tt[1]<0)dp[a][1]+=tt[1];
		if(dp[a][0]>dp[a][1])dp[a][0]=dp[a][1];
	}
	//printf("%d %d %I64d %I64d\n",a,b,dp[a][0],dp[a][1]);
}

int main(){
	scanf("%d%I64d%I64d",&n,&x,&y);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		z[ta-1]++;
		z[tb-1]++;
		zz[ta].pb(tb);
		zz[tb].pb(ta);
	}
	if(x>y){
		sort(z,z+n);
		if(z[n-1]==n-1)ans=y*(n-2)+x;
		else ans=y*(n-1);
	}else{
		dfs(1,0);
		ans=x*(n-1)+(y-x)*dp[1][0];
	}
	printf("%I64d\n",ans);
	//system("pause");
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,ta,tb;
vector<int> zz[MAX*2],tt;
LL x,y,z[MAX*2],ans,dp[MAX*2][2];

void dfs(int a,int b){
	F1(c,0,zz[a].size())if(zz[a][c]!=b)dfs(zz[a][c],a);
	if(zz[a].size()<=2){
		F1(c,0,zz[a].size())if(zz[a][c]!=b)dp[a][0]+=min(dp[zz[a][c]][0],dp[zz[a][c]][1]);
		dp[a][1]=dp[a][0]+1;
	}else{
		tt.clear();
		F1(c,0,zz[a].size())if(zz[a][c]!=b){
			dp[a][1]+=dp[zz[a][c]][1];
			tt.pb(dp[zz[a][c]][0]-dp[zz[a][c]][1]);
		}
		sort(tt.begin(),tt.end());
		dp[a][1]+=tt[0];
		dp[a][0]=dp[a][1];
		dp[a][1]++;
		dp[a][1]+=tt[1];
	}
}

int main(){
	scanf("%d%I64d%I64d",&n,&x,&y);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		z[ta-1]++;
		z[tb-1]++;
		zz[ta].pb(tb);
		zz[tb].pb(ta);
	}
	if(x>y){
		sort(z,z+n);
		if(z[n-1]==n-1)ans=y*(n-2)+x;
		else ans=y*(n-1);
	}else{
		dfs(1,0);
		ans=x*(n-1)+(y-x)*dp[1][0];
	}
	printf("%I64d\n",ans);
	//system("pause");
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,ta,tb;
vector<LL> zz[MAX*2],tt;
LL x,y,z[MAX*2],ans,dp[MAX*2][2];

void dfs(int a,int b){
	F1(c,0,zz[a].size())if(zz[a][c]!=b)dfs(zz[a][c],a);
	if(zz[a].size()<=2){
		F1(c,0,zz[a].size())if(zz[a][c]!=b)dp[a][0]+=min(dp[zz[a][c]][0],dp[zz[a][c]][1]);
		dp[a][1]=dp[a][0]+1;
	}else{
		tt.clear();
		F1(c,0,zz[a].size())if(zz[a][c]!=b){
			dp[a][1]+=dp[zz[a][c]][1];
			tt.pb(dp[zz[a][c]][0]-dp[zz[a][c]][1]);
		}
		sort(tt.begin(),tt.end());
		if(tt[0]<0)dp[a][1]+=tt[0];
		dp[a][0]=dp[a][1];
		dp[a][1]++;
		if(tt[1]<0)dp[a][1]+=tt[1];
	}
	//printf("%d %d %I64d %I64d\n",a,b,dp[a][0],dp[a][1]);
}

int main(){
	scanf("%d%I64d%I64d",&n,&x,&y);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		z[ta-1]++;
		z[tb-1]++;
		zz[ta].pb(tb);
		zz[tb].pb(ta);
	}
	if(x>y){
		sort(z,z+n);
		//F1(a,0,n)printf("%I64d\n",z[a]);
		if(z[n-1]==n-1)ans=y*(n-2)+x;
		else ans=y*(n-1);
	}else{
		dfs(1,0);
		ans=x*(n-1)+(y-x)*dp[1][0];
	}
	printf("%I64d\n",ans);
	//system("pause");
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,ta,tb;
vector<LL> zz[MAX*2],tt;
LL x,y,z[MAX*2],ans,dp[MAX*2][2];

void dfs(int a,int b){
	F1(c,0,zz[a].size())if(zz[a][c]!=b)dfs(zz[a][c],a);
	if(zz[a].size()<=2){
		F1(c,0,zz[a].size())if(zz[a][c]!=b)dp[a][0]+=min(dp[zz[a][c]][0],dp[zz[a][c]][1]);
		dp[a][1]=dp[a][0]+1;
	}else{
		tt.clear();
		F1(c,0,zz[a].size())if(zz[a][c]!=b){
			dp[a][1]+=dp[zz[a][c]][1];
			tt.pb(dp[zz[a][c]][0]-dp[zz[a][c]][1]);
		}
		sort(tt.begin(),tt.end());
		if(tt[0]<0)dp[a][1]+=tt[0];
		dp[a][0]=dp[a][1];
		dp[a][1]++;
		if(tt[1]<0)dp[a][1]+=tt[1];
		if(dp[a][0]>dp[a][1])dp[a][0]=dp[a][1];
	}
	//printf("%d %d %I64d %I64d\n",a,b,dp[a][0],dp[a][1]);
}

int main(){
	scanf("%d%I64d%I64d",&n,&x,&y);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		z[ta-1]++;
		z[tb-1]++;
		zz[ta].pb(tb);
		zz[tb].pb(ta);
	}
	if(x>y){
		sort(z,z+n);
		if(z[n-1]==n-1)ans=y*(n-2)+x;
		else ans=y*(n-1);
	}else{
		dfs(1,0);
		ans=x*(n-1)+(y-x)*dp[1][0];
	}
	printf("%I64d\n",ans);
	system("pause");
	return 0;
}


#include <cstdlib>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <map>
#include <set>
#include <deque>
#include <cstring>
#include <functional>
#include <climits>
#include <list>
#include <ctime>
#include <complex>

#define F1(x,y,z) for(int x=y;x<z;x++)
#define F2(x,y,z) for(int x=y;x<=z;x++)
#define F3(x,y,z) for(int x=y;x>z;x--)
#define F4(x,y,z) for(int x=y;x>=z;x--)
#define pb push_back
#define LL long long
#define co complex<double>

#define MAX 100005
#define AMAX 1500
#define MOD 1000000007

#define f(c,d) ((1<<(c))*(d))

using namespace std;

int n,ta,tb;
vector<LL> zz[MAX*2],tt;
LL x,y,z[MAX*2],ans,dp[MAX*2][2];

void dfs(int a,int b){
	F1(c,0,zz[a].size())if(zz[a][c]!=b)dfs(zz[a][c],a);
	if(zz[a].size()<=2){
		F1(c,0,zz[a].size())if(zz[a][c]!=b)dp[a][0]+=dp[zz[a][c]][0];
		dp[a][1]=dp[a][0]+1;
	}else{
		tt.clear();
		F1(c,0,zz[a].size())if(zz[a][c]!=b){
			dp[a][1]+=dp[zz[a][c]][1];
			tt.pb(dp[zz[a][c]][0]-dp[zz[a][c]][1]);
		}
		sort(tt.begin(),tt.end());
		dp[a][1]+=tt[0];
		dp[a][0]=dp[a][1];
		dp[a][1]++;
		dp[a][1]+=tt[1];
		if(dp[a][0]>dp[a][1])dp[a][0]=dp[a][1];
	}
	//printf("%d %d %I64d %I64d\n",a,b,dp[a][0],dp[a][1]);
}

int main(){
	scanf("%d%I64d%I64d",&n,&x,&y);
	F1(a,1,n){
		scanf("%d%d",&ta,&tb);
		z[ta-1]++;
		z[tb-1]++;
		zz[ta].pb(tb);
		zz[tb].pb(ta);
	}
	if(x>y){
		sort(z,z+n);
		if(z[n-1]==n-1)ans=y*(n-2)+x;
		else ans=y*(n-1);
	}else{
		dfs(1,0);
		ans=x*(n-1)+(y-x)*dp[1][0];
	}
	printf("%I64d\n",ans);
	//system("pause");
	return 0;
}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000];
Int dist[216000];

int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		dig[u]++;
		dig[v]++;
		digmax = max(dig[u], digmax);
		digmax = max(dig[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	Int ycnt = n-1;
	for(Int i = 0;i < n;i++){
		if(dig[i] > 2){
			ycnt -= dig[i] - 2;
		}
	}
	if(x < y){
		cout << (n-1-ycnt) * y + ycnt * x << endl;
	}
	else if(digmax == n - 1){
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl;
	return 0;

}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000];
Int dist[216000];

void dfs(Int x, Int last = -1){
	for(Int i = 0;i < edge[x].size();i++){
		Int to = edge[x][i];
		if(to == last)continue;
		dist[to] = dist[x] + 1;
		dfs(to, x);
	}
}

Int far(Int x){
	dfs(x);
	dist[x] = 0;
	Int hoge = 0;
	Int res;
	for(Int i = 0;i < n;i++){
		if(hoge < dist[i]){
			hoge = dist[i];
			res = i;
		}
	}
	return res;
}

int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		dig[u]++;
		dig[v]++;
		digmax = max(dig[u], digmax);
		digmax = max(dig[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	int zerocnt = -2;
	for(int i = 0;i < n;i++){
		if(dig[i] == 1){
			zerocnt++;
		}
	}
	if(x < y){
		cout << (n-1-zerocnt) * x + zerocnt * y << endl;
	}
	else if(digmax == n - 1){
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl;
	return 0;

}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000];
Int dist[216000];

int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	Int ycnt = n-1;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		dig[u]++;
		dig[v]++;
		if(dig[u] > 2 || dig[v] > 2)ycnt--;
		digmax = max(dig[u], digmax);
		digmax = max(dig[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	if(x < y){
		cout << (n-1-ycnt) * y + ycnt * x << endl;
	}
	else if(digmax == n - 1){
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl;
	return 0;

}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000], digg[216000];
Int dist[216000];
Int dp[2][216000]  ;

#define INF (1 << 30)

void dfs(int x, int last = -1){
	dp[0][x] = 0;
	dp[1][x] = -INF;
	dp[2][x] = -INF;
	for(int i = 0;i < edge[x].size();i++){
		int to = edge[x][i];
		if(to == last)continue;
		dfs(to, x);
		dp[2][x] = max(dp[2][x] + max(max(dp[0][to], dp[1][to]), dp[2][to]), dp[1][x] + max(dp[0][to], dp[1][to]) + 1);
		dp[1][x] = max(dp[1][x] + max(max(dp[0][to], dp[1][to]), dp[2][to]), dp[0][x] + 1 + max(dp[0][to], dp[1][to]));
		dp[0][x] += max(max(dp[0][to], dp[1][to]), dp[2][to]);
	}
}
int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		digg[u]++;
		digg[v]++;
		digmax = max(digg[u], digmax);
		digmax = max(digg[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	dfs(0);
    Int ycnt = max(max(dp[0][0], dp[1][0]), dp[2][0]);
	if(x < y){
		cout << (n-1-ycnt) * y + ycnt * x << endl;
	}
	else if(digmax == n - 1){
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl;
	return 0;

}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000];
Int dist[216000];

void dfs(Int x, Int last = -1){
	for(Int i = 0;i < edge[x].size();i++){
		Int to = edge[x][i];
		if(to == last)continue;
		dist[to] = dist[x] + 1;
		dfs(to, x);
	}
}

Int far(Int x){
	dfs(x);
	dist[x] = 0;
	Int hoge = 0;
	Int res;
	for(Int i = 0;i < n;i++){
		if(hoge < dist[i]){
			hoge = dist[i];
			res = i;
		}
	}
	return res;
}

int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		dig[u]++;
		dig[v]++;
		digmax = max(dig[u], digmax);
		digmax = max(dig[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	Int ycnt = n-1;
	for(int i = 0;i < n;i++){
		if(dig[i] > 2){
			ycnt -= dig[i] - 2;
		}
	}
	if(x < y){
		cout << (n-1-ycnt) * y + ycnt * x << endl;
	}
	else if(digmax == n - 1){
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl;
	return 0;

}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000];
Int dist[216000];

void dfs(Int x, Int last = -1){
	for(Int i = 0;i < edge[x].size();i++){
		Int to = edge[x][i];
		if(to == last)continue;
		dist[to] = dist[x] + 1;
		dfs(to, x);
	}
}

Int far(Int x){
	dfs(x);
	dist[x] = 0;
	Int hoge = 0;
	Int res;
	for(Int i = 0;i < n;i++){
		if(hoge < dist[i]){
			hoge = dist[i];
			res = i;
		}
	}
	return res;
}

int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		dig[u]++;
		dig[v]++;
		digmax = max(dig[u], digmax);
		digmax = max(dig[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	int ycnt = n-1;
	for(int i = 0;i < n;i++){
		if(dig[i] > 2){
			ycnt -= dig[i] - 2;
		}
	}
	if(x < y){
		cout << (n-1-ycnt) * y + ycnt * x << endl;
	}
	else if(digmax == n - 1){
		exit(10);
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl, 		exit(10);
	return 0;

}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000];
Int dist[216000];

void dfs(Int x, Int last = -1){
	for(Int i = 0;i < edge[x].size();i++){
		Int to = edge[x][i];
		if(to == last)continue;
		dist[to] = dist[x] + 1;
		dfs(to, x);
	}
}

Int far(Int x){
	dfs(x);
	dist[x] = 0;
	Int hoge = 0;
	Int res;
	for(Int i = 0;i < n;i++){
		if(hoge < dist[i]){
			hoge = dist[i];
			res = i;
		}
	}
	return res;
}

int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		dig[u]++;
		dig[v]++;
		digmax = max(dig[u], digmax);
		digmax = max(dig[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	int ycnt = n-1;
	for(int i = 0;i < n;i++){
		if(dig[i] > 2){
			ycnt -= dig[i] - 2;
		}
	}
	if(x < y){
		cout << (n-1-ycnt) * y + ycnt * x << endl;
	}
	else if(digmax == n - 1){
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl;
	return 0;

}


#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long Int;
typedef pair<Int, Int> P;
typedef double Real;

set<Int> ins;
vector<Int> edge[216000];

Int n, x, y, u, v, dig[216000];
Int dist[216000];

void dfs(Int x, Int last = -1){
	for(Int i = 0;i < edge[x].size();i++){
		Int to = edge[x][i];
		if(to == last)continue;
		dist[to] = dist[x] + 1;
		dfs(to, x);
	}
}

Int far(Int x){
	dfs(x);
	dist[x] = 0;
	Int hoge = 0;
	Int res;
	for(Int i = 0;i < n;i++){
		if(hoge < dist[i]){
			hoge = dist[i];
			res = i;
		}
	}
	return res;
}

int main(){
	cin >> n >> x >> y;
	Int digmax = 0;
	for(Int i = 0;i < n - 1;i++){
		cin >> u >> v;  u--, v--;
		dig[u]++;
		dig[v]++;
		digmax = max(dig[u], digmax);
		digmax = max(dig[v], digmax);
		edge[u].push_back(v);
		edge[v].push_back(u);
	}

	int ycnt = n-1;
	for(int i = 0;i < n;i++){
		if(dig[i] > 2){
			ycnt -= dig[i] - 2;
		}
	}
	if(x < y){
		cout << (n-1-ycnt) * y + ycnt * x << endl;
	}
	else if(digmax == n - 1){
		exit(10);
		cout << (n-2)*y+x << endl;
	}
	else cout << (n-1)*y << endl;
	return 0;

}


#include<cstdio>
#include<algorithm>
using namespace std;
const int N=200005;
int n,x,y,a,b,d[N],f[N][3],ans;
int nxt[N*2],lnk[N*2],head[N],tot;
void add(int x,int y){
	d[x]++;
	nxt[++tot]=head[x];lnk[tot]=y;
	head[x]=tot;
}
bool star(){
	for (int i=1;i<=n;i++) if (d[i]==n-1) return 1;
	return 0;
}
void dp(int x,int from){
	int v,t1,t2;
	f[x][0]=0;
	f[x][1]=f[x][2]=-N;
	for (int i=head[x];i;i=nxt[i])
	 if ((v=lnk[i])!=from){
		dp(v,x);
		t1=max(f[v][1],f[v][0]);
		t2=max(t1,f[v][2]);
		f[x][2]=max(f[x][2]+t2,f[x][1]+t1+1);
		f[x][1]=max(f[x][1]+t2,f[x][0]+t1+1);
		f[x][0]+=t2;
	}
}
int main(){
	scanf("%d%d%d",&n,&x,&y);
	for (int i=1;i<n;i++) scanf("%d%d",&a,&b),add(a,b),add(b,a);
	if (x>=y){
		if (star()) printf("%I64d",(long long)(n-2)*y+x);
		else printf("%I64d",(long long)(n-1)*y);
	}
	else {
		dp(1,0);
		ans=max(f[1][0],max(f[1][1],f[1][2]));
		printf("%I64d",(long long)ans*x+(long long)(n-1-ans)*y);
	}
	return 0;
}
/*
5 2 3
1 2
1 3
3 4
5 3
*/


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
using namespace std;

typedef long long ll;
const int N=200010;
int pos[N],dis[N],d[N],first[N],c[N],f[N];
int tot,n,x,y,a,b,p,q;
bool v[N];
ll ans;
struct edge{
	int x,next;
}e[N*2];
void add(int x,int y){
	e[++tot].x=y;
	e[tot].next=first[x];
	first[x]=tot;
}
void dfs(int x){
	memset(v,0,sizeof(v));
	memset(dis,0,sizeof(dis));
	memset(f,0,sizeof(f));
	for(int i=1;i<=n;i++) pos[i]=i;
	c[p=q=1]=x; v[x]=true;
	for(;p<=q;p++)
	 for(int i=first[c[p]];i;i=e[i].next)
	 if(!v[e[i].x]) {
	 	v[e[i].x]=true;
	 	f[e[i].x]=c[p];
		c[++q]=e[i].x;
	 }
	for(int i=q;i;i--)
	if(dis[c[i]]+1>dis[f[c[i]]]){
		dis[f[c[i]]]=dis[c[i]]+1;
		pos[f[c[i]]]=pos[c[i]];
	}
}
void solve_1(){
	dfs(1);
	int tmp=pos[1];
	dfs(tmp);
	ans=(ll)dis[tmp]*x+(ll)y*(n-1-dis[tmp]);
	printf("%I64d",ans);
}
void solve_2(){
	bool flag=false;
	for(int i=1;i<=n;i++)
	if(d[i]==n-1) flag=true;
	if(flag) ans=(ll)(n-2)*y+x;
	else ans=(ll)(n-1)*y;
	printf("%I64d\n",ans);
}
int main(){
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<n;i++){
		scanf("%d%d",&a,&b);
		add(a,b); add(b,a);
		d[a]++; d[b]++;
	}
	if(x<y) solve_1(); else solve_2();
	return 0;
}


#include<cstdio>
#include<algorithm>
using namespace std;
const int N=200005;
int n,x,y,a,b,d[N],f[N][3],ans;
int nxt[N*2],lnk[N*2],head[N],tot;
void add(int x,int y){
	d[x]++;
	nxt[++tot]=head[x];lnk[tot]=y;
	head[x]=tot;
}
bool star(){
	for (int i=1;i<=n;i++) if (d[i]==n-1) return 1;
	return 0;
}
void dp(int x,int from){
	int v,t1,t2;
	f[x][0]=0;
	f[x][1]=f[x][2]=-N;
	for (int i=head[x];i;i=nxt[i])
	 if ((v=lnk[i])!=from){
		dp(v,x);
		t1=max(f[v][1],f[v][0]);
		t2=max(t1,f[v][2]);
		f[x][2]=max(f[x][2]+t2,f[x][1]+t1+1);
		f[x][1]=max(f[x][1]+t2,f[x][0]+t1+1);
		f[x][0]+=t2;
	}
}
int main(){
	scanf("%d%d%d",&n,&x,&y);
	for (int i=1;i<n;i++) scanf("%d%d",&a,&b),add(a,b),add(b,a);
	if (x>=y){
		if (star()) printf("%d",(n-2)*y+x);
		else printf("%d",(n-1)*y);
	}
	else {
		dp(1,0);
		ans=max(f[1][0],max(f[1][1],f[1][2]));
		printf("%d",ans*x+(n-1-ans)*y);
	}
	return 0;
}
/*
5 2 3
1 2
1 3
3 4
5 3
*/


#include<cstdio>
#include<algorithm>
using namespace std;
const int N=200005;
int n,x,y,a,b,d[N],f[N][3],ans;
int nxt[N*2],lnk[N*2],head[N],tot;
void add(int x,int y){
	d[x]++;
	nxt[++tot]=head[x];lnk[tot]=y;
	head[x]=tot;
}
bool star(){
	for (int i=1;i<=n;i++) if (d[i]==n-1) return 1;
	return 0;
}
void dp(int x,int from){
	int v,t1,t2;
	f[x][0]=0;
	f[x][1]=f[x][2]=-N;
	for (int i=head[x];i;i=nxt[i])
	 if ((v=lnk[i])!=from){
		dp(v,x);
		t1=max(f[v][1],f[v][0]);
		t2=max(t1,f[v][2]);
		f[x][2]=max(f[x][2]+t2,f[x][1]+t1+1);
		f[x][1]=max(f[x][1]+t2,f[x][0]+t1+1);
		f[x][0]+=t2;
	}
}
int main(){
	scanf("%d%d%d",&n,&x,&y);
	for (int i=1;i<n;i++) scanf("%d%d",&a,&b),add(a,b),add(b,a);
	if (x>=y){
		if (star()) printf("%I64d",(long long)(n-2)*y+x);
		else printf("%I64d",(long long)(n-1)*y);
	}
	else {
		dp(1,0);
		ans=max(f[1][0],max(f[1][1],f[1][2]));
		printf("%I64d",(long long)ans*x+(n-1-ans)*y);
	}
	return 0;
}
/*
5 2 3
1 2
1 3
3 4
5 3
*/


#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
using namespace std;

typedef long long ll;
const int N=200010;
const int INF=1000000007;
int pos[N],dis[N],d[N],first[N],f[N][2];
int tot,n,x,y,a,b;
bool v[N];
ll ans;
struct edge{
	int x,next;
}e[N*2];
void add(int x,int y){
	e[++tot].x=y;
	e[tot].next=first[x];
	first[x]=tot;
}
void dfs(int x,int y){
	int pos1=0,pos2=0;
	for(int i=first[x];i;i=e[i].next)
	if(e[i].x!=y){
		dfs(e[i].x,x);
		if(pos1==0||f[e[i].x][1]-f[e[i].x][0]<f[pos1][1]-f[pos1][0]) pos2=pos1,pos1=e[i].x;
		else if(pos2==0||f[e[i].x][1]-f[e[i].x][0]<f[pos2][1]-f[pos2][0]) pos2=e[i].x;
	}
	for(int i=first[x];i;i=e[i].next)
	if(e[i].x!=y){
		if(e[i].x!=pos1) f[x][0]+=max(f[e[i].x][0],f[e[i].x][1]);
		else f[x][0]+=f[e[i].x][0]+1;
		if(e[i].x!=pos1&&e[i].x!=pos2) f[x][1]+=max(f[e[i].x][1],f[e[i].x][0]);
		else f[x][1]+=f[e[i].x][0]+1;
	}
}
void solve_1(){
	dfs(1,0);
	int tmp=max(f[1][0],f[1][1]);
	ans=(ll)tmp*x+(ll)y*(n-1-tmp);
	printf("%I64d",ans);
}
void solve_2(){
	bool flag=false;
	for(int i=1;i<=n;i++)
	if(d[i]==n-1) flag=true;
	if(flag) ans=(ll)(n-2)*y+x;
	else ans=(ll)(n-1)*y;
	printf("%I64d\n",ans);
}
int main(){
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<n;i++){
		scanf("%d%d",&a,&b);
		add(a,b); add(b,a);
		d[a]++; d[b]++;
	}
	if(x<y) solve_1(); else solve_2();
	return 0;
}


#include <cstdio>
#include <cstring>
#include <iostream>

#include<vector>
#include <algorithm>
#include<string>
using namespace std;
#define inf 99999999
#define repf(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
#define N 210000
int n;
int vis[N];
int dp[N][3];
int a[N];
vector<int>v[N];
void dfs(int x,int pre)
{
    int i,j,k;
    if(v[x].size()==1) return ;
    for(i = 0;i < v[x].size();i++)
    {
        if(v[x][i]==pre) continue;
        else dfs(v[x][i],x);

    }
    int u=0,z=0,tmp=0;
    for(i = 0;i < v[x].size();i++)
    {
       int u=v[x][i];
       if(u==pre) continue;
       int t1 = max(dp[u][0], dp[u][1]);
        int t2 = max(t1, dp[u][2]);
        int t3 = max(t1, t2);
        int cur=x;
        dp[cur][2] = max(dp[cur][2]+t3, dp[cur][1]+t1+1);
        dp[cur][1] = max(dp[cur][1]+t3, dp[cur][0]+t1+1);
        dp[cur][0] += t3;

}
void find1()
{
    int flag=0;
    for(i = 1;i <= n;i++)
    {
        if(v[i].size()==n-1) return 0;
    }
    return 1;
}
int main()
{
    int x,y;
    while(cin>>n>>x>>y)
    {
    //    memset(vis,0,sizeof(vis));
         int i,j;
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=2;j++)
            {
                dp[i][j]=0;
            }
        }
       for(i = 0;i <= n;i++) v[i].clear();
       int p,q;
       for(i = 1;i < n;i++)
       {
           scanf("%d %d",&p,&q);
           v[p].push_back(q);
           v[q].push_back(p);
       }
       if(x>=y)
       {
           if(find1())
                printf("%d\n",y*(n-1));
           else
                printf("%d\n",y*(n-2)+x);
            continue;
       }
        dfs(1,0);
        int ans=0;
        for(i=0;i<=2;i++)
        {
            ans=max(ans,dp[1][i]);
        }

        printf("%I64d\n",(ll)x*(ll)ans+(ll)(n-1-ans)*(ll)y);
    }
}


#include <cstdio>
#include <cstring>
#include <iostream>

#include<vector>
#include <algorithm>
#include<string>
using namespace std;
#define inf 99999999
#define repf(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
#define ll int
#define N 210000
int n;
int vis[N];
int dp[N][3];
int a[N];
vector<int>v[N];
void dfs(int x,int pre)
{
    int i,j,k;
    if(v[x].size()==1) return ;
    for(i = 0;i < v[x].size();i++)
    {
        if(v[x][i]==pre) continue;
        else dfs(v[x][i],x);

    }
    int u=0,z=0,tmp=0;
    for(i = 0;i < v[x].size();i++)
    {
       int u=v[x][i];
       if(u==pre) continue;
       int t1 = max(dp[u][0], dp[u][1]);
        int t2 = max(t1, dp[u][2]);
        int t3 = max(t1, t2);
        int cur=x;
        dp[cur][2] = max(dp[cur][2]+t3, dp[cur][1]+t1+1);
        dp[cur][1] = max(dp[cur][1]+t3, dp[cur][0]+t1+1);
        dp[cur][0] += t3;
    }
}
int find1()
{
    int flag=0;
    int i;
    for(i = 1;i <= n;i++)
    {
        if(v[i].size()==n-1) return (ll)0;
    }
    return (ll)1;
}
int main()
{
    int x,y;
    while(cin>>n>>x>>y)
    {
    //    memset(vis,0,sizeof(vis));
         int i,j;
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=2;j++)
            {
                dp[i][j]=0;
            }
        }
       for(i = 0;i <= n;i++) v[i].clear();
       int p,q;
       for(i = 1;i < n;i++)
       {
           scanf("%I64d %I64d",&p,&q);
           v[p].push_back(q);
           v[q].push_back(p);
       }
       if(x>=y)
       {
           if(find1())
                cout<<y*(n-1);
           else
                cout<<y*(n-2)+x;
            continue;
       }
        dfs(1,0);
        int ans=0;
        for(i=0;i<=2;i++)
        {
            ans=max(ans,dp[1][i]);
        }

        cout<<(ll)x*(ll)ans+(ll)(n-1-ans)*(ll)y;
    }
}


#include <cstdio>
#include <cstring>
#include <iostream>

#include<vector>
#include <algorithm>
#include<string>
using namespace std;
#define inf 99999999
#define repf(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
#define N 210000
int n;
int vis[N];
int dp[N][3];
int a[N];
vector<int>v[N];
void dfs(int x,int pre)
{
    int i,j,k;
    if(v[x].size()==1) return ;
    for(i = 0;i < v[x].size();i++)
    {
        if(v[x][i]==pre) continue;
        else dfs(v[x][i],x);

    }
    int u=0,z=0,tmp=0;
    for(i = 0;i < v[x].size();i++)
    {
       int u=v[x][i];
       int t1 = max(dp[u][0], dp[u][1]);
        int t2 = max(t1, dp[u][2]);
        int t3 = max(t1, t2);
        int cur=x;
        dp[cur][2] = max(dp[cur][2]+t3, dp[cur][1]+t1+1);
        dp[cur][1] = max(dp[cur][1]+t3, dp[cur][0]+t1+1);
        dp[cur][0] += t3;
	}
}
int find1()
{
    int flag=0;
    int i;
    for(i = 1;i <= n;i++)
    {
        if(v[i].size()==n-1) return 0;
    }
    return 1;
}
int main()
{
    int x,y;
    while(cin>>n>>x>>y)
    {
    //    memset(vis,0,sizeof(vis));
         int i,j;
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=2;j++)
            {
                dp[i][j]=0;
            }
        }
       for(i = 0;i <= n;i++) v[i].clear();
       int p,q;
       for(i = 1;i < n;i++)
       {
           scanf("%d %d",&p,&q);
           v[p].push_back(q);
           v[q].push_back(p);
       }
       if(x>=y)
       {
           if(find1())
                printf("%d\n",y*(n-1));
           else
                printf("%d\n",y*(n-2)+x);
            continue;
       }
        dfs(1,0);
        int ans=0;
        for(i=0;i<=2;i++)
        {
            ans=max(ans,dp[1][i]);
        }

        printf("%I64d\n",(ll)x*(ll)ans+(ll)(n-1-ans)*(ll)y);
    }
}


#include <cstdio>
#include <cstring>
#include <iostream>

#include<vector>
#include <algorithm>
#include<string>
using namespace std;
#define inf 99999999
#define repf(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
#define N 7000
int n;
int vis[N];
int dp[N][2];
int a[N];
vector<int>v[N];
void dfs(int x,int pre)
{
    int i,j,k;
    if(v[x].size()==1)
    {
        dp[x][0]=dp[x][1]=1;
        return ;
    }
    for(i = 0;i < v[x].size();i++)
    {
        if(v[x][i]==pre) continue;
        else dfs(v[x][i],x);

    }
    for(i = 0;i < v[x].size();i++)
    {
       int y=v[x][i];
       if(y==pre) continue;
       if(dp[y][0]+1>dp[x][0])
       {
           dp[x][1]=dp[x][0];
           dp[x][0]=dp[y][0]+1;
       }
       else if(dp[y][0]+1>dp[x][1])
       {
           dp[x][1]=dp[y][0]+1;
       }
    }
}
int main()
{
    int x,y;
    while(cin>>n>>x>>y)
    {
    //    memset(vis,0,sizeof(vis));
         int i,j;
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=1;j++)
            {
                dp[i][j]=j;
            }
        }
       for(i = 0;i <= n;i++) v[i].clear();
       int p,q;
       for(i = 1;i < n;i++)
       {
           scanf("%d %d",&p,&q);
           v[p].push_back(q);
           v[q].push_back(p);
       }
       if(x>=y)
       {
           printf("%d\n",y*(n-1));
            continue;
       }
        dfs(1,0);
        int ans=dp[1][0]+dp[1][1]-2;
        printf("%d\n",x*ans+(n-1-ans)*y);
    }
}


#include <cstdio>
#include <cstring>
#include <iostream>

#include<vector>
#include <algorithm>
#include<string>
using namespace std;
#define inf 99999999
#define repf(i,a,b) for(int i=(a);i<=(b);i++)
typedef long long ll;
#define N 210000
int n;
int vis[N];
int dp[N][3];
int a[N];
vector<int>v[N];
void dfs(int x,int pre)
{
    int i,j,k;
    if(v[x].size()==1) return ;
    for(i = 0;i < v[x].size();i++)
    {
        if(v[x][i]==pre) continue;
        else dfs(v[x][i],x);

    }
    int u=0,z=0,tmp=0;
    for(i = 0;i < v[x].size();i++)
    {
       int u=v[x][i];
       if(u==pre) continue;
       int t1 = max(dp[u][0], dp[u][1]);
        int t2 = max(t1, dp[u][2]);
        int t3 = max(t1, t2);
        int cur=x;
        dp[cur][2] = max(dp[cur][2]+t3, dp[cur][1]+t1+1);
        dp[cur][1] = max(dp[cur][1]+t3, dp[cur][0]+t1+1);
        dp[cur][0] += t3;
	}
}
int find1()
{
    int flag=0;
    int i;
    for(i = 1;i <= n;i++)
    {
        if(v[i].size()==n-1) return 0;
    }
    return 1;
}
int main()
{
    int x,y;
    while(cin>>n>>x>>y)
    {
    //    memset(vis,0,sizeof(vis));
         int i,j;
        for(i=0;i<=n;i++)
        {
            for(j=0;j<=2;j++)
            {
                dp[i][j]=0;
            }
        }
       for(i = 0;i <= n;i++) v[i].clear();
       int p,q;
       for(i = 1;i < n;i++)
       {
           scanf("%d %d",&p,&q);
           v[p].push_back(q);
           v[q].push_back(p);
       }
       if(x>=y)
       {
           if(find1())
                printf("%d\n",y*(n-1));
           else
                printf("%d\n",y*(n-2)+x);
            continue;
       }
        dfs(1,0);
        int ans=0;
        for(i=0;i<=2;i++)
        {
            ans=max(ans,dp[1][i]);
        }

        printf("%I64d\n",(ll)x*(ll)ans+(ll)(n-1-ans)*(ll)y);
    }
}