/* Problem URL: https://codeforces.com/group/btcK4I5D5f/contest/601720/problem/M */

#include <bits/stdc++.h>

using namespace std;

#define V vector

#define rmin(a, b) a = min(a, b)
#define rmax(a, b) a = max(a, b)

#define rep(i, lim) for (size_t i = 0; i < (lim); i++)
#define nrep(i, s, lim) for (size_t i = s; i < (lim); i++)

#define repv(i, v) for (auto &i : (v))
#define fillv(v) for (auto &itr_ : (v)) { cin >> itr_; }
#define sortv(v) sort(v.begin(), v.end())
#define all(v) (v).begin(), (v).end()

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vvvvi = vector<vvvi>;

using ll = long long;

using vl = vector<ll>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vvvvl = vector<vvvl>;

template<class v>
auto operator<<(ostream &os, const vector<v> &vec)->ostream& {
    os << vec[0];
    for (size_t i = 1; i < vec.size(); i++) {
        os << ' ' << vec[i];
    }
    os << '\n';
    return os;
}

template<class v>
auto operator>>(istream &is, vector<v> &vec)->istream& {
    for (auto &i : vec) {
        is >> i;
    }
    return is;
}

template<class v>
auto operator<<(ostream &os, const vector<vector<v>> &vec)->ostream& {
    for (auto &i : vec) {
        os << i[0];
        for (size_t j = 1; j < i.size(); j++) {
            os << ' ' << i[j];
        }
        os << '\n';
    }
    return os;
}

template<class v>
auto operator>>(istream  &is, vector<vector<v>> &vec)->istream& {
    for (auto &i : vec) {
        for (auto &j : i) {
            is >> j;
        }
    }
    return is;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

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

    vvi dp(51, vi(m + 1, 0));
    rep(i, 51) {
        nrep(j, 1, m + 1) {
            if (i <= k) {
                dp[i][j] = i;
                continue;
            }

            rep(k, j) {
                rmax(dp[i][j], dp[i / 2][k] + dp[i / 2 + i % 2][j - k - 1]);
            }
        }
    }

    vi mangas(n);
    cin >> mangas;

    vvi dp2(n + 1, vi(m + 1, 0));

    rep(i, n) {
        nrep(j, 1, m + 1) {
            rep(k, j + 1) {
                rmax(dp2[i + 1][j], dp2[i][k] + dp[mangas[i]][j - k]);
            }
            rmax(dp2[i + 1][j], dp2[i][j]);
        }
    }

    V<pair<int, int>> ops;

    function<void(int, int)> getops = [&](int manga, int j){
        if (j == 0) {
            return;
        }

        if (manga <= k) {
            ops.emplace_back(1, manga);
            return;
        }

        rep(i, j) {
            if (dp[manga / 2][i] + dp[manga / 2 + manga % 2][j - i - 1] == dp[manga][j]) {
                ops.emplace_back(2, manga);
                getops(manga / 2, i);
                getops(manga / 2 + manga % 2, j - i - 1);
                return;
            }
        }
    };

    auto recover = [&](){
        int i = n;
        int j = m;

        while (j > 0 && i > 0 && dp2[i][j] > 0) {
            while (dp2[i - 1][j] == dp2[i][j]) {
                i--;
            }

            while (dp2[i][j - 1] == dp2[i][j]) {
                j--;
            }

            rep(k, j) {
                if (dp2[i - 1][k] + dp[mangas[i - 1]][j - k] == dp2[i][j]) {
                    getops(mangas[i - 1], j - k);
                    j = k;
                    i--;
                    break;
                }
            }
        }
    };

    recover();

    cout << dp2.back().back() << ' ' << ops.size() << '\n';
    for (auto [i, j] : ops) {
        cout << i << ' ' << j << '\n';
    }
}
