#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
{
    return x.we < y.we;
}

vector<long long> sss;
int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    int loop = k;
    k = 2 * k;
    long long ans=min((n-r+1)*(m-r+1),r*r);
    sss.push_back(ans);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    ans = 0;
    while(k > 0 && !q.empty())
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            long long sa =  0;
            long long sb =  0;
            long long ppi = p.i <= r ? 1 : p.i - r + 1;
            long long ppj = p.j <= r ? 1 : p.j - r + 1;
            sa = (p.i > n - r + 1 ? n - r + 1 : p.i) - ppi + 1;
            sb = (p.j > m - r + 1 ? m - r + 1 : p.j) - ppj + 1;
            p.we = sa * sb;
            sss.push_back(p.we);
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }
    sort(sss.begin(),sss.end());
    reverse(sss.begin(),sss.end());
    for(int i = 0; i < loop; i++)
        ans+=sss[i];
    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
{
    return x.we < y.we;
}

vector<long long> sss;
int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    int loop = k;
    k = 2 * k;
    long long ans=min((n-r+1)*(m-r+1),r*r);
    sss.push_back(ans);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    ans = 0;
    while(k > 0 || q.empty())
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            long long sa =  0;
            long long sb =  0;
            long long ppi = p.i <= r ? 1 : p.i - r + 1;
            long long ppj = p.j <= r ? 1 : p.j - r + 1;
            sa = (p.i > n - r + 1 ? n - r + 1 : p.i) - ppi + 1;
            sb = (p.j > m - r + 1 ? m - r + 1 : p.j) - ppj + 1;
            p.we = sa * sb;
            sss.push_back(p.we);
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }
    sort(sss.begin(),sss.end());
    reverse(sss.begin(),sss.end());
    for(int i = 0; i < loop; i++)
        ans+=sss[i];
    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
{
    return x.we < y.we;
}

vector<long long> sss;
int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    int loop = k;
    k = k;
    long long ans=min((n-r+1)*(m-r+1),r*r);
    sss.push_back(ans);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    ans = 0;
    while(k > 0 && !q.empty())
    {
        Node now = q.top();
        ans += now.we;
        k--;
        if(k <= 0)
            break;
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            long long sa =  0;
            long long sb =  0;
            long long ppi = p.i <= r ? 1 : p.i - r + 1;
            long long ppj = p.j <= r ? 1 : p.j - r + 1;
            sa = (p.i > n - r + 1 ? n - r + 1 : p.i) - ppi + 1;
            sb = (p.j > m - r + 1 ? m - r + 1 : p.j) - ppj + 1;
            p.we = sa * sb;
            sss.push_back(p.we);
            q.push(p);

        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
{
    return x.we < y.we;
}

vector<long long> sss;
int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    int loop = k;
    k = (n-r+1)*(m-r+1) * k;
    long long ans=min((n-r+1)*(m-r+1),r*r);
    sss.push_back(ans);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    ans = 0;
    while(k > 0 && !q.empty())
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            long long sa =  0;
            long long sb =  0;
            long long ppi = p.i <= r ? 1 : p.i - r + 1;
            long long ppj = p.j <= r ? 1 : p.j - r + 1;
            sa = (p.i > n - r + 1 ? n - r + 1 : p.i) - ppi + 1;
            sb = (p.j > m - r + 1 ? m - r + 1 : p.j) - ppj + 1;
            p.we = sa * sb;
            sss.push_back(p.we);
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }
    sort(sss.begin(),sss.end());
    reverse(sss.begin(),sss.end());
    for(int i = 0; i < loop; i++)
        ans+=sss[i];
    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans=min((n-r+1)*(m-r+1),r*r);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            p.we = min((p.i-max(ni-r+1,1LL)+1)*(p.j-max(nj-r+1,1LL)+1),r*r);
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans＝min((n-r+1)
*(m-r+1),r*r);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            p.we = min((p.i-max(ni-r+1,1)+1)*(p.j-max(nj-r+1,1)+1),r*r);
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans＝min((n-r+1)
*(m-r+1),r*r);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            p.we = min((p.i-max(ni-r+1,1LL)+1)*(p.j-max(nj-r+1,1LL)+1),r*r);
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
{
    return x.we < y.we;
}

vector<long long> sss;
int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    int loop = k;
    k = (n-r-1)*(m-r-1) * k;
    long long ans=min((n-r+1)*(m-r+1),r*r);
    sss.push_back(ans);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    ans = 0;
    while(k > 0 && !q.empty())
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            long long sa =  0;
            long long sb =  0;
            long long ppi = p.i <= r ? 1 : p.i - r + 1;
            long long ppj = p.j <= r ? 1 : p.j - r + 1;
            sa = (p.i > n - r + 1 ? n - r + 1 : p.i) - ppi + 1;
            sb = (p.j > m - r + 1 ? m - r + 1 : p.j) - ppj + 1;
            p.we = sa * sb;
            sss.push_back(p.we);
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }
    sort(sss.begin(),sss.end());
    reverse(sss.begin(),sss.end());
    for(int i = 0; i < loop; i++)
        ans+=sss[i];
    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans = min(min(n-r+1,r)*min(m-r+1,r),(n-r+1)*(m-r+1));
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            p.we = min(min(n-ni + 1,ni)*min(m-nj + 1,nj),(n-r+1)*(m-r+1));
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans = min(min(n-r+1,r)*min(m-r+1,r),min((n-r+1)*(m-r+1),r*r));
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            p.we = min(min(n-ni + 1,ni)*min(m-nj + 1,nj),min((n-r+1)*(m-r+1),r*r));
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    long long i,j;
    double we;

};
bool operator <(Node x,Node y)
{
    return x.we < y.we;
}

int main()
{
    map<pair<long long,long long>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    long long f1 = s.i <= r ? 1 : s.i - r + 1;;
    long long f2 = s.j <= r ? 1 : s.j - r + 1;
    long long fa = (s.i > n - r + 1 ? n - r + 1 : s.i) - f1 + 1;
    long long fb = (s.j > m - r + 1 ? m - r + 1 : s.j) - f2 + 1;
    s.we = fa * fb * 1.0;
    q.push(s);;
    double ans = 0;
    while(k > 0 && !q.empty())
    {
        Node now = q.top();
        q.pop();
        ans += now.we;
        k--;
        if(k <= 0)
            break;
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            long long sa =  0;
            long long sb =  0;
            long long ppi = p.i <= r ? 1 : p.i - r + 1;
            long long ppj = p.j <= r ? 1 : p.j - r + 1;
            sa = (p.i > n - r + 1 ? n - r + 1 : p.i) - ppi + 1;
            sb = (p.j > m - r + 1 ? m - r + 1 : p.j) - ppj + 1;
            p.we = sa * sb * 1.0;
            q.push(p);

        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans = min((n-r+1)*(m-r+1),r*r);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            p.we = min((n-r+1-max(ni-r+1,1)+1)*(m-r+1-max(nj-r+1,1)+1),r*r);
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans = min(min(n-r+1,r)*min(m-r+1,r),r*r);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
Node p;
            p.i = ni;
            p.j = nj;
            if(ni < 1 || nj < 1 ||rec[make_pair(p.i,p.j)] == 1 || ni > n || nj > m)
                continue;

            rec[make_pair(p.i,p.j)] = 1;
            p.we = min(min(n-ni + 1,ni)*min(m-nj + 1,nj),r*r);
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int mx[] ={0,-1,0,1};
int my[] = {-1,0,1,0};

struct Node
{
    int i,j;
    long long we;

};
bool operator <(Node x,Node y)
    {
        return x.we < y.we;
    }

int main()
{
    map<pair<int,int>,int >rec;
    rec.clear();
    long long n,m,r,k;
    cin >> n >> m >> r >> k;
    long long ans＝min((n-r+1)*(m-r+1),r*r);
    priority_queue<Node>q;
    Node s;
    s.i = n-r+1;
    s.j = m-r+1;
    rec[make_pair(s.i,s.j)] = 1;
    s.we = ans;
    q.push(s);;
    k--;
    while(k > 0)
    {
        Node now = q.top();
        q.pop();
        for(int i = 0; i < 4; i++)
        {
            long long ni = now.i + mx[i];
            long long nj = now.j + my[i];
            if(ni < 1 || nj < 1 ||rec[make_pair(ni,nj)] == 1 || ni > n || nj > m)
                continue;
            Node p;
            p.i = ni;
            p.j = nj;
            rec[make_pair(p.i,p.j)] = 1;
            p.we = min((p.i-max(ni-r+1,1LL)+1)*(p.j-max(nj-r+1,1LL)+1),r*r);
            ans += p.we;
            k--;
            if(k == 0)
                break;
            q.push(p);
        }
    }

    double ss = (n-r + 1) * (m -r +1)*1.0;
    printf("%.12lf\n",ans*1.0/ss);
    return 0;
}


#include <cstdio>
#include <queue>
#include <set>
#define LL long long

using namespace std;

struct Fish {
   int x, y;
   long long v;
   bool operator <(const Fish &rhs) const {return v < rhs.v;}
};

long long ans;
int a[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
priority_queue<Fish> q;
set<pair<int, int>> vis;

int min(int a, int b) {return a < b ? a: b;}
int max(int a, int b) {return a > b ? a: b;}

int main() {
    int n, m, r, k;
    scanf("%d %d %d %d", &n, &m, &r, &k);
    q.push((Fish){(n + 1) >> 1, (m + 1) >> 1, 1LL * (1 + min(n, ((n + 1) >> 1) + r - 1) - max(r, (n + 1) >> 1)) *
        (1 + min(m, ((m + 1) >> 1) + r - 1) - max(r, (m + 1) >> 1))});
    vis.insert(make_pair((n + 1) >> 1, (m + 1) >> 1));
    Fish x;
    int tx, ty;
    while (k) {
        x = q.top(); q.pop();
        ans += x.v;
        --k;
        for (int i = 0; i < 4; ++i) {
            tx = x.x + a[i][0], ty = x.y + a[i][1];
            if (tx > n || tx < 1 || ty > m || ty < 1) continue;
            if (vis.count(make_pair(tx, ty))) continue;
            q.push((Fish){tx, ty, 1LL * (1 + min(n, tx + r - 1) - max(r, tx)) * (1 + min(m, ty + r - 1) - max(r, ty))});
            vis.insert(make_pair(tx, ty));
        }
    }
    printf("%.9Lf\n", (long double)ans / (long double)(n - r + 1) / (long double)(m - r + 1));
    return 0;
}


#include <cstdio>
#include <queue>
#include <set>
#define LL long long

using namespace std;

struct Fish {
   int x, y;
   long long v;
   bool operator <(const Fish &rhs) const {return v < rhs.v;}
};

long long ans;
int a[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
priority_queue<Fish> q;
set<pair<int, int>> vis;

int min(int a, int b) {return a < b ? a: b;}
int max(int a, int b) {return a > b ? a: b;}

int main() {
    int n, m, r, k;
    scanf("%d %d %d %d", &n, &m, &r, &k);
    q.push((Fish){(n + 1) >> 1, (m + 1) >> 1, 1LL * (1 + min(n, ((n + 1) >> 1) + r - 1) - max(r, (n + 1) >> 1)) *
        (1 + min(m, ((m + 1) >> 1) + r - 1) - max(r, (m + 1) >> 1))});
    vis.insert(make_pair((n + 1) >> 1, (m + 1) >> 1));
    Fish x;
    int tx, ty;
    while (k) {
        x = q.top(); q.pop();
        ans += x.v;
        --k;
        for (int i = 0; i < 4; ++i) {
            tx = x.x + a[i][0], ty = x.y + a[i][1];
            if (tx > n || tx < 1 || ty > m || ty < 1) continue;
            if (vis.count(make_pair(tx, ty))) continue;
            q.push((Fish){tx, ty, 1LL * (1 + min(n, tx + r - 1) - max(r, tx)) * (1 + min(m, ty + r - 1) - max(r, ty))});
            vis.insert(make_pair(tx, ty));
        }
    }
    printf("%.9Lf\n", (long double)ans / (n - r + 1) / (m - r + 1));
    return 0;
}


#include <cstdio>
#include <queue>
#include <set>
#define LL long long

using namespace std;

struct Fish {
   int x, y;
   LL v;
   bool operator <(const Fish &rhs) const {return v < rhs.v;}
};

LL ans;
int a[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
priority_queue<Fish> q;
set<pair<int, int>> vis;

int min(int a, int b) {return a < b ? a: b;}
int max(int a, int b) {return a > b ? a: b;}

int main() {
    int n, m, r, k;
    scanf("%d %d %d %d", &n, &m, &r, &k);
    q.push((Fish){(n + 1) >> 1, (m + 1) >> 1, 1LL * (1 + min(n, ((n + 1) >> 1) + r - 1) - max(r, (n + 1) >> 1)) *
        (1 + min(m, ((m + 1) >> 1) + r - 1) - max(r, (m + 1) >> 1))});
    vis.insert(make_pair((n + 1) >> 1, (m + 1) >> 1));
    Fish x;
    int tx, ty;
    while (k) {
        x = q.top(); q.pop();
        ans += x.v;
        --k;
        for (int i = 0; i < 4; ++i) {
            tx = x.x + a[i][0], ty = x.y + a[i][1];
            if (tx > n || tx < 1 || ty > m || ty < 1) continue;
            if (vis.count(make_pair(tx, ty))) continue;
            q.push((Fish){tx, ty, 1LL * (1 + min(n, tx + r - 1) - max(r, tx)) * (1 + min(m, ty + r - 1) - max(r, ty))});
            vis.insert(make_pair(tx, ty));
        }
    }
    printf("%.9f\n", (double)ans / (n - r + 1) / (m - r + 1));
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long n,m,k,nr;
unordered_map<long long,long long>h;
struct cmp
{
    bool operator()(long long a, long long b)
    {
        return h[a]<h[b];
    }
};
priority_queue<long long,vector<long long>,cmp>q;
struct punct
{
    long long l,c;
};
punct p;
long long nroffishes(long long l, long long c)
{
    long long lst=max(1LL,l-k+1);
    long long cst=max(1LL,c-k+1);
    long long ldr=min(n-k+1,l);
    long long cdr=min(m-k+1,c);
    long long sol=1LL*(cdr-cst+1)*(ldr-lst+1);
    return sol;
}
punct pozitie(long long nr)
{
    punct sol;
    sol.c=nr%m;
    if(!sol.c){
        sol.c=m;
        sol.l=nr/m;
    }
    else
        sol.l=(nr/m)+1;
    return sol;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m>>k>>nr;
    long long midl=(n+1)/2;
    long long midc=(m+1)/2;
    long long nnr=(midl-1)*m+midc;
    h[nnr]=nroffishes(midl,midc);
    long long sol=0;
    q.push(nnr);
    while(nr)
    {
        long long val=q.top();
        sol+=h[val];
        punct poz=pozitie(val);
        q.pop();
        long long val1=val-1;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val+1;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val+m;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val-m;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        --nr;
    }
    long long hmv=(n-k+1)*(m-k+1);
    double avg=(0.0+sol)/(0.0+hmv);
    cout<<fixed<<setprecision(12)<<avg<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k,nr;
unordered_map<long long,long long>h;
struct cmp
{
    bool operator()(long long a, long long b)
    {
        return h[a]<h[b];
    }
};
priority_queue<long long,vector<int>,cmp>q;
struct punct
{
    int l,c;
};
punct p;
long long nroffishes(int l, int c)
{
    int lst=max(1,l-k+1);
    int cst=max(1,c-k+1);
    int ldr=min(n-k+1,l);
    int cdr=min(m-k+1,c);
    long long sol=1LL*(cdr-cst+1)*(ldr-lst+1);
    return sol;
}
punct pozitie(long long nr)
{
    punct sol;
    sol.c=nr%m;
    if(!sol.c){
        sol.c=m;
        sol.l=nr/m;
    }
    else
        sol.l=(nr/m)+1;
    return sol;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m>>k>>nr;
    long long midl=(n+1)/2;
    long long midc=(m+1)/2;
    long long nnr=(midl-1)*m+midc;
    h[nnr]=nroffishes(midl,midc);
    long long sol=0;
    q.push(nnr);
    while(nr)
    {
        long long val=q.top();
        sol+=h[val];
        punct poz=pozitie(val);
        q.pop();
        long long val1=val-1;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val+1;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val+m;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val-m;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        --nr;
    }
    long long hmv=(n-k+1)*(m-k+1);
    double avg=(0.0+sol)/(0.0+hmv);
    cout<<fixed<<setprecision(12)<<avg<<'\n';
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n,m,k,nr;
unordered_map<long long,long long>h;
struct cmp
{
    bool operator()(long long a, long long b)
    {
        return h[a]<h[b];
    }
};
priority_queue<long long,vector<int>,cmp>q;
struct punct
{
    int l,c;
};
punct p;
long long nroffishes(int l, int c)
{
    int lst=max(1,l-k+1);
    int cst=max(1,c-k+1);
    int ldr=min(n-k+1,l);
    int cdr=min(m-k+1,c);
    long long sol=1LL*(cdr-cst+1)*(ldr-lst+1);
    return sol;
}
punct pozitie(long long nr)
{
    punct sol;
    sol.c=nr%m;
    if(!sol.c){
        sol.c=m;
        sol.l=nr/m;
    }
    else
        sol.l=(nr/m)+1;
    return sol;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m>>k>>nr;
    int midl=(n+1)/2;
    int midc=(m+1)/2;
    long long nnr=(midl-1)*m+midc;
    h[nnr]=nroffishes(midl,midc);
    long long sol=0;
    q.push(nnr);
    while(nr)
    {
        long long val=q.top();
        sol+=h[val];
        punct poz=pozitie(val);
        q.pop();
        long long val1=val-1;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val+1;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val+m;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        val1=val-m;
        poz=pozitie(val1);
        if(!h[val1] && poz.l>=1 && poz.l<=n && poz.c>=1 && poz.c<=m)
        {
            long long x=nroffishes(poz.l,poz.c);
            h[val1]=x;
            q.push(val1);
        }
        --nr;
    }
    long long hmv=(n-k+1)*(m-k+1);
    double avg=(0.0+sol)/(0.0+hmv);
    cout<<fixed<<setprecision(12)<<avg<<'\n';
    return 0;
}


#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define PII pair <int,int>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000
using namespace std;

int n,m,r,k;
int getX(int x)
{
	return min(min(x,n-x+1),min(r,n-r+1));
}
int getY(int y)
{
	return min(min(y,m-y+1),min(r,m-r+1));
}
struct point
{
	int x,y;
	bool operator<(point p) const
	{
		return 1LL*getX(x)*getY(y) < 1LL*getX(p.x)*getY(p.y);
	}
};
double calc(int x,int y)
{
	return (1.0*getX(x)*getY(y))/((n-r+1)*(m-r+1));
}
void bfs(int x,int y)
{
	double ans;
	int tx,ty;
	int l[] = {0,0,1,-1};
	int r[] = {1,-1,0,0};
	priority_queue <point> pq;
	map <int,int> vis[N];
	point tmp;
	tmp.x = x;
	tmp.y = y;
	pq.push(tmp);
	vis[x][y] = 1;
	while(pq.size())
	{
		x = pq.top().x;
		y = pq.top().y;
		ans += calc(x,y);
		k--;
		// cout << x << " " << y << getX(x)*getY(y)<< "\n";
		if(k == 0)
			break;
		pq.pop();
		for (int i = 0; i < 4; ++i)
		{
			tx = x + l[i];
			ty = y + r[i];
			if(tx < n && ty < m && tx >= 0 && ty >= 0 && !vis[tx][ty])
			{
				tmp.x = tx;
				tmp.y = ty;
				pq.push(tmp);
				vis[tx][ty] = 1;
			}
		}

	}
	cout << fixed << ans << setprecision(9);
}
int main()
{
	cin >> n >> m >> r >> k;
	bfs((n+1)/2,(m+1)/2);
}


#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define PII pair <int,int>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000
using namespace std;

int n,m,r,k;
int getX(int x)
{
	return min(min(x,n-x+1),min(r,n-r+1));
}
int getY(int y)
{
	return min(min(y,m-y+1),min(r,m-r+1));
}
struct point
{
	int x,y;
	bool operator<(point p) const
	{
		return 1LL*getX(x)*getY(y) < 1LL*getX(p.x)*getY(p.y);
	}
};

void bfs(int x,int y)
{
	double ans;
	int tx,ty;
	int l[] = {0,0,1,-1};
	int t[] = {1,-1,0,0};
	priority_queue <point> pq;
	map <int,int> vis[N];
	point tmp;
	tmp.x = x;
	tmp.y = y;
	pq.push(tmp);
	vis[x][y] = 1;
	while(pq.size())
	{
		x = pq.top().x;
		y = pq.top().y;
		ans += (1.0*getX(x)/(n-r+1))*(1.0*getY(y)/(m-r+1));
		k--;
		// cout << x << " " << y << getX(x)*getY(y)<< "\n";
		if(k == 0)
			break;
		pq.pop();
		for (int i = 0; i < 4; ++i)
		{
			tx = x + l[i];
			ty = y + t[i];
			if(tx <= n && ty <= m && tx > 0 && ty > 0 && !vis[tx][ty])
			{
				tmp.x = tx;
				tmp.y = ty;
				pq.push(tmp);
				vis[tx][ty] = 1;
			}
		}

	}
	printf("%.10f\n", ans);
}
int main()
{
	cin >> n >> m >> r >> k;
	bfs((n+1)/2,(m+1)/2);
}


#include <iostream>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <utility>
#include <string.h>
#include <map>
#include <stack>
#include <iomanip>
#define ll long long
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define all(x) x.begin(),x.end()
#define PII pair <int,int>
#define N 100005
#define MOD 1000000007
#define INF 1000000000000000
using namespace std;

int n,m,r,k;
int getX(int x)
{
	return min(min(x,n-x+1),min(r,n-r+1));
}
int getY(int y)
{
	return min(min(y,m-y+1),min(r,m-r+1));
}
struct point
{
	int x,y;
	bool operator<(point p) const
	{
		return 1LL*getX(x)*getY(y) < 1LL*getX(p.x)*getY(p.y);
	}
};

void bfs(int x,int y)
{
	double ans;
	int tx,ty;
	int l[] = {0,0,1,-1};
	int t[] = {1,-1,0,0};
	priority_queue <point> pq;
	map <int,int> vis[N];
	point tmp;
	tmp.x = x;
	tmp.y = y;
	pq.push(tmp);
	vis[x][y] = 1;
	while(pq.size())
	{
		x = pq.top().x;
		y = pq.top().y;
		ans += (1.0*getX(x)/(n-r+1))*(1.0*getY(y)/(m-r+1));
		k--;
		// cout << x << " " << y << getX(x)*getY(y)<< "\n";
		if(k == 0)
			break;
		pq.pop();
		for (int i = 0; i < 4; ++i)
		{
			tx = x + l[i];
			ty = y + t[i];
			if(tx < n && ty < m && tx >= 0 && ty >= 0 && !vis[tx][ty])
			{
				tmp.x = tx;
				tmp.y = ty;
				pq.push(tmp);
				vis[tx][ty] = 1;
			}
		}

	}
	printf("%.10f\n", ans);
}
int main()
{
	cin >> n >> m >> r >> k;
	bfs((n+1)/2,(m+1)/2);
}


#include <bits/stdc++.h>
using namespace std;

int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
const int maxn = 1e5 + 10;

struct fish{
	int x, y, val;
	bool operator < (const fish &a) const{
		return val < a.val;
	}
	fish(int a, int b, int c) : x(a), y(b), val(c){}
	fish(){}
};

set<int> vis[maxn];
int main(){
	int n, m, r, k;
	priority_queue<fish> Q;
	scanf("%d%d%d%d", &n, &m, &r, &k);
	int x = (n+1)/2, y = (m+1)/2;
	int val = (min(n+1, x+r)-max(x, r)) * (min(m+1, y+r)-max(y, r));
	Q.push(fish(x, y, val));
	vis[x].insert(y);
	long long sum = 0;
	while(!Q.empty() && k > 0){
		k--;
		fish tmp = Q.top(); Q.pop();
		sum += tmp.val;
		for(int i = 0; i < 4; i++){
			fish f;
			f.x = tmp.x + dir[i][0];
			f.y = tmp.y + dir[i][1];
			if(f.x >= 1 && f.x <= n && f.y >= 1 && f.y <= m && !vis[f.x].count(f.y)){
				f.val = (min(n+1, f.x+r)-max(f.x, r)) * (min(m+1, f.y+r)-max(f.y, r));
				vis[f.x].insert(f.y);
				Q.push(f);
			}
		}
	}
	double ans = sum*1.0 / ((n-r+1)*(m-r+1));
	printf("%lf\n", ans);
}


#include <bits/stdc++.h>
using namespace std;

int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
const int maxn = 1e5 + 10;

struct fish{
	int x, y, val;
	bool operator < (const fish &a) const{
		return val < a.val;
	}
	fish(int a, int b, int c) : x(a), y(b), val(c){}
	fish(){}
};

set<int> vis[maxn];
int main(){
	int n, m, r, k;
	priority_queue<fish> Q;
	scanf("%d%d%d%d", &n, &m, &r, &k);
	int x = (n+1)/2, y = (m+1)/2;
	int val = (min(n+1, x+r)-max(x, r)) * (min(m+1, y+r)-max(y, r));
	Q.push(fish(x, y, val));
	vis[x].insert(y);
	long long sum = 0;
	while(!Q.empty() && k > 0){
		k--;
		fish tmp = Q.top(); Q.pop();
		sum += tmp.val;
		for(int i = 0; i < 4; i++){
			fish f;
			f.x = tmp.x + dir[i][0];
			f.y = tmp.y + dir[i][1];
			if(f.x >= 1 && f.x <= n && f.y >= 1 && f.y <= m && !vis[f.x].count(f.y)){
				f.val = (min(n+1, f.x+r)-max(f.x, r)) * (min(m+1, f.y+r)-max(f.y, r));
				vis[f.x].insert(f.y);
				Q.push(f);
			}
		}
	}
	double ans = sum*1.0 / ((n-r+1)*(m-r+1));
	printf("%.12lf\n", ans);
}


#include <bits/stdc++.h>
using namespace std;

int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
const int maxn = 1e5 + 10;

struct fish{
	int x, y, val;
	bool operator < (const fish &a) const{
		return val < a.val;
	}
	fish(int a, int b, int c) : x(a), y(b), val(c){}
	fish(){}
};

set<int> vis[maxn];
int main(){
	int n, m, r, k;
	priority_queue<fish> Q;
	scanf("%d%d%d%d", &n, &m, &r, &k);
	int x = (n+1)/2, y = (m+1)/2;
	int val = (min(n+1, x+r)-max(x, r)) * (min(m+1, y+r)-max(y, r));
	Q.push(fish(x, y, val));
	vis[x].insert(y);
	long long sum = 0;
	while(!Q.empty() && k > 0){
		k--;
		fish tmp = Q.top(); Q.pop();
		sum += tmp.val;
		for(int i = 0; i < 4; i++){
			fish f;
			f.x = tmp.x + dir[i][0];
			f.y = tmp.y + dir[i][1];
			if(f.x >= 1 && f.x <= n && f.y >= 1 && f.y <= m && !vis[f.x].count(f.y)){
				f.val = (min(n+1, f.x+r)-max(f.x, r)) * (min(m+1, f.y+r)-max(f.y, r));
				vis[f.x].insert(f.y);
				Q.push(f);
			}
		}
	}
	double ans = sum*1.0 / ((long long)(n-r+1)*(m-r+1));
	printf("%.12lf\n", ans);
}


#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
#include <vector>

using namespace std;

int f(int y, int x, int r, int n, int m) {
    return (min(n + 1, x + r) - max(x, r))
            * (min(m + 1, y + r) - max(y, r));
}

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);

    int n, m, r, k;
    cin >> n >> m >> r >> k;

    priority_queue<pair<int, pair<int, int> > > q;
    set<int> st;

    int y = (n + 1) / 2, x = (m + 1) / 2;
    q.push(make_pair(f(y, x, r, n, m), make_pair(y, x)));
    st.insert(y * m + x);

    int sum = 0;
    while (k) {
        pair<int, pair<int, int> > p = q.top(); q.pop();
        sum += p.first;
        k--;

        int pf = p.first, py = p.second.first, px = p.second.second;
        //cout << pf << " " << py << " " << px << "\n";

        if (py - 1 >= 0 && st.count((py - 1) * m + px) == 0) {
            q.push(make_pair(f(py - 1, px, r, n, m), make_pair(py - 1, px)));
            st.insert((py - 1) * m + px);
        }

        if (py + 1 < n && st.count((py + 1) * m + px) == 0) {
            q.push(make_pair(f(py + 1, px, r, n, m), make_pair(py + 1, px)));
            st.insert((py + 1) * m + px);
        }

        if (px - 1 >= 0 && st.count(py * m + px - 1) == 0) {
            q.push(make_pair(f(py, px - 1, r, n, m), make_pair(py, px - 1)));
            st.insert(py * m + px - 1);
        }

        if (px + 1 < m && st.count(py * m + px + 1) == 0) {
            q.push(make_pair(f(py, px + 1, r, n, m), make_pair(py, px + 1)));
            st.insert(py * m + px + 1);
        }
    }

    double ans = 1.0 * sum / ((n - r + 1) * (m - r + 1));
    printf("%0.10f\n", ans);

    return 0;
}


#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
#include <vector>

using namespace std;

int f(int y, int x, int r, int n, int m) {
    return (min(n + 1, x + r) - max(x, r))
            * (min(m + 1, y + r) - max(y, r));
}

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);

    int n, m, r, k;
    cin >> n >> m >> r >> k;

    priority_queue<pair<int, pair<int, int> > > q;
    set<int> st;

    int y = (n + 1) / 2, x = (m + 1) / 2;
    q.push(make_pair(f(y, x, r, n, m), make_pair(y, x)));
    st.insert(y * m + x);

    int sum = 0;
    while (k) {
        pair<int, pair<int, int> > p = q.top(); q.pop();
        sum += p.first;
        k--;

        int pf = p.first, py = p.second.first, px = p.second.second;
        //cout << pf << " " << py << " " << px << "\n";

        if (py - 1 > 0 && st.count((py - 1) * m + px) == 0) {
            q.push(make_pair(f(py - 1, px, r, n, m), make_pair(py - 1, px)));
            st.insert((py - 1) * m + px);
        }

        if (py + 1 <= n && st.count((py + 1) * m + px) == 0) {
            q.push(make_pair(f(py + 1, px, r, n, m), make_pair(py + 1, px)));
            st.insert((py + 1) * m + px);
        }

        if (px - 1 > 0 && st.count(py * m + px - 1) == 0) {
            q.push(make_pair(f(py, px - 1, r, n, m), make_pair(py, px - 1)));
            st.insert(py * m + px - 1);
        }

        if (px + 1 <= m && st.count(py * m + px + 1) == 0) {
            q.push(make_pair(f(py, px + 1, r, n, m), make_pair(py, px + 1)));
            st.insert(py * m + px + 1);
        }
    }

    double ans = 1.0 * sum / ((n - r + 1) * (m - r + 1));
    printf("%0.10f\n", ans);

    return 0;
}


#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
#include <vector>

using namespace std;

long long f(long long y, long long x, long long r, long long n, long long m) {
    return (min(m + 1, x + r) - max(x, r))
            * (min(n + 1, y + r) - max(y, r));
}

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);

    long long n, m, r, k;
    cin >> n >> m >> r >> k;

    priority_queue<pair<long long, pair<long long, long long> > > q;
    set<long long> st;

    int y = (n + 1) / 2, x = (m + 1) / 2;
    q.push(make_pair(f(y, x, r, n, m), make_pair(y, x)));
    st.insert(y * m + x);

    long long sum = 0;
    while (k) {
        pair<long long, pair<long long, long long> > p = q.top(); q.pop();
        sum += p.first;
        k--;

        long long pf = p.first, py = p.second.first, px = p.second.second;
        //cout << pf << " " << py << " " << px << "\n";

        if (py - 1 > 0 && st.count((py - 1) * m + px) == 0) {
            q.push(make_pair(f(py - 1, px, r, n, m), make_pair(py - 1, px)));
            st.insert((py - 1) * m + px);
        }

        if (py + 1 <= n && st.count((py + 1) * m + px) == 0) {
            q.push(make_pair(f(py + 1, px, r, n, m), make_pair(py + 1, px)));
            st.insert((py + 1) * m + px);
        }

        if (px - 1 > 0 && st.count(py * m + px - 1) == 0) {
            q.push(make_pair(f(py, px - 1, r, n, m), make_pair(py, px - 1)));
            st.insert(py * m + px - 1);
        }

        if (px + 1 <= m && st.count(py * m + px + 1) == 0) {
            q.push(make_pair(f(py, px + 1, r, n, m), make_pair(py, px + 1)));
            st.insert(py * m + px + 1);
        }
    }

    double ans = 1.0 * sum / ((n - r + 1) * (m - r + 1));
    printf("%0.10f\n", ans);

    return 0;
}


#include <iostream>
#include <queue>
#include <string>
#include <algorithm>
#include <math.h>
#include <set>
#include <vector>

using namespace std;

int f(int y, int x, int r, int n, int m) {
    return (min(m + 1, x + r) - max(x, r))
            * (min(n + 1, y + r) - max(y, r));
}

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(0);

    int n, m, r, k;
    cin >> n >> m >> r >> k;

    priority_queue<pair<int, pair<int, int> > > q;
    set<int> st;

    int y = (n + 1) / 2, x = (m + 1) / 2;
    q.push(make_pair(f(y, x, r, n, m), make_pair(y, x)));
    st.insert(y * m + x);

    int sum = 0;
    while (k) {
        pair<int, pair<int, int> > p = q.top(); q.pop();
        sum += p.first;
        k--;

        int pf = p.first, py = p.second.first, px = p.second.second;
        //cout << pf << " " << py << " " << px << "\n";

        if (py - 1 > 0 && st.count((py - 1) * m + px) == 0) {
            q.push(make_pair(f(py - 1, px, r, n, m), make_pair(py - 1, px)));
            st.insert((py - 1) * m + px);
        }

        if (py + 1 <= n && st.count((py + 1) * m + px) == 0) {
            q.push(make_pair(f(py + 1, px, r, n, m), make_pair(py + 1, px)));
            st.insert((py + 1) * m + px);
        }

        if (px - 1 > 0 && st.count(py * m + px - 1) == 0) {
            q.push(make_pair(f(py, px - 1, r, n, m), make_pair(py, px - 1)));
            st.insert(py * m + px - 1);
        }

        if (px + 1 <= m && st.count(py * m + px + 1) == 0) {
            q.push(make_pair(f(py, px + 1, r, n, m), make_pair(py, px + 1)));
            st.insert(py * m + px + 1);
        }
    }

    double ans = 1.0 * sum / ((n - r + 1) * (m - r + 1));
    printf("%0.10f\n", ans);

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
const int INF=2147483647;
const int mod=1e9+7;
int a[100005],b[100005];
long long c[100005];
int main(){
	int n,m,r,k;
	scanf("%d%d%d%d",&n,&m,&r,&k);
	for(int i=1;i<=n;i++){
		a[min(n-r+1,i)-max(1,i-r+1)+1]++;
	}
	for(int i=1;i<=m;i++){
		b[min(m-r+1,i)-max(1,i-r+1)+1]++;
	}
	for(int i=r;i>=1;i--){
		c[i]=(long long)b[i]*i;
		c[i]+=c[i+1];
	}
	for(int i=r;i>=1;i--) b[i]+=b[i+1];
	long long L=1,R=(long long)r*r;
	while(L<R){
		long long M=(L+R+1)/2;
		long long cnt=0;
		for(int i=1;i<=r;i++){
			if((M+i-1)/i<=r) cnt+=(long long)a[i]*b[(M+i-1)/i];
		}
		if(cnt<k) R=M-1;
		else L=M;
	}
	long long ans=0,cnt=0;
	for(int i=1;i<=r;i++){
		if((L+i-1)/i<=r) ans+=c[(L+i-1)/i]*a[i]*i,cnt+=(long long)a[i]*b[(L+i-1)/i];
	}
	ans-=L*(cnt-k);
	cout<<fixed<<setprecision(10)<<(long double)ans*1.0/(n-r+1)/(m-r+1)<<'\n';
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
const int INF=2147483647;
const int mod=1e9+7;
int a[100005],b[100005];
long long c[100005];
int main(){
	int n,m,r,k;
	scanf("%d%d%d%d",&n,&m,&r,&k);
	for(int i=1;i<=n;i++){
		a[min(n-r+1,i)-max(1,i-r+1)+1]++;
	}
	for(int i=1;i<=m;i++){
		b[min(m-r+1,i)-max(1,i-r+1)+1]++;
	}
	for(int i=r;i>=1;i--){
		c[i]=(long long)b[i]*i;
		c[i]+=c[i+1];
	}
	for(int i=r;i>=1;i--) b[i]+=b[i+1];
	long long L=1,R=(long long)r*r;
	while(L<R){
		long long M=(L+R+1)/2;
		long long cnt=0;
		for(int i=1;i<=r;i++){
			if((M+i-1)/i<=r) cnt+=(long long)a[i]*b[(M+i-1)/i];
		}
		if(cnt<k) R=M-1;
		else L=M;
	}
	long long ans=0,cnt=0;
	for(int i=1;i<=r;i++){
		if((L+i-1)/i<=r) ans+=c[(L+i-1)/i]*a[i]*i,cnt+=(long long)a[i]*b[(L+i-1)/i];
	}
	ans-=L*(cnt-k);
	printf("%lf\n",ans*1.0/(n-r+1)/(m-r+1));
	return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
using namespace std;
const int INF=2147483647;
const int mod=1e9+7;
int a[100005],b[100005];
long long c[100005];
int main(){
	int n,m,r,k;
	scanf("%d%d%d%d",&n,&m,&r,&k);
	for(int i=1;i<=n;i++){
		a[min(n-r+1,i)-max(1,i-r+1)+1]++;
	}
	for(int i=1;i<=m;i++){
		b[min(m-r+1,i)-max(1,i-r+1)+1]++;
	}
	for(int i=r;i>=1;i--){
		c[i]=(long long)b[i]*i;
		c[i]+=c[i+1];
	}
	for(int i=r;i>=1;i--) b[i]+=b[i+1];
	long long L=1,R=(long long)r*r;
	while(L<R){
		long long M=(L+R+1)/2;
		long long cnt=0;
		for(int i=1;i<=r;i++){
			if((M+i-1)/i<=r) cnt+=(long long)a[i]*b[(M+i-1)/i];
		}
		if(cnt<k) R=M-1;
		else L=M;
	}
	long long ans=0,cnt=0;
	for(int i=1;i<=r;i++){
		if((L+i-1)/i<=r) ans+=c[(L+i-1)/i]*a[i]*i,cnt+=(long long)a[i]*b[(L+i-1)/i];
	}
	ans-=L*(cnt-k);
	cout<<(long double)ans*1.0/(n-r+1)/(m-r+1)<<'\n';
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl
#define fori(i,b,e) for (int i = (b); i < (e); ++i)
#define mod(x,m) ((((x) % (m)) + (m)) % (m))
#define sq(x) (x) * (x)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ii> iii;

const int oo = 1e9;

int n, m, r, k;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

ll f(ii pos) {
	int x = pos.first, y = pos.second;
	return (1LL * (min(n + 1, x + r) - max(r, x))) * (1LL * (min(m + 1, y + r) - max(r, y)));
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> r >> k;
	priority_queue< iii > pq;
	set<ii> used;
	ii init = ii((n + 1) / 2, (m + 1) / 2);
	pq.push(iii(f(init), init));
	used.insert(init);
	ll acc = 0;
	while (k--) {
		iii top = pq.top(); pq.pop();
		ll w = top.first;
		ii pos = top.second;
		acc += w;
		fori(i, 0, 4) {
			ii new_pos = ii(pos.first + dx[i], pos.second + dy[i]);
			if (used.find(new_pos) == used.end()) {
				pq.push(iii(f(new_pos), new_pos));
				used.insert(new_pos);
			}
		}
	}
	double ans = (double)acc / ((1LL * (n - r + 1)) * (1LL * (m - r + 1)));
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl
#define fori(i,b,e) for (int i = (b); i < (e); ++i)
#define mod(x,m) ((((x) % (m)) + (m)) % (m))
#define sq(x) (x) * (x)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ii> iii;

const int oo = 1e9;

int n, m, r, k;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

ll f(ii pos) {
	int x = pos.first, y = pos.second;
	return (1LL * (min(n + 1, x + r) - max(r, x))) * (1LL * (min(m + 1, y + r) - max(r, y)));
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> r >> k;
	priority_queue< iii > pq;
	set<ii> used;
	ii init = ii((n + 1) / 2, (m + 1) / 2);
	pq.push(iii(f(init), init));
	used.insert(init);
	ll acc = 0;
	while (k--) {
		iii top = pq.top(); pq.pop();
		ll w = top.first;
		ii pos = top.second;
		acc += w;
		fori(i, 0, 4) {
			ii new_pos = ii(pos.first + dx[i], pos.second + dy[i]);
			if (used.find(new_pos) == used.end()) {
				pq.push(iii(f(new_pos), new_pos));
				used.insert(new_pos);
			}
		}
	}
	double ans = (double)acc * (1.0 / ((n - r + 1) * (m - r + 1)));
	cout << fixed << setprecision(6) << ans << endl;
	return 0;
}


#include <bits/stdc++.h>
#define endl '\n'
#define debug(X) cout << #X << " = " << X << endl
#define fori(i,b,e) for (int i = (b); i < (e); ++i)
#define mod(x,m) ((((x) % (m)) + (m)) % (m))
#define sq(x) (x) * (x)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef pair<ll, ii> iii;

const int oo = 1e9;

int n, m, r, k;
int dx[] = {-1, 0, 1, 0};
int dy[] = {0, -1, 0, 1};

ll f(ii pos) {
	int x = pos.first, y = pos.second;
	return (1LL * (min(n + 1, x + r) - max(r, x))) * (1LL * (min(m + 1, y + r) - max(r, y)));
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> n >> m >> r >> k;
	priority_queue< iii > pq;
	set<ii> used;
	ii init = ii((n + 1) / 2, (m + 1) / 2);
	pq.push(iii(f(init), init));
	used.insert(init);
	ll acc = 0;
	while (k--) {
		iii top = pq.top(); pq.pop();
		ll w = top.first;
		ii pos = top.second;
		acc += w;
		fori(i, 0, 4) {
			ii new_pos = ii(pos.first + dx[i], pos.second + dy[i]);
			if (used.find(new_pos) == used.end()) {
				pq.push(iii(f(new_pos), new_pos));
				used.insert(new_pos);
			}
		}
	}
	double ans = (double)acc * (1.0 / ((n - r + 1) * (m - r + 1)));
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <iomanip>
#include <map>

using namespace std;

const int MAXN = 100000;
const int MAXM = 100000;

struct cmp
{
    bool operator()(pair<int, int> a, pair<int, int> b)
    {
        return a.first * a.second < b.first * b.second;
    }
};

int n, m, r, k;
double s;
int ct;
priority_queue< pair<int, int>, vector< pair<int, int> >, cmp> pq;
map< pair<int, int>, int > vis;

int main() {
	cin >> n >> m >> r >> k;
	int maxx = min(r, n - r + 1);
	int maxy = min(r, m - r + 1);
	int ctx = n - 2 * maxx + 2;
	int cty = m - 2 * maxy + 2;
	vis[make_pair(maxx, maxy)] = 1;
	pq.push(make_pair(maxx, maxy));
	while(ct < k) {
		pair<int, int> p = pq.top();
		pq.pop();
		int ctp;
		if(p.first == maxx && p.second == maxy) ctp = cty * ctx;
		else if(p.first == maxx) ctp = 2 * ctx;
		else if(p.second == maxy) ctp = 2 * cty;
		else ctp = 4;

		if(ct + ctp >= k) {
			s += (k - ct) * p.first * p.second;
			double ans = s / (double) (n - r + 1) / (double) (m - r + 1);
			cout << setprecision(15) << ans << endl;
			return 0;
		}
		s += ctp * p.first * p.second;
		ct += ctp;
		if(!vis[make_pair(p.first - 1, p.second)]) {
			pq.push(make_pair(p.first - 1, p.second));
			vis[make_pair(p.first - 1, p.second)] = 1;
		}
		if(!vis[make_pair(p.first, p.second - 1)]) {
			pq.push(make_pair(p.first, p.second - 1));
			vis[make_pair(p.first, p.second - 1)] = 1;
		}
	}
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <iomanip>
#include <map>

using namespace std;

const int MAXN = 100000;
const int MAXM = 100000;

struct cmp
{
    bool operator()(pair<double, double> a, pair<double, double> b)
    {
        return a.first * a.second < b.first * b.second;
    }
};

int n, m, r, k;
long double s;
double ct;
priority_queue< pair<double, double>, vector< pair<double, double> >, cmp> pq;
map< pair<double, double>, int > vis;

int main() {
	cin >> n >> m >> r >> k;
	double maxx = min(r, n - r + 1);
	double maxy = min(r, m - r + 1);
	double ctx = n - 2 * maxx + 2;
	double cty = m - 2 * maxy + 2;
	vis[make_pair(maxx, maxy)] = 1;
	pq.push(make_pair(maxx, maxy));
	while(ct < k) {
		pair<double, double> p = pq.top();
		pq.pop();
		double ctp;
		if(p.first == maxx && p.second == maxy) ctp = cty * ctx;
		else if(p.first == maxx) ctp = 2 * ctx;
		else if(p.second == maxy) ctp = 2 * cty;
		else ctp = 4;

		if(ct + ctp >= k) {
			s += (k - ct) * p.first * p.second;
			cout << s << endl;
			long double ans = s / (long double) (n - r + 1) / (long double) (m - r + 1);
			cout << setprecision(15) << ans << endl;
			return 0;
		}
		s += ctp * p.first * p.second;
		ct += ctp;
		if(!vis[make_pair(p.first - 1, p.second)]) {
			pq.push(make_pair(p.first - 1, p.second));
			vis[make_pair(p.first - 1, p.second)] = 1;
		}
		if(!vis[make_pair(p.first, p.second - 1)]) {
			pq.push(make_pair(p.first, p.second - 1));
			vis[make_pair(p.first, p.second - 1)] = 1;
		}
	}
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <iomanip>
#include <map>

using namespace std;

const int MAXN = 100000;
const int MAXM = 100000;

struct cmp
{
    bool operator()(pair<double, double> a, pair<double, double> b)
    {
        return a.first * a.second < b.first * b.second;
    }
};

int n, m, r, k;
long double s;
double ct;
priority_queue< pair<double, double>, vector< pair<double, double> >, cmp> pq;
map< pair<double, double>, int > vis;

int main() {
	cin >> n >> m >> r >> k;
	double maxx = min(r, n - r + 1);
	double maxy = min(r, m - r + 1);
	double ctx = n - 2 * maxx + 2;
	double cty = m - 2 * maxy + 2;
	vis[make_pair(maxx, maxy)] = 1;
	pq.push(make_pair(maxx, maxy));
	while(ct < k) {
		pair<double, double> p = pq.top();
		pq.pop();
		double ctp;
		if(p.first == maxx && p.second == maxy) ctp = cty * ctx;
		else if(p.first == maxx) ctp = 2 * ctx;
		else if(p.second == maxy) ctp = 2 * cty;
		else ctp = 4;

		if(ct + ctp >= k) {
			s += (k - ct) * p.first * p.second;
			long double ans = s / (long double) (n - r + 1) / (long double) (m - r + 1);
			cout << setprecision(15) << ans << endl;
			return 0;
		}
		s += ctp * p.first * p.second;
		ct += ctp;
		if(!vis[make_pair(p.first - 1, p.second)]) {
			pq.push(make_pair(p.first - 1, p.second));
			vis[make_pair(p.first - 1, p.second)] = 1;
		}
		if(!vis[make_pair(p.first, p.second - 1)]) {
			pq.push(make_pair(p.first, p.second - 1));
			vis[make_pair(p.first, p.second - 1)] = 1;
		}
	}
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <iomanip>
#include <map>

using namespace std;

const int MAXN = 100000;
const int MAXM = 100000;

struct cmp
{
    bool operator()(pair<int, int> a, pair<int, int> b)
    {
        return a.first * a.second < b.first * b.second;
    }
};

int n, m, r, k;
double s;
int ct;
priority_queue< pair<int, int>, vector< pair<int, int> >, cmp> pq;
map< pair<int, int>, int > vis;

int main() {
	cin >> n >> m >> r >> k;
	int maxx = min(r, n - r + 1);
	int maxy = min(r, m - r + 1);
	int ctx = n - 2 * maxx + 2;
	int cty = m - 2 * maxy + 2;
	vis[make_pair(maxx, maxy)] = 1;
	pq.push(make_pair(maxx, maxy));
	while(ct < k) {
		pair<int, int> p = pq.top();
		pq.pop();
		int ctp;
		if(p.first == maxx && p.second == maxy) ctp = cty * ctx;
		else if(p.first == maxx) ctp = 2 * ctx;
		else if(p.second == maxy) ctp = 2 * cty;
		else ctp = 4;

		if(ct + ctp >= k) {
			s += (k - ct) * p.first * p.second;
			cout << setprecision(10) << s / (n - r + 1) / (m - r + 1) << endl;
			return 0;
		}
		s += ctp * p.first * p.second;
		ct += ctp;
		cout << p.first << " " << p.second << " " << ctp << endl;
		if(!vis[make_pair(p.first - 1, p.second)]) {
			pq.push(make_pair(p.first - 1, p.second));
			vis[make_pair(p.first - 1, p.second)] = 1;
		}
		if(!vis[make_pair(p.first, p.second - 1)]) {
			pq.push(make_pair(p.first, p.second - 1));
			vis[make_pair(p.first, p.second - 1)] = 1;
		}
	}
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,N,st,rt,timer=0,ind=0,dg[1<<18],oh[1<<18],ind2;
vector <int> g[1<<18],used,H,w[1<<18],tin,tout,Size;
int leaves,ise,sami,ase,pasi;
void ok(){
    used.resize(0);
    used.resize(N+1,0);
}
vector <int> ori;
int rt1,rt2;
void DFS1(int v,int h){
    used[v]=1;
    H[v]=h;
    if(ind)
    w[h].push_back(v);
    if(H[v]>H[st])
        st=v;
        if(ind)
            tin[v]=timer++;
    for(int k=0;k<g[v].size();k++){
        int to=g[v][k];
    if(used[to]==0)
        DFS1(to,h+1);
    }
if(ind)
    tout[v]=timer++;
}
void DFS2(int v,int p){
    used[v]=1;
    Size[v]=1;
    for(int k=0;k<g[v].size();k++){
       if(used[g[v][k]]==0)
            DFS2(g[v][k],v);
    }
    Size[p]+=Size[v];
}
bool yes(int a,int b){
   if(tin[a]<=tin[b] && tout[a]>=tout[b])
        return true;
   return false;
}
void check(int v){
    if(g[v].size()==3)
        sami++;
    if(g[v].size()==1)
        leaves++;
    if(g[v].size()==2){
        ise++;
        ori.push_back(v);
    }
        if(g[v].size()==4){
            ase++;
            pasi=v;
        }
        used[v]=1;
        for(int k=0;k<g[v].size();k++){
            int to=g[v][k];
            if(used[to]==0)
                check(to);
        }
}
void axla(int v,int h){
    used[v]=1;
    if(Size[v]!=(1<<(n-h))-1 && !yes(v,pasi) && !yes(pasi,v))
        ind2=1;

    for(int k=0;k<g[v].size();k++)
        if(used[g[v][k]]==0)
        axla(g[v][k],h+1);
}
void cotac(int v,int h){
    used[v]=1;
    if(Size[v]!=(1<<(n-h-1))-1)
        ind2=1;
    for(int k=0;k<g[v].size();k++)
        if(used[g[v][k]]==0)
        cotac(g[v][k],h+1);
}
main(){
cin>>n;
 N=1<<n;
N--;
m=N-2;

for(int k=1;k<=m;k++){
int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);
dg[a]++;
dg[b]++;
}
st=0;
tout.resize(N+1,0);
tin.resize(N+1,0);
H.resize(N+1,0);
ok();
DFS1(1,0);
ind=1;
H.resize(0);
H.resize(N+1,0);
ok();
DFS1(st,0);
if(H[st]%2==0){
  for(int k=0;k<w[H[st]/2].size();k++){
  if(yes(w[H[st]/2][k],st)){
    rt=w[H[st]/2][k];
    break;
  }
  }
ok();
 check(rt);
int leaf=(1<<(n-1));
if(dg[rt]==2){
if(leaves+ase+ise+sami==N-1){
        if(pasi==22328)
        cout<<dg[pasi];
if(leaf==leaves+1){
   if(ise==2 && ase==0 && sami==N-leaf-2){
    cout<<1<<endl<<ori[1];
    return 0;
   }
}
else
if(leaf==leaves){
    if(ase==1 && ise==1 && sami==N-leaf-3){
                    Size.resize(0);
        Size.resize(N+1,0);
ok();
DFS2(rt,0);
ok();
axla(rt,0);
if(ind2)
    cout<<0;
else cout<<1<<endl<<pasi;
        return 0;
    }
}
}
}
cout<<0;
return 0;
}
else{
    for(int k=0;k<w[H[st]/2].size();k++){
  if(yes(w[H[st]/2][k],st)){
    rt1=w[H[st]/2][k];
    break;
  }
  }
    for(int k=0;k<w[H[st]/2+1].size();k++){
  if(yes(w[H[st]/2+1][k],st)){
    rt2=w[H[st]/2+1][k];
    break;
  }
  }
ok();
check(rt1);

int leaf=(1<<(n-1));
if(leaves==leaf && ise==0 && ase==0 && sami==N-1-leaf){
        ok();
        Size.resize(0);
        Size.resize(N+1,0);
        used[rt2]=1;
        DFS2(rt1,0);
        ok();
        used[rt2]=1;
        cotac(rt1,0);
            ok();
                 Size.resize(0);
        Size.resize(N+1,0);
        used[rt1]=1;
        DFS2(rt2,0);
        ok();
        used[rt1]=1;
        cotac(rt2,0);
        if(!ind2){
   cout<<2<<endl<<min(rt1,rt2)<<' '<<max(rt1,rt2);
   return 0;
        }
}
cout<<0;
return 0;
}

 return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,N,st,rt,timer=0,ind=0,dg[1<<18],oh[1<<18],ind2;
vector <int> g[1<<18],used,H,w[1<<18],tin,tout,Size;
int leaves,ise,sami,ase,pasi;
void ok(){
    used.resize(0);
    used.resize(N+1,0);
}
vector <int> ori;
int rt1,rt2;
void DFS1(int v,int h){
    used[v]=1;
    H[v]=h;
    if(ind)
    w[h].push_back(v);
    if(H[v]>H[st])
        st=v;
        if(ind)
            tin[v]=timer++;
    for(int k=0;k<g[v].size();k++){
        int to=g[v][k];
    if(used[to]==0)
        DFS1(to,h+1);
    }
if(ind)
    tout[v]=timer++;
}
void DFS2(int v,int p){
    used[v]=1;
    Size[v]=1;
    for(int k=0;k<g[v].size();k++){
       if(used[g[v][k]]==0)
            DFS2(g[v][k],v);
    }
    Size[p]+=Size[v];
}
bool yes(int a,int b){
   if(tin[a]<=tin[b] && tout[a]>=tout[b])
        return true;
   return false;
}
void check(int v){
    if(g[v].size()==3)
        sami++;
    if(g[v].size()==1)
        leaves++;
    if(g[v].size()==2){
        ise++;
        ori.push_back(v);
    }
        if(g[v].size()==4){
            ase++;
            pasi=v;
        }
        used[v]=1;
        for(int k=0;k<g[v].size();k++){
            int to=g[v][k];
            if(used[to]==0)
                check(to);
        }
}
void axla(int v,int h){
    used[v]=1;
    if(Size[v]!=(1<<(n-h))-1 && !yes(v,pasi) && !yes(pasi,v))
        ind2=1;

    for(int k=0;k<g[v].size();k++)
        if(used[g[v][k]]==0)
        axla(g[v][k],h+1);
}
void cotac(int v,int h){
    used[v]=1;
    if(Size[v]!=(1<<(n-h-1))-1)
        ind2=1;
    for(int k=0;k<g[v].size();k++)
        if(used[g[v][k]]==0)
        cotac(g[v][k],h+1);
}
main(){
cin>>n;
 N=1<<n;
N--;
m=N-2;

for(int k=1;k<=m;k++){
int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);
dg[a]++;
dg[b]++;
}
st=0;
tout.resize(N+1,0);
tin.resize(N+1,0);
H.resize(N+1,0);
ok();
DFS1(1,0);
ind=1;
H.resize(0);
H.resize(N+1,0);
ok();
DFS1(st,0);
if(H[st]%2==0){
  for(int k=0;k<w[H[st]/2].size();k++){
  if(yes(w[H[st]/2][k],st)){
    rt=w[H[st]/2][k];
    break;
  }
  }
ok();
 check(rt);
int leaf=(1<<(n-1));
if(dg[rt]==2){
if(leaves+ase+ise+sami==N-1){
        if(pasi==22328)
        cout<<dg[pasi]<<' '<<1/0;
if(leaf==leaves+1){
   if(ise==2 && ase==0 && sami==N-leaf-2){
    cout<<1<<endl<<ori[1];
    return 0;
   }
}
else
if(leaf==leaves){
    if(ase==1 && ise==1 && sami==N-leaf-3){
                    Size.resize(0);
        Size.resize(N+1,0);
ok();
DFS2(rt,0);
ok();
axla(rt,0);
if(ind2)
    cout<<0;
else cout<<1<<endl<<pasi;
        return 0;
    }
}
}
}
cout<<0;
return 0;
}
else{
    for(int k=0;k<w[H[st]/2].size();k++){
  if(yes(w[H[st]/2][k],st)){
    rt1=w[H[st]/2][k];
    break;
  }
  }
    for(int k=0;k<w[H[st]/2+1].size();k++){
  if(yes(w[H[st]/2+1][k],st)){
    rt2=w[H[st]/2+1][k];
    break;
  }
  }
ok();
check(rt1);

int leaf=(1<<(n-1));
if(leaves==leaf && ise==0 && ase==0 && sami==N-1-leaf){
        ok();
        Size.resize(0);
        Size.resize(N+1,0);
        used[rt2]=1;
        DFS2(rt1,0);
        ok();
        used[rt2]=1;
        cotac(rt1,0);
            ok();
                 Size.resize(0);
        Size.resize(N+1,0);
        used[rt1]=1;
        DFS2(rt2,0);
        ok();
        used[rt1]=1;
        cotac(rt2,0);
        if(!ind2){
   cout<<2<<endl<<min(rt1,rt2)<<' '<<max(rt1,rt2);
   return 0;
        }
}
cout<<0;
return 0;
}

 return 0;
}
/*
3
1 2
2 4
2 5
7 1
6 1
*/


#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,m,N,st,rt,timer=0,ind=0,dg[1<<18],oh[1<<18];
vector <int> g[1<<18],used,H,w[1<<18],tin,tout,Size;
int leaves,ise,sami,ase,pasi;
void ok(){
    used.resize(0);
    used.resize(N+1,0);
}
vector <int> ori;
int rt1,rt2;
void DFS1(int v,int h){
    used[v]=1;
    H[v]=h;
    if(ind)
    w[h].push_back(v);
    if(H[v]>H[st])
        st=v;
        if(ind)
            tin[v]=timer++;
    for(int k=0;k<g[v].size();k++){
        int to=g[v][k];
    if(used[to]==0)
        DFS1(to,h+1);
    }
if(ind)
    tout[v]=timer++;
}
void DFS2(int v,int p){
    used[v]=1;
    Size[v]=1;
    for(int k=0;k<g[v].size();k++){
       if(used[g[v][k]]==0)
            DFS2(g[v][k],v);
    }
    Size[p]+=Size[v];
}
bool yes(int a,int b){
   if(tin[a]<=tin[b] && tout[a]>=tout[b])
        return true;
   return false;
}
void check(int v){
    if(g[v].size()==3)
        sami++;
    if(g[v].size()==1)
        leaves++;
    if(g[v].size()==2){
        ise++;
        ori.push_back(v);
    }
        if(g[v].size()==4){
            ase++;
            pasi=v;
        }
        used[v]=1;
        for(int k=0;k<g[v].size();k++){
            int to=g[v][k];
            if(used[to]==0)
                check(to);
        }
}
int ind2=0;
void axla(int v,int h){
    used[v]=1;
    if(Size[v]!=(1<<(n-h))-1 && !yes(v,pasi) && !yes(pasi,v))
        ind2=1;
        if(yes(pasi,v)){
        if(Size[v]!=(1<<(n-h+1))-1)
        ind2=1;
        }
    for(int k=0;k<g[v].size();k++)
        if(used[g[v][k]]==0)
        axla(g[v][k],h+1);
}
void cotac(int v,int h){
    used[v]=1;
    if(Size[v]!=(1<<(n-h-1))-1)
        ind2=1;
    for(int k=0;k<g[v].size();k++)
        if(used[g[v][k]]==0)
        cotac(g[v][k],h+1);
}
main(){
cin>>n;
 N=1<<n;
N--;
m=N-2;

for(int k=1;k<=m;k++){
int a,b;
cin>>a>>b;
g[a].push_back(b);
g[b].push_back(a);
dg[a]++;
dg[b]++;
}
st=0;
tout.resize(N+1,0);
tin.resize(N+1,0);
H.resize(N+1,0);
ok();
DFS1(1,0);
ind=1;
H.resize(0);
H.resize(N+1,0);
ok();
DFS1(st,0);
if(H[st]%2==0){
  for(int k=0;k<w[H[st]/2].size();k++){
  if(yes(w[H[st]/2][k],st)){
    rt=w[H[st]/2][k];
    break;
  }
  }
ok();
 check(rt);
int leaf=(1<<(n-1));
if(dg[rt]==2){
if(leaves+ase+ise+sami==N-1){
if(leaf==leaves+1){
   if(ise==2 && ase==0 && sami==N-leaf-2){
    cout<<1<<endl<<ori[1];
    return 0;
   }
}
else
if(leaf==leaves){
    if(ase==1 && ise==1 && sami==N-leaf-3){
            Size.resize(N+1,0);
ok();
DFS2(rt,0);
ok();
axla(rt,0);
if(ind2)
    cout<<0;
else cout<<1<<endl<<pasi;
        return 0;
    }
}
}
}
cout<<0;
return 0;
}
else{
    for(int k=0;k<w[H[st]/2].size();k++){
  if(yes(w[H[st]/2][k],st)){
    rt1=w[H[st]/2][k];
    break;
  }
  }
    for(int k=0;k<w[H[st]/2+1].size();k++){
  if(yes(w[H[st]/2+1][k],st)){
    rt2=w[H[st]/2+1][k];
    break;
  }
  }
ok();
check(rt1);

int leaf=(1<<(n-1));
if(leaves==leaf && ise==0 && ase==0 && sami==N-1-leaf){
        ok();
        Size.resize(0);
        Size.resize(N+1,0);
        used[rt2]=1;
        DFS2(rt1,0);
        ok();
        used[rt2]=1;
        cotac(rt1,0);
            ok();
                 Size.resize(0);
        Size.resize(N+1,0);
        used[rt1]=1;
        DFS2(rt2,0);
        ok();
        used[rt1]=1;
        cotac(rt2,0);
        if(!ind2){
   cout<<2<<endl<<min(rt1,rt2)<<' '<<max(rt1,rt2);
   return 0;
        }
}
cout<<0;
return 0;
}

 return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef double db;
typedef string str;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<ld> vd;
typedef vector<str> vs;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
#define rsz resize
#define ins insert

#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1e9+7; // 998244353; // = (119<<23)+1
const int MX = 2e5+5;
const ll INF = 1e18;
const ld PI = 4*atan((ld)1);

template<class T> bool ckmin(T& a, const T& b) {
	return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) {
	return a < b ? a = b, 1 : 0; }

mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());

namespace input {
	template<class T> void re(complex<T>& x);
	template<class T1, class T2> void re(pair<T1,T2>& p);
	template<class T> void re(vector<T>& a);
	template<class T, size_t SZ> void re(array<T,SZ>& a);

	template<class T> void re(T& x) { cin >> x; }
	void re(double& x) { string t; re(t); x = stod(t); }
	void re(ld& x) { string t; re(t); x = stold(t); }
	template<class T, class... Ts> void re(T& t, Ts&... ts) {
		re(t); re(ts...);
	}

	template<class T> void re(complex<T>& x) { T a,b; re(a,b); x = cd(a,b); }
	template<class T1, class T2> void re(pair<T1,T2>& p) { re(p.f,p.s); }
	template<class T> void re(vector<T>& a) { F0R(i,sz(a)) re(a[i]); }
	template<class T, size_t SZ> void re(array<T,SZ>& a) { F0R(i,SZ) re(a[i]); }
}

using namespace input;

namespace output {
	void pr(int x) { cout << x; }
	void pr(long x) { cout << x; }
	void pr(ll x) { cout << x; }
	void pr(unsigned x) { cout << x; }
	void pr(unsigned long x) { cout << x; }
	void pr(unsigned long long x) { cout << x; }
	void pr(float x) { cout << x; }
	void pr(double x) { cout << x; }
	void pr(ld x) { cout << x; }
	void pr(char x) { cout << x; }
	void pr(const char* x) { cout << x; }
	void pr(const string& x) { cout << x; }
	void pr(bool x) { pr(x ? "true" : "false"); }
	template<class T> void pr(const complex<T>& x) { cout << x; }

	template<class T1, class T2> void pr(const pair<T1,T2>& x);
	template<class T> void pr(const T& x);

	template<class T, class... Ts> void pr(const T& t, const Ts&... ts) {
		pr(t); pr(ts...);
	}
	template<class T1, class T2> void pr(const pair<T1,T2>& x) {
		pr("{",x.f,", ",x.s,"}");
	}
	template<class T> void pr(const T& x) {
		pr("{"); // const iterator needed for vector<bool>
		bool fst = 1; for (const auto& a: x) pr(!fst?", ":"",a), fst = 0;
		pr("}");
	}

	void ps() { pr("\n"); } // print w/ spaces
	template<class T, class... Ts> void ps(const T& t, const Ts&... ts) {
		pr(t); if (sizeof...(ts)) pr(" "); ps(ts...);
	}

	void pc() { pr("]\n"); } // debug w/ commas
	template<class T, class... Ts> void pc(const T& t, const Ts&... ts) {
		pr(t); if (sizeof...(ts)) pr(", "); pc(ts...);
	}
	#define dbg(x...) pr("[",#x,"] = ["), pc(x);
}

using namespace output;

namespace io {
	void setIn(string s) { freopen(s.c_str(),"r",stdin); }
	void setOut(string s) { freopen(s.c_str(),"w",stdout); }
	void setIO(string s = "") {
		cin.sync_with_stdio(0); cin.tie(0); // fast I/O
		// cin.exceptions(cin.failbit); // ex. throws exception when you try to read letter into int
		if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
	}
}

using namespace io;

template<int SZ> struct TreeDiameter {
	int n;
	vi adj[SZ];
	void addEdge(int a, int b) { adj[a].pb(b), adj[b].pb(a); }
	int par[SZ], dist[SZ];
	void dfs(int x) {
		trav(y,adj[x]) if (y != par[x]) {
			par[y] = x; dist[y] = dist[x]+1;
			dfs(y);
		}
	}
	void genDist(int x) { par[x] = -1; dist[x] = 0; dfs(x); }
	int diaLen;
	vi center, dia = {1,1};
	void init(int _n) {
		n = _n; // find one endpoint of a diameter
		genDist(1); FOR(i,1,n+1) if (dist[i] > dist[dia[0]]) dia[0] = i;
		genDist(dia[0]); FOR(i,1,n+1) if (dist[i] > dist[dia[1]]) dia[1] = i;
		diaLen = dist[dia[1]];
		int cen = dia[1]; F0R(i,diaLen/2) cen = par[cen];
		if (diaLen&1) center = {cen,par[cen]};
		else center = {cen};
	}
};

TreeDiameter<MX> T;
int n, dist[MX], par[MX];
set<int> ans, leafDist[MX];

void dfs(int a) {
	dist[a] = 0;
	trav(t,T.adj[a]) if (t != par[a]) {
		par[t] = a; dfs(t);
		ckmax(dist[a],dist[t]+1);
	}
}

bool check(int t, int b, int dis) {
	if (dis == 0) return sz(T.adj[t]) == 1;
	if (t != b) {
		int child = 0;
		trav(c,T.adj[t]) if (c != par[t]) {
			child ++;
			if (!check(c,b,dis-1)) return 0;
		}
		if (child != 2) return 0;
	} else {
		vpi v;
		trav(c,T.adj[t]) if (c != par[t]) {
			v.pb({dist[c],c});
		}
		sort(all(v));
		if (dis > 1) {
			return sz(v) == 3 && check(v[0].s,b,dis-2)
			&& check(v[1].s,b,dis-2)
			&& check(v[2].s,b,dis-1);
		} else {
			return sz(v) == 1 && check(v[0].s,b,dis-1);
		}
	}
	return 1;
}

void test(int t) {
	vi bad;
	FOR(i,1,(1<<n)-1) {
		if (i == t) {
			if (sz(T.adj[i]) != 2) bad.pb(i);
		} else {
			// ps("HUH",i,sz(T.adj[i]));
			if (sz(T.adj[i]) != 3 && sz(T.adj[i]) != 1) bad.pb(i);
		}
	}
	// ps("HA",t,bad);
	if (sz(bad) != 1) return;
	par[t] = 0; dfs(t);
	if (check(t,bad[0],n-1)) ans.insert(bad[0]);
}

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	re(n);
	F0R(i,(1<<n)-3) {
		int a,b; re(a,b);
		T.addEdge(a,b);
	}
	T.init((1<<n)-2);
	trav(t,T.center) test(t);
	ps(sz(ans));
	trav(t,ans) pr(t,' ');
	// you should actually read the stuff at the bottom
}

/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?), slow multiset operations
	* do smth instead of nothing and stay organized
*/


#include<bits/stdc++.h>
using namespace std;
const int N=(1<<18)+9;
int n,m;
struct Edge{
    int v,nxt;
}e[N];
int head[N],cnt;
inline void add(int u,int v){
    e[cnt]=(Edge){v,head[u]};
    head[u]=cnt++;
}
int dep[N];
void dfs(int u,int fa){
    dep[u]=dep[fa]+1;
    for(int i=head[u];~i;i=e[i].nxt){
        if(e[i].v==fa)continue;
        dfs(e[i].v,u);
    }
}
int s,t,rt1,rt2;
vector<int>l;
void dfs1(int u,int fa){
    l.push_back(u);
    if(u==t){
        if(l.size()%2==0)rt1=l[l.size()/2-1],rt2=l[l.size()/2];
        else rt1=l[l.size()/2];
    }
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        dfs1(v,u);
    }
    l.pop_back();
}
bool check1(int u,int fa){
    int siz=0;bool flag=1;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa||v==rt1||v==rt2)continue;
        siz++;
        if(!check1(v,u))flag=0;
    }
    if(siz!=0&&siz!=2)return 0;
    return flag;
}
int ans;
int du[N];
bool get(int u,int fa){
    du[u]=0;bool flag=1;
    vector<int>dd;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        dd.push_back(v);
        if(!get(v,u))flag=0;
        du[u]++;
    }
    if(du[u]!=0&&du[u]!=2){if(ans)return 0;ans=u;}
    if(du[u]==2)if(du[dd[0]]!=du[dd[1]])if(ans!=dd[0]&&ans!=dd[1])return 0;
    return flag;
}
int main(){
   // freopen("tt.in","r",stdin),freopen("tt.out","w",stdout);
    cin>>n;n=(1<<n)-2;m=n-1;
    memset(head,-1,sizeof(head));
    for(int i=1,a,b;i<=m;i++){
        cin>>a>>b;add(a,b),add(b,a);
    }
    dfs(1,0);
    s=1;
    for(int i=1;i<=n;i++)if(dep[i]>dep[s])s=i;
    dfs(s,0);
    t=s;
    for(int i=1;i<=n;i++)if(dep[i]>dep[t])t=i;
    dfs1(s,0);
 //   cout<<rt1<<" "<<rt2<<endl;
    if(rt2){
        if(rt1>rt2)swap(rt1,rt2);
        bool flag=check1(rt1,0)&&check1(rt2,0);
        if(flag)cout<<2<<endl<<rt1<<" "<<rt2<<endl;
        else cout<<0<<endl;
    }else{
        bool flag=get(rt1,0);
        if(!flag)cout<<0<<endl;else cout<<1<<endl<<ans<<endl;
       // cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=(1<<18)+9;
int n,m;
struct Edge{
    int v,nxt;
}e[N];
int head[N],cnt;
inline void add(int u,int v){
    e[cnt]=(Edge){v,head[u]};
    head[u]=cnt++;
}
int dep[N];
void dfs(int u,int fa){
    dep[u]=dep[fa]+1;
    for(int i=head[u];~i;i=e[i].nxt){
        if(e[i].v==fa)continue;
        dfs(e[i].v,u);
    }
}
int s,t,rt1,rt2;
vector<int>l;
void dfs1(int u,int fa){
    l.push_back(u);
    if(u==t){
        if(l.size()%2==0)rt1=l[l.size()/2-1],rt2=l[l.size()/2];
        else rt1=l[l.size()/2];
    }
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        dfs1(v,u);
    }
    l.pop_back();
}
bool check1(int u,int fa){
    int siz=0;bool flag=1;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa||v==rt1||v==rt2)continue;
        siz++;
        if(!check1(v,u))flag=0;
    }
    if(siz!=0&&siz!=2)return 0;
    return flag;
}
int ans;
int siz[N];
bool get(int u,int fa){
    siz[u]=1;bool flag=1;
    vector<int>dd;
    int cnt=0;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        dd.push_back(v);
        if(!get(v,u))flag=0;
        siz[u]+=siz[v];
        cnt++;
    }
    if(cnt!=0&&cnt!=2){if(ans)return 0;ans=u;}
    else{
        if(cnt==2){
            if(siz[dd[0]]!=siz[dd[1]]){
                if(ans!=dd[0]&&ans!=dd[1])return 0;
            }
        }
    }
    return flag;
}
int main(){
 //   freopen("tt.in","r",stdin),freopen("tt.out","w",stdout);
    cin>>n;n=(1<<n)-2;m=n-1;
    memset(head,-1,sizeof(head));
    for(int i=1,a,b;i<=m;i++){
        cin>>a>>b;add(a,b),add(b,a);
    }
    dfs(1,0);
    s=1;
    for(int i=1;i<=n;i++)if(dep[i]>dep[s])s=i;
    dfs(s,0);
    t=s;
    for(int i=1;i<=n;i++)if(dep[i]>dep[t])t=i;
    dfs1(s,0);
 //   cout<<rt1<<" "<<rt2<<endl;
    if(rt2){
        if(rt1>rt2)swap(rt1,rt2);
        bool flag=check1(rt1,0)&&check1(rt2,0);
        if(flag)cout<<2<<endl<<rt1<<" "<<rt2<<endl;
        else cout<<0<<endl;
    }else{
        bool flag=get(rt1,0);
        if(!flag)cout<<0<<endl;else cout<<1<<endl<<ans<<endl;
       // cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=(1<<18)+9;
int n,m;
struct Edge{
    int v,nxt;
}e[N];
int head[N],cnt;
inline void add(int u,int v){
    e[cnt]=(Edge){v,head[u]};
    head[u]=cnt++;
}
int dep[N];
void dfs(int u,int fa){
    dep[u]=dep[fa]+1;
    for(int i=head[u];~i;i=e[i].nxt){
        if(e[i].v==fa)continue;
        dfs(e[i].v,u);
    }
}
int s,t,rt1,rt2;
vector<int>l;
void dfs1(int u,int fa){
    l.push_back(u);
    if(u==t){
        if(l.size()%2==0)rt1=l[l.size()/2-1],rt2=l[l.size()/2];
        else rt1=l[l.size()/2];
    }
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        dfs1(v,u);
    }
    l.pop_back();
}
int ddu[N];
bool check1(int u,int fa){
    ddu[u]=0;bool flag=1;
    vector<int>dd;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa||v==rt1||v==rt2)continue;
        ddu[u]++;dd.push_back(v);
        if(!check1(v,u))flag=0;
    }
    if(ddu[u]!=0&&ddu[u]!=2)return 0;
    if(ddu[u]==2)if(ddu[dd[0]]!=ddu[dd[1]])return 0;
    return flag;
}
int ans;
int du[N];
bool get(int u,int fa){
    du[u]=0;bool flag=1;
    vector<int>dd;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        dd.push_back(v);
        if(!get(v,u))flag=0;
        du[u]++;
    }
    if(du[u]!=0&&du[u]!=2){if(ans)return 0;ans=u;}
    if(du[u]==2)if(du[dd[0]]!=du[dd[1]])if(ans!=dd[0]&&ans!=dd[1])return 0;
    return flag;
}
int main(){
   // freopen("tt.in","r",stdin),freopen("tt.out","w",stdout);
    cin>>n;n=(1<<n)-2;m=n-1;
    memset(head,-1,sizeof(head));
    for(int i=1,a,b;i<=m;i++){
        cin>>a>>b;add(a,b),add(b,a);
    }
    dfs(1,0);
    s=1;
    for(int i=1;i<=n;i++)if(dep[i]>dep[s])s=i;
    dfs(s,0);
    t=s;
    for(int i=1;i<=n;i++)if(dep[i]>dep[t])t=i;
    dfs1(s,0);
 //   cout<<rt1<<" "<<rt2<<endl;
    if(rt2){
        if(rt1>rt2)swap(rt1,rt2);
        bool flag=check1(rt1,0)&&check1(rt2,0);
        if(flag)cout<<2<<endl<<rt1<<" "<<rt2<<endl;
        else cout<<0<<endl;
    }else{
        bool flag=get(rt1,0);
        if(!flag)cout<<0<<endl;else cout<<1<<endl<<ans<<endl;
       // cout<<ans<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int N=(1<<18)+9;
int n,m;
struct Edge{
    int v,nxt;
}e[N];
int head[N],cnt;
inline void add(int u,int v){
    e[cnt]=(Edge){v,head[u]};
    head[u]=cnt++;
}
int dep[N];
void dfs(int u,int fa){
    dep[u]=dep[fa]+1;
    for(int i=head[u];~i;i=e[i].nxt){
        if(e[i].v==fa)continue;
        dfs(e[i].v,u);
    }
}
int s,t,rt1,rt2;
vector<int>l;
void dfs1(int u,int fa){
    l.push_back(u);
    if(u==t){
        if(l.size()%2==0)rt1=l[l.size()/2-1],rt2=l[l.size()/2];
        else rt1=l[l.size()/2];
    }
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        dfs1(v,u);
    }
    l.pop_back();
}
bool check1(int u,int fa){
    int siz=0;bool flag=1;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa||v==rt1||v==rt2)continue;
        siz++;
        if(!check1(v,u))flag=0;
    }
    if(siz!=0&&siz!=2)return 0;
    return 1;
}
int ans;
bool get(int u,int fa){
    int siz=0;bool flag=1;
    for(int i=head[u],v;~i;i=e[i].nxt){
        v=e[i].v;
        if(v==fa)continue;
        siz++;
        if(!get(v,u))flag=0;
    }
    if(siz!=2&&siz!=0){if(ans)return 0;ans=u;}//ans=u,flag=0;
    return 1;
}
int main(){
  //  freopen("tt.in","r",stdin),freopen("tt.out","w",stdout);
    cin>>n;n=(1<<n)-2;m=n-1;
    memset(head,-1,sizeof(head));
    for(int i=1,a,b;i<=m;i++){
        cin>>a>>b;add(a,b),add(b,a);
    }
    dfs(1,0);
    s=1;
    for(int i=1;i<=n;i++)if(dep[i]>dep[s])s=i;
    dfs(s,0);
    t=s;
    for(int i=1;i<=n;i++)if(dep[i]>dep[t])t=i;
    dfs1(s,0);
 //   cout<<rt1<<" "<<rt2<<endl;
    if(rt2){
        if(rt1>rt2)swap(rt1,rt2);
        bool flag=check1(rt1,0)&&check1(rt2,0);
        if(flag)cout<<2<<endl<<rt1<<" "<<rt2<<endl;
        else cout<<0<<endl;
    }else{
        bool flag=get(rt1,0);
        if(!flag)cout<<0<<endl;else cout<<1<<endl<<ans<<endl;
       // cout<<ans<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
namespace IO{
template<typename T>
void __RI(T&x){
	int ch=getchar(),neg=1;
	x=0;
	for(;!(isdigit(ch)||ch=='-'||ch==EOF);ch=getchar());
	if(ch==EOF)return;
	if(ch=='-')neg=-1,ch=getchar();
	for(;isdigit(ch);ch=getchar())x=x*10+ch-48;
	x*=neg;
}
void R(int&x){__RI(x);}
#ifndef int
void R(int64_t&x){__RI(x);}
#endif
template<typename T1,typename T2>
void R(std::pair<T1,T2>&x){
	R(x.first);
	R(x.second);
}
template<typename T>
void R(std::vector<T>&x){
	for(auto&i:x){R(i);}
}
template<typename T>
void R(T&x){
	std::cin>>x;
}
template<typename T,typename...Args>
void R(T &x,Args&...args){
	R(x),R(args...);
}
template<typename T>
void RA(T *arr,int l,int r){
	arr+=l;
	int p=r-l+1;
	while(p--)R(*arr++);
}
char space=' ';
template<typename T>
void __WI(T x){
	if(x==0)putchar('0');
	if(x<0)putchar('-'),x=-x;
	char ch[64];
	int pos=0;
	while(x)ch[pos++]=x%10+48,x/=10;
	while(pos)putchar(ch[--pos]);
}
void W(){}
void W(const int&x){__WI(x);}
#ifndef int
void W(const int64_t&x){__WI(x);}
#endif
void W(const double&x){printf("%lf",static_cast<double>(x));}
void W(const char&x){putchar(x);}
void W(const std::string&x){printf("%s",x.c_str());}
template<typename T1,typename T2>
void W(const std::pair<T1,T2>&x){
	W(x.first);
	W(space);
	W(x.second);
}
template<typename T>
void W(const std::vector<T>&x){
	for(auto it=x.cbegin();it!=x.cend();it++){
		W(*it);
		W(space);
	}
}
template<typename T>
void W(const T&x){
	std::cout<<x;
}
template<typename T,typename...Args>
void W(const T&x,const Args&...args){
	W(x),W(space),W(args...);
}
template<typename...Args>
void WL(const Args&...args){
	W(args...),W('\n');
}
template<typename T>
void WA(T *arr,int l,int r){
	arr+=l;
	int p=r-l;
	while(p--)W(*arr++),W(space);
	W(*arr);
}
template<typename T>
void WAL(T *arr,int l,int r){
	arr+=l;
	int p=r-l;
	while(p--)W(*arr++),W(space);
	WL(*arr);
}
}; // namespace IO
struct Node{
	int nxt,to;
}edge[400010];
int head[200010],tot=0;
int n,m;
int na,nb;
int d1,d2;
int dep[200010];
int kl[200010],d[200010];
int op[200010],h[200010];
bool flg;
void adde(int a,int b){
	edge[++tot]=(Node){head[a],b};
	head[a]=tot;
}
void dfs(int x,int fa){
	if(dep[x]>na)na=dep[x],nb=x;
	for(int i=head[x];i;i=edge[i].nxt){
		int to=edge[i].to;
		if(to==fa)continue;
		dep[to]=dep[x]+1;
		kl[to]=x;
		dfs(to,x);
	}
}
bool cmp(int a,int b){return h[a]<h[b];}
void solve(int x,int fa){
	vector<int>v;
	for(int i=head[x];i;i=edge[i].nxt){
		int to=edge[i].to;
		if(to==fa)continue;
		v.pb(to);
	}
	op[x]=0;
	int t=v.size();
	if(t==0)h[x]=op[x]=0;
	else if(t==1){
		int to=v[0];
		solve(to,x);
		if(op[to]||h[to])flg=0;
		op[x]=x,h[x]=h[v[0]]+1;
	}else if(t==2){
		solve(v[0],x),solve(v[1],x);
		if((op[v[0]]&&op[v[1]])||h[v[0]]!=h[v[1]])flg=0;
		else if(op[v[0]]||op[v[1]])op[x]=op[v[0]]+op[v[1]];
		h[x]=h[v[0]]+1;
	}else if(t==3){
		solve(v[0],x),solve(v[1],x),solve(v[2],x);
		sort(v.begin(),v.end(),cmp);
		if(op[v[0]]||op[v[1]]||op[v[2]])flg=0;
		if(!(h[v[1]]==h[v[0]]&&h[v[2]]==h[v[0]]+1))flg=0;
		op[x]=x,h[x]=h[v[2]]+1;
	}else flg=0;
}
int main(){
	IO::R(n);
	m=(1<<n)-2;
	for(int i=1,a,b;i<m;i++){
		IO::R(a,b);
		adde(a,b);
		adde(b,a);
		d[a]++,d[b]++;
	}
	nb=na=dep[1]=0;
	dfs(1,0);
	d1=nb;
	nb=na=dep[d1]=kl[d1]=0;
	dfs(d1,0);
	d2=nb;
	int pos=d2;
	vector<int>ans;
	while(pos){
		if(abs(2*dep[pos]-dep[d2])<=1){
			flg=1;
			solve(pos,0);
			if(op[pos]&&flg&&h[pos]==n-1)ans.pb(op[pos]);
		}
		pos=kl[pos];
	}
	sort(ans.begin(),ans.end());
	IO::WL(ans.size());
	IO::WL(ans);
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF 0x3f3f3f3f
#define Inf 1000000000000000000LL
#define F first
#define S second
using namespace std;
namespace IO{
template<typename T>
void __RI(T&x){
	int ch=getchar(),neg=1;
	x=0;
	for(;!(isdigit(ch)||ch=='-'||ch==EOF);ch=getchar());
	if(ch==EOF)return;
	if(ch=='-')neg=-1,ch=getchar();
	for(;isdigit(ch);ch=getchar())x=x*10+ch-48;
	x*=neg;
}
void R(int&x){__RI(x);}
#ifndef int
void R(int64_t&x){__RI(x);}
#endif
template<typename T1,typename T2>
void R(std::pair<T1,T2>&x){
	R(x.first);
	R(x.second);
}
template<typename T>
void R(std::vector<T>&x){
	for(auto&i:x){R(i);}
}
template<typename T>
void R(T&x){
	std::cin>>x;
}
template<typename T,typename...Args>
void R(T &x,Args&...args){
	R(x),R(args...);
}
template<typename T>
void RA(T *arr,int l,int r){
	arr+=l;
	int p=r-l+1;
	while(p--)R(*arr++);
}
char space=' ';
template<typename T>
void __WI(T x){
	if(x==0)putchar('0');
	if(x<0)putchar('-'),x=-x;
	char ch[64];
	int pos=0;
	while(x)ch[pos++]=x%10+48,x/=10;
	while(pos)putchar(ch[--pos]);
}
void W(){}
void W(const int&x){__WI(x);}
#ifndef int
void W(const int64_t&x){__WI(x);}
#endif
void W(const double&x){printf("%lf",static_cast<double>(x));}
void W(const char&x){putchar(x);}
void W(const std::string&x){printf("%s",x.c_str());}
template<typename T1,typename T2>
void W(const std::pair<T1,T2>&x){
	W(x.first);
	W(space);
	W(x.second);
}
template<typename T>
void W(const std::vector<T>&x){
	for(auto it=x.cbegin();it!=x.cend();it++){
		W(*it);
		W(space);
	}
}
template<typename T>
void W(const T&x){
	std::cout<<x;
}
template<typename T,typename...Args>
void W(const T&x,const Args&...args){
	W(x),W(space),W(args...);
}
template<typename...Args>
void WL(const Args&...args){
	W(args...),W('\n');
}
template<typename T>
void WA(T *arr,int l,int r){
	arr+=l;
	int p=r-l;
	while(p--)W(*arr++),W(space);
	W(*arr);
}
template<typename T>
void WAL(T *arr,int l,int r){
	arr+=l;
	int p=r-l;
	while(p--)W(*arr++),W(space);
	WL(*arr);
}
}; // namespace IO
struct Node{
	int nxt,to;
}edge[200010];
int head[200010],tot=0;
int n,m;
int na,nb;
int d1,d2;
int dep[200010];
int kl[200010],d[200010];
int op[200010],h[200010];
bool flg;
void adde(int a,int b){
	edge[++tot]=(Node){head[a],b};
	head[a]=tot;
}
void dfs(int x,int fa){
	if(dep[x]>na)na=dep[x],nb=x;
	for(int i=head[x];i;i=edge[i].nxt){
		int to=edge[i].to;
		if(to==fa)continue;
		dep[to]=dep[x]+1;
		kl[to]=x;
		dfs(to,x);
	}
}
bool cmp(int a,int b){return h[a]<h[b];}
void solve(int x,int fa){
	vector<int>v;
	for(int i=head[x];i;i=edge[i].nxt){
		int to=edge[i].to;
		if(to==fa)continue;
		v.pb(to);
	}
	op[x]=0;
	int t=v.size();
	if(t==0)h[x]=op[x]=0;
	else if(t==1){
		int to=v[0];
		solve(to,x);
		if(op[to]||h[to])flg=0;
		op[x]=x,h[x]=h[v[0]]+1;
	}else if(t==2){
		solve(v[0],x),solve(v[1],x);
		if((op[v[0]]&&op[v[1]])||h[v[0]]!=h[v[1]])flg=0;
		else if(op[v[0]]||op[v[1]])op[x]=op[v[0]]+op[v[1]];
		h[x]=h[v[0]]+1;
	}else if(t==3){
		solve(v[0],x),solve(v[1],x),solve(v[2],x);
		sort(v.begin(),v.end(),cmp);
		if(op[v[0]]||op[v[1]]||op[v[2]])flg=0;
		if(!(h[v[1]]==h[v[0]]&&h[v[2]]==h[v[0]]+1))flg=0;
		op[x]=x,h[x]=h[v[2]]+1;
	}else flg=0;
}
int main(){
	IO::R(n);
	m=(1<<n)-2;
	for(int i=1,a,b;i<m;i++){
		IO::R(a,b);
		adde(a,b);
		adde(b,a);
		d[a]++,d[b]++;
	}
	nb=na=dep[1]=0;
	dfs(1,0);
	d1=nb;
	nb=na=dep[d1]=kl[d1]=0;
	dfs(d1,0);
	d2=nb;
	int pos=d2;
	vector<int>ans;
	while(pos){
		if(abs(2*dep[pos]-dep[d2])<=1){
			flg=1;
			solve(pos,0);
			if(op[pos]&&flg&&h[pos]==n-1)ans.pb(op[pos]);
		}
		pos=kl[pos];
	}
	IO::WL(ans.size());
	IO::WL(ans);
}


#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const int MX = (1 << 17) + 5;
int n, k, d[MX], p[MX], lvl[MX], pro[MX];
vi adj[MX], cd, res, gra[MX], g3, g1;
queue<int> q;

void dfs (int u, int par = -1) {
	if (adj[u].size() - (par != -1) == 3)
		g3.pb(u);
	if (adj[u].size() - (par != -1) == 1)
		g1.pb(u);

	pro[u] = lvl[u];
	for (int v : adj[u])
		if (v != par) {
			p[v] = u;
			lvl[v] = lvl[u] + 1;
			dfs(v, u);
			pro[u] = max(pro[u], pro[v]);
		}
}

bool mcDick (int u, int p, int lvl) {
	if (gra[u].size() - (p != -1) == 0)
		return lvl == k - 1;
	if (gra[u].size() - (p != -1) != 2)
		return 0;

	for (int v : gra[u])
		if (v != p && !mcDick(v, u, lvl + 1))
			return 0;

	return 1;
}

void solve (int r) {
	g1.clear(), g3.clear();
	lvl[r] = 0, p[r] = -1;
	dfs(r);

	if (g1.size() + g3.size() != 1) return;

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

	if (g1.size()) {
		gra[g1.back()].pb(n + 1);
		gra[n + 1] = {g1.back()};

		if (mcDick(r, -1, 0))
			res.pb(g1.back());
	} else {
		int u = g3.back();
		vi aux;

		for (int v : adj[u])
			if (v != p[u] && pro[v] != pro[u])
				aux.pb(v);
		if (aux.size() != 2) return;

		gra[u].clear();
		for (int v : adj[u])
			if (v != aux[0] && v != aux[1])
				gra[u].pb(v);

		gra[u].pb(n + 1);
		gra[n + 1] = {u, aux[0], aux[1]};

		gra[aux[0]].clear();
		for (int v : adj[aux[0]])
			if (v != u)
				gra[aux[0]].pb(v);
		gra[aux[0]].pb(n + 1);

		gra[aux[1]].clear();
		for (int v : adj[aux[1]])
			if (v != u)
				gra[aux[1]].pb(v);
		gra[aux[1]].pb(n + 1);

		if (mcDick(r, -1, 0))
			res.pb(u);
	}
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> k;
	n = (1 << k) - 2;
	for (int i = 1; i < n; i++) {
		int a, b;
		cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	}

	memset(d, -1, sizeof(d));
	for (int i = 1; i <= n; i++)
		if (adj[i].size() == 1) {
			q.push(i);
			d[i] = 0;
		}

	int mx = 0;
	while (q.size()) {
		int u = q.front();
		q.pop();

		for (int v : adj[u])
			if (d[v] == -1) {
				q.push(v);
				d[v] = d[u] + 1;
				mx = d[v];
			}
	}

	for (int i = 1; i <= n; i++)
		if (d[i] == mx)
			cd.pb(i);

	if (cd.size() > 2) {
		cout << 0 << endl;
		return 0;
	}

	for (int x : cd)
		solve(x);

	cout << res.size() << endl;
	for (int x : res)
		cout << x << " ";
	cout << endl;

	return 0;
}


#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const int MX = (1 << 17) + 5;
int n, k, d[MX], p[MX], lvl[MX], pro[MX];
vi adj[MX], cd, res, gra[MX], g3, g1;
queue<int> q;

void dfs (int u, int par = -1) {
	if (adj[u].size() - (par != -1) == 3)
		g3.pb(u);
	if (adj[u].size() - (par != -1) == 1)
		g1.pb(u);

	pro[u] = lvl[u];
	for (int v : adj[u])
		if (v != par) {
			p[v] = u;
			lvl[v] = lvl[u] + 1;
			dfs(v, u);
			pro[u] = max(pro[u], pro[v]);
		}
}

bool mcDick (int u, int p, int lvl) {
	if (gra[u].size() - (p != -1) == 0)
		return lvl == k - 1;
	if (gra[u].size() - (p != -1) != 2)
		return 0;

	for (int v : gra[u])
		if (v != p && !mcDick(v, u, lvl + 1))
			return 0;

	return 1;
}

void solve (int r) {
	g1.clear(), g3.clear();
	lvl[r] = 0, p[r] = -1;
	dfs(r);

	if (g1.size() + g3.size() != 1) return;

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

	if (g1.size()) {
		gra[g1.back()].pb(n + 1);
		gra[n + 1] = {g1.back()};

		if (mcDick(r, -1, 0))
			res.pb(g1.back());
	} else {
		int u = g3.back();
		vi aux;

		for (int v : adj[u])
			if (v != p[u] && pro[v] != pro[u])
				aux.pb(v);
		if (aux.size() != 2) return;

		gra[u].clear();
		for (int v : adj[u])
			if (v != aux[0] && v != aux[1])
				gra[u].pb(v);

		gra[u].pb(n + 1);
		gra[n + 1] = {u, aux[0], aux[1]};

		gra[aux[0]].clear();
		for (int v : adj[aux[0]])
			if (v != u)
				gra[aux[0]].pb(v);
		gra[aux[0]].pb(n + 1);

		gra[aux[1]].clear();
		for (int v : adj[aux[1]])
			if (v != u)
				gra[aux[1]].pb(v);
		gra[aux[1]].pb(n + 1);

		if (mcDick(r, -1, 0))
			res.pb(u);
	}
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> k;
	n = (1 << k) - 2;
	for (int i = 1; i < n; i++) {
		int a, b;
		cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	}

	memset(d, -1, sizeof(d));
	for (int i = 1; i <= n; i++)
		if (adj[i].size() == 1) {
			q.push(i);
			d[i] = 0;
		}

	int mx = 0;
	while (q.size()) {
		int u = q.front();
		q.pop();

		for (int v : adj[u])
			if (d[v] == -1) {
				q.push(v);
				d[v] = d[u] + 1;
				mx = d[v];
			}
	}

	for (int i = 1; i <= n; i++)
		if (d[i] == mx)
			cd.pb(i);

	for (int x : cd)
		solve(x);

	cout << res.size() << endl;
	for (int x : res)
		cout << x << " ";
	cout << endl;

	return 0;
}


#include <bits/stdc++.h>

#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ll> vl;
typedef vector<ii> vii;

const int MX = (1 << 17) + 5;
int n, k, d[MX], p[MX], lvl[MX], pro[MX];
vi adj[MX], cd, res, gra[MX], g3, g1;
queue<int> q;

void dfs (int u, int par = -1) {
	if (adj[u].size() - (par != -1) == 3)
		g3.pb(u);
	if (adj[u].size() - (par != -1) == 1)
		g1.pb(u);

	pro[u] = lvl[u];
	for (int v : adj[u])
		if (v != par) {
			p[v] = u;
			lvl[v] = lvl[u] + 1;
			dfs(v, u);
			pro[u] = max(pro[u], pro[v]);
		}
}

bool mcDick (int u, int p, int lvl) {
	if (gra[u].size() - (p != -1) == 0)
		return lvl == k - 1;
	if (gra[u].size() - (p != -1) != 2)
		return 0;

	for (int v : gra[u])
		if (v != p && !mcDick(v, u, lvl + 1))
			return 0;

	return 1;
}

void solve (int r) {
	g1.clear(), g3.clear();
	lvl[r] = 0, p[r] = -1;
	dfs(r);

	if (g1.size() + g3.size() != 1) return;

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

	if (g1.size()) {
		gra[g1.back()].pb(n + 1);
		gra[n + 1] = {g1.back()};

		if (mcDick(r, -1, 0))
			res.pb(g1.back());
	} else {
		int u = g3.back();
		vi aux;

		for (int v : adj[u])
			if (v != p[u] && pro[v] != pro[u])
				aux.pb(v);
		if (aux.size() != 2) return;

		gra[u].clear();
		for (int v : adj[u])
			if (v != aux[0] && v != aux[1])
				gra[u].pb(v);

		gra[u].pb(n + 1);
		gra[n + 1] = {u, aux[0], aux[1]};

		if (mcDick(r, -1, 0))
			res.pb(u);
	}
}

int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);

	cin >> k;
	n = (1 << k) - 2;
	for (int i = 1; i < n; i++) {
		int a, b;
		cin >> a >> b;
		adj[a].pb(b);
		adj[b].pb(a);
	}

	memset(d, -1, sizeof(d));
	for (int i = 1; i <= n; i++)
		if (adj[i].size() == 1) {
			q.push(i);
			d[i] = 0;
		}

	int mx = 0;
	while (q.size()) {
		int u = q.front();
		q.pop();

		for (int v : adj[u])
			if (d[v] == -1) {
				q.push(v);
				d[v] = d[u] + 1;
				mx = d[v];
			}
	}

	for (int i = 1; i <= n; i++)
		if (d[i] == mx)
			cd.pb(i);

	for (int x : cd)
		solve(x);

	cout << res.size() << endl;
	for (int x : res)
		cout << x << " ";
	cout << endl;

	return 0;
}