string[] prvired = Console.ReadLine().Split();
string[] drugired = Console.ReadLine().Split();
Queue<int> p = new Queue<int>();
int n = int.Parse(prvired[0]);
int k = int.Parse(prvired[1]);
int x = int.Parse(prvired[2]);
int aura = 0;
int c = 1;
int brojac = 0;
for (int i = 0; i < n; i++) p.Enqueue(int.Parse(drugired[i]));
while (brojac != k)
{
    Console.WriteLine($"Period {brojac}");
    if (p.Count() < k)
    {
        p.Clear();
        for (int i = 0; i < n; i++) p.Enqueue(int.Parse(drugired[i]));
        for (int i = 0; i < brojac; i++) p.Dequeue();
    }
    for (int i = 0; i < k; i++)
    {
        aura += p.Peek() * c;
        Console.WriteLine($"{i}. red: + {c}*{p.Peek()} = {aura}");
        p.Dequeue();
        if (i != brojac)
        {
            if (brojac == k)
            {
                if (c != x) c++;
            }            
        }

    }
    brojac++;
    aura = 0;
    c = 1;
}