double[] Chunks = Console.ReadLine().Split(' ').Select(x=>double.Parse(x)).ToArray();
Array.Sort(Chunks);
if (Chunks[1] / 3 > Chunks[0])
Console.WriteLine(Chunks[1] / 3);
else
Console.WriteLine(Math.Min(Chunks[1] / 2, Chunks[0]));
int Price = int.Parse(Console.ReadLine());
int n5 = Price / 5;
int n3 = 0;
while (n5 * 5 + n3 * 3 != Price)
if (n5 * 5 + ++n3 * 3 > Price)
n5--;
Console.WriteLine($"{n5} {n3}");