#include <bits/stdc++.h>
using namespace std;
#define int              long long int
#define double           long double
#define print(a)         for(auto x : a) cout << x << " "; cout << endl
inline int power(int a, int b) {
    int x = 1;
    while (b) {
        if (b & 1) x *= a;
        a *= a;
        b >>= 1;
    }
    return x;
}


const int M = 1000000007;
const int N = 3e5+9;
const int INF = 2e9+1;
const int LINF = 2000000000000000001;

//_ ***************************** START Below *******************************




vector<int> a;

//* Using Sorted set 
//* O(nLogn)

int consistency1(int n, int x, int y) {
    int ans = -LINF;
    
    vector<int> prefix(n+1, 0);
    for(int i=1; i<=n; i++){
        prefix[i] = prefix[i-1] + a[i-1];
    }
    for(int i=1; i<=y-x; i++){
        prefix.push_back(-LINF);
    }
    
    set<pair<int,int> > st;
    
    int size = prefix.size();
    
    int s = 0, e = 0;
    int l = 0;

    while(e<size){
        st.insert({prefix[e], e});

        while(e-l+1 > y-x+1){
            st.erase({prefix[l], l});
            l++;
        }

        if(e-s+1 < y+1){
            e++;
        }
        else{

            int maxi = (*st.rbegin()).first;

            ans = max(ans, maxi-prefix[s]);

            st.erase({prefix[l], l});

            l++;
            s++;
            e++;
        }
    }


    return ans;
}






//* Using deque
//* O(n)

int consistency2(int n, int x, int y) {
    int ans = -LINF;
    
    vector<int> prefix(n+1, 0);
    for(int i=1; i<=n; i++){
        prefix[i] = prefix[i-1] + a[i-1];
    }
    for(int i=1; i<=y-x; i++){
        prefix.push_back(-LINF);
    }
    
    deque<int> down;
    
    int size = prefix.size();
    
    int s = 0, e = 0;
    int l = 0;

    while(e<size){
        while(!down.empty() && prefix[down.back()] < prefix[e] ) down.pop_back();
        down.push_back(e);

        while(e-l+1 > y-x+1){
            if(down.front() == l) down.pop_front();
            l++;
        }

        if(e-s+1 < y+1){
            e++;
        }
        else{

            int maxi = prefix[down.front()];

            ans = max(ans, maxi-prefix[s]);

            if(down.front() == l) down.pop_front();

            l++;
            s++;
            e++;
        }
    }


    return ans;
}














int practice(int n, int x, int y) {
    int ans = 0;


    return ans;
}




void solve() {
    
    int n, x, y;
    cin>>n >> x >> y;
	
	a.resize(n);
    for(int i=0; i<n; i++) cin >> a[i];
    
    cout << consistency1(n, x, y) << " " << consistency2(n, x, y) << endl;
    
    // cout << consistency1(n, x, y) << " -> " << practice(n, x, y) << endl;
    

    


}





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

    int t = 1;
    while (t--) {
        solve();
    }

    return 0;
}