int pr = 0;

string[] nkx = Console.ReadLine().Split();
int n = int.Parse(nkx[0]);
int k = int.Parse(nkx[1]);
int X = int.Parse(nkx[2]);

int x = X - 1;

string[] ps = Console.ReadLine().Split();
int[] p = new int[n];
for (int i = 0; i < n; i++)
{
    p[i] = int.Parse(ps[i]);
}

long[] aura = new long[n];
long suma = 0;
for (int i = 0;i<k; i++)
{
    suma += p[i];
}

long a = suma;
for (int i = 0; i<k; i++)
{
    a -= p[i];
    aura[i] = a;
}

int[] xmax = new int[x];

long[] xmaxv = new long[x];
for (int i=0; i<x; i++)
{
    int m = 0;
    for (int j=0; j<k; j++)
    {
        if (aura[j]>aura[m]) m = j;
    }
    xmax[i] = m;
    xmaxv[i] = aura[m];
    aura[m] = long.MinValue;
}
for (int i=0;i<x; i++)
{
    aura[xmax[i]] = xmaxv[i];
}

long s = suma;
for (int i=0;i<x; i++)
{
    s += xmaxv[i];
}
Console.Write(s + " ");


for (int i=k; i<n; i++)
{
    for (int j=i-k+1; j<=i; j++)
    {
        if (j == i) aura[j] = 0;
        else
        {
            aura[j] = aura[j+1] + p[i];
        }
    }
    for (int j=x-1; j>=0; j--)
    {
        if (aura[xmax[j]] >= 0) break;
        if (j == x - 1) xmax[x - 1] = i;
        else
        {
            int _ = xmax[j];
            xmax[j] = i;
            xmax[j+1] = _;
        }
    }
    bool tu = false;
    int tui = -1;
    for (int j=0; j<x; j++)
    {
        if (xmax[j] == i - k)
        {
            tu = true;
            tui = j;
        }
    }
    if (tu)
    {
        for (int j=tui; j<x-1; j++)
        {
            xmax[j] = xmax[j + 1];
        }
        for (int j=0; j<x; j++)
        {
            xmaxv[j] = aura[xmax[j]];
            aura[xmax[j]] = long.MinValue;
        }
        int m = i-k+1;
        for (int j=i-k+1; j<=k; j++)
        {
            if (aura[j] > aura[m]) m = j;
        }
        for (int j = 0; j < x; j ++)
        {
            aura[xmax[j]] = xmaxv[j];
        }
        bool nasao = false;
        for (int j=0; j<x; j++)
        {
            if (nasao)
            {
                int _ = xmax[j];
                xmax[j] = pr;
                pr = _;
            }
            else
            {
                if (j == x - 1) xmax[j] = m;
                else if (aura[m] > aura[xmax[j]])
                {
                    nasao = true;
                    pr = xmax[j];
                    xmax[j] = m;

                }
            }
            
        }

    }

    suma += p[i] - p[i - k];
    s = suma;
    for (int j = 0; j < x; j++)
    {
        s += aura[xmax[j]];
    }
    Console.Write(s + " ");
}