There are five people playing a game called "Generosity". Each person gives some non-zero number of coins b as an initial bet. After all players make their bets of b coins, the following operation is repeated for several times: a coin is passed from one player to some other player.Your task is to write a program that can, given the number of coins each player has at the end of the game, determine the size b of the initial bet or find out that such outcome of the game cannot be obtained for any positive number of coins b in the initial bet.

The input consists of a single line containing five integers c1, c2, c3, c4 and c5 — the number of coins that the first, second, third, fourth and fifth players respectively have at the end of the game (0 ≤ c1, c2, c3, c4, c5 ≤ 100).

Print the only line containing a single positive integer b — the number of coins in the initial bet of each player. If there is no such value of b, then print the only value "-1" (quotes for clarity).

NoteIn the first sample the following sequence of operations is possible:  One coin is passed from the fourth player to the second player;  One coin is passed from the fourth player to the fifth player;  One coin is passed from the first player to the third player;  One coin is passed from the fourth player to the second player.

using System;
namespace R_A_273
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] c = new int[5];
            int sum = 0;
            for (int i = 0; i < 5; i++)
            {
                c[i] = int.Parse(s[i]);
                sum += c[i];
            }
            if ((sum % 5 == 0) && (sum >= 5)) Console.WriteLine(sum / 5);
            else Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            var cs = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();
            int sum = cs.Sum();
            if (sum % 5 == 0 && sum>0)
                Console.WriteLine(sum / 5);
            else
                Console.WriteLine(-1);
        }
    }
}

using System;

namespace Issue_478A
{
    class Program
    {
        public static void Main(string[] args) {
            const int CoinsCount = 5;

            var coins = new int[CoinsCount];

            for (int i = 0; i < CoinsCount; ++i) {
                coins[i] = ReadInt();
            }

            var balanced = IsBalanced(coins);

            while (!balanced) {
                var max = coins.MaxIndex();
                var min = coins.MinIndex();

                if (coins[max] - coins[min] == 1) {
                    break;
                }

                coins[max]--;
                coins[min]++;

                balanced = IsBalanced(coins);
            }

            Console.WriteLine((balanced && (coins[0] > 0)) ? coins[0] : -1);
        }

        public static bool IsBalanced(int[] array) {
            if (array.Length == 0)
                return true;

            var value = array[0];

            for (int i = 1; i < array.Length; ++i) {
                if (array[i] != value) {
                    return false;
                }
            }

            return true;
        }

        private static bool IsInputError = false;
        private static bool IsEndOfLine = false;

        private static int ReadInt() {
            const int zeroCode = (int) '0';

            var result = 0;
            var isNegative = false;
            var symbol = Console.Read();
            IsInputError = false;
            IsEndOfLine = false;

            while (symbol == ' ') {
                symbol = Console.Read();
            }

            if (symbol == '-') {
                isNegative = true;
                symbol = Console.Read();
            }

            for ( ;
                (symbol != -1) && (symbol != ' ');
                symbol = Console.Read()
            ) {
                var digit = symbol - zeroCode;

                // if symbol == \n
                if (symbol == 13) {
                    // skip next \r symbol
                    Console.Read();
                    IsEndOfLine = true;
                    break;
                }

                if (digit < 10 && digit >= 0) {
                    var cache1 = result << 1;
                    var cache2 = cache1 << 2;
                    result = cache1 + cache2 + digit;
                } else {
                    IsInputError = true;
                    break;
                }
            }

            return isNegative ? ~result + 1 : result;
        }
    }

    public static class Extensions
    {
        public static int MaxIndex(this int[] array) {
            if (array.Length == 0)
                return -1;

            var value = array[0];
            var index = 0;

            for (int i = 1; i < array.Length; ++i) {
                if (array[i] > value) {
                    value = array[i];
                    index = i;
                }
            }

            return index;
        }

        public static int MinIndex(this int[] array) {
            if (array.Length == 0)
                return -1;

            var value = array[0];
            var index = 0;

            for (int i = 1; i < array.Length; ++i) {
                if (array[i] < value) {
                    value = array[i];
                    index = i;
                }
            }

            return index;
        }

        public static void Print(this int[] array) {
            for (int i = 0; i < array.Length; ++i) {
                Console.Write("{0} ", array[i]);
            }

            Console.Write(Environment.NewLine);
        }
    }
}

using System;

public class Program
{
    static public void Main()
    {
        string[] s = Console.ReadLine().Split();
        int q = int.Parse(s[0]);
        int w = int.Parse(s[1]);
        int e = int.Parse(s[2]);
        int r = int.Parse(s[3]);
        int t = int.Parse(s[4]);
        if ((q + w + e + r + t) > 0 && (q + w + e + r + t) % 5 == 0) Console.WriteLine((q + w + e + r + t) / 5);
        else Console.WriteLine("-1");
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = 0;
            string s = Console.ReadLine();
            string [] numbers = s.Split(new char[]{' '});
            int[] a = new int[numbers.Length];
            for (int i = 0; i < numbers.Length; ++i)
            {
                a[i] = Int32.Parse(numbers[i]);
                k = k + a[i];
            }

            if ((k % 5 == 0) &&(k !=0)) Console.WriteLine(k / 5);
            else Console.WriteLine("-1");

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();
            int b;
            b = num[0] + num[1] + num[2] + num[3] + num[4];

            if (b%5==0 && b!=0)
            {
                Console.WriteLine(b / 5);
            }
            else
            {
                Console.WriteLine(-1);
            }

            Console.ReadLine();

        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var d=ria();
		int cnt=0;
		for(int i=0;i<d.Length;i++){
			cnt+=d[i];
		}

		if(cnt==0){
			Console.WriteLine(-1);
			return;
		}
		if(cnt%d.Length==0){
			Console.WriteLine(cnt/d.Length);
			return;
		}
		Console.WriteLine(-1);

	}

	public Sol(){
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] arr = Console.ReadLine().Split(' ');
            int[] A = new int[5];
            for (int i = 0; i < 5; i++)
            {
                A[i] = Convert.ToInt32(arr[i]);
            }
            int sum = 0;
            for (int i = 0; i < 5; i++)
            {
                sum += A[i];
            }
            if (sum < 5 ) Console.WriteLine(-1);
            else if (sum % 5 == 0) Console.WriteLine(sum/5);
            else Console.WriteLine(-1);
            Console.ReadLine();
        }
    }
}

using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;

namespace Codeforces
{
	internal class Template
	{
		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
#if !ONLINE_JUDGE
			//Console.SetIn(new StreamReader(@"C:\CodeForces\input.txt"));
#endif
			new Template().Solve();
			Console.ReadLine();
		}

		private void Solve()
		{
			var sum = 0;
			for (var i = 0; i < 5; i++)
			{
				sum += cin.NextInt();
			}
			if (sum%5 == 0 && sum > 0)
			{
				Console.WriteLine(sum/5);
			}
			else
			{
				Console.WriteLine(-1);
			}
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = { ' ' };

		public string NextString()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

		public double NextDouble()
		{
			return double.Parse(NextString());
		}

		public int NextInt()
		{
			return int.Parse(NextString());
		}

		public long NextLong()
		{
			return long.Parse(NextString());
		}
	}
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        private static void MyMain()
        {
            int[] coins = RInts();
            int sum = coins.Sum();
            if (sum % 5 == 0)
            {
                WLine(sum/5 !=0?sum/5:-1);
                return;
            }
            WLine(-1);
        }

        static void Main()
        {
#if !HOME
            MyMain();
#else
            var tmp = Console.In;
            Console.SetIn(new StreamReader("in.txt"));
            while (Console.In.Peek() > 0)
            {
                MyMain();
            }
            Console.In.Close();
            Console.SetIn(tmp);
            Console.ReadKey();
#endif
        }

        #region Utils
        static string RLine()
        {
            return Console.ReadLine();
        }

        static int RInt()
        {
            var str = Console.ReadLine();
            return Convert.ToInt32(str);
        }

        static int[] RInts()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));
        }

        static void RInts(out int a, out int b)
        {
            var ints = RInts();
            a = ints[0];
            b = ints[1];
        }

        static void WLine<T>(T s)
        {
            Console.WriteLine(s);
        }
        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static int[] ReadInt(int size)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] res = new int[size];
            for (int i=0; i<input.Length; i++)
            {
                res[i] = Convert.ToInt32(input[i]);
            }
            return res;
        }

        static int ReadInt()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            return n;
        }

        static void ReadInt(out int a, out int b)
        {
            int[] input = ReadInt(2);
            a = input[0];
            b = input[1];
        }

        static void ReadInt(out int a, out int b, out int c)
        {
            int[] input = ReadInt(3);
            a = input[0];
            b = input[1];
            c = input[2];
        }

        static String ReadString()
        {
            return Console.ReadLine();
        }

        static int Max(int a, int b)
        {
            return (a > b ? a : b);
        }

        static void WL<T> (T s)
        {
            Console.WriteLine(s);
        }

        static void swap(ref int a, ref int b)
        {
            int temp = a;
            a = b;
            b = temp;
        }

        static void Main(string[] args)
        {
            int[] input = ReadInt(5);
            int sum = 0;
            for (int i = 0; i < 5; i++) sum += input[i];
            if (sum % 5 == 0 && sum > 0) WL(sum / 5); else WL(-1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            int b;
            var num = Console.ReadLine().Split().Select(e=>Convert.ToInt32(e)).ToList();
            b = num[0] + num[1] + num[2] + num[3] + num[4];
            if (b % 5 == 0 && b!=0)
            {
                Console.WriteLine(b / 5);
            }
            else
                Console.WriteLine(-1);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class dr:IComparable<dr>
{
    public long a, b;
    public dr(string s)
    {
        string[] f = s.Split();
        a = long.Parse(f[0]);
        b = long.Parse(f[1]);
    }
    public int CompareTo(dr d)
    {
        return this.a.CompareTo(d.a);
    }

}
namespace ConsoleApplication235
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int sum = 0;
            for (int i = 0; i < 5; i++)
            {
                sum += int.Parse(s[i]);
            }
            if (sum%5!=0||sum==0)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(sum/5);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InitialBet
{
    class Program
    {

        static void Main(string[] args)
        {
            var input = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s)).Sum();
            Console.WriteLine(input > 0 ? (input % 5 == 0 ? input / 5 : -1) : -1);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication34
{

    class Program
    {
        static void Main(string[] args)
        {
            int s = 0;
            string[] q = Console.ReadLine().Split(); ;

            int a = int.Parse(q[0]);
            int b = int.Parse(q[1]);
            int c = int.Parse(q[2]);
            int d = int.Parse(q[3]);
            int e = int.Parse(q[4]);
            s = a + b + c + e + d ;

            if (s%5==0&&s!=0)
                Console.WriteLine(s/5);
            else
                Console.WriteLine(-1);

        }
    }
}

using System;
using System.Linq;

class A478 {
    public static void Main() {
        var sum = Console.ReadLine().Split().Sum(int.Parse);
        Console.WriteLine(sum != 0 && sum % 5 == 0 ? sum / 5 : -1);
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(File.OpenText("in.txt"));
            var data = Console.ReadLine().Split().Select(d => int.Parse(d)).ToArray();
            var sum = data.Sum();
            var rem = sum % data.Length;
            if (rem != 0)
            {
                Console.WriteLine("-1");
            }
            else
            {
                var r = sum / data.Length;
                if (r == 0)
                {
                    Console.WriteLine("-1");
                    return;
                }

                Console.WriteLine(r);
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Initial_Bet
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] r = Console.ReadLine().Split(' ');
            int suma = 0;
            for (int i = 0; i < 5; i++)
            {
                suma += int.Parse(r[i]);
            }
            if (suma % 5 == 0 && suma != 0) Console.WriteLine(suma / 5);
            else Console.WriteLine("-1");
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces_478A_Initial_Bet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] player = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if ((player.Sum() % 5 != 0)||(player.Sum()==0))
                Console.WriteLine("-1");
            else
                Console.WriteLine(player.Sum() / 5);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication6
{

    class Program
    {
        static void Main(string[] args)
        {
            int s;

            string str1 = Console.ReadLine();
            int[] massiv = new int[5];
            string[] str2 = str1.Split(' ');
            for (int i = 0; i < 5; i++) {
                massiv[i] = int.Parse(str2[i]);
            }
            s = massiv[0] + massiv[1] + massiv[2] + massiv[3] + massiv[4];
            if ((s % 5 == 0)&&(s>=5))
            {
                Console.WriteLine(s / 5);
            }
            else { Console.WriteLine("-1"); }
            Console.ReadLine();

        }

    }
}

using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		var c = Console.ReadLine().Split().Select(int.Parse);
		Console.WriteLine(c.Sum() % 5 == 0  && c.Sum() > 0 ? c.Average() : -1);
	}
}

using System;
using System.Linq;

public class InitialBet
{
    private static void Main()
    {
    	var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

		var sum = input.Sum();
    	Console.WriteLine(sum > 0 && sum % input.Length == 0 ? sum / input.Length : -1);
    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _478A
    {
        public static void Main(string[] args)
        {
            int[] coins = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int sum = coins.Sum();

            Console.WriteLine(sum > 0 && sum % coins.Length == 0 ? sum / coins.Length : -1);
        }
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries);
            int rs = 0;
            for (int i = 0; i < input.Length;)
                rs += int.Parse(input[i++]);
            Console.WriteLine(rs % 5 == 0 && rs>0 ? (rs / 5).ToString() : "-1");
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
namespace Solver
{

    public class Solver
    {
        public void Solve()
        {
            var sum = sc.Integer(5).Sum();
            if (sum % 5 == 0 && sum / 5 > 0)
            {
                IO.Printer.Out.PrintLine(sum / 5);
                return;
            }
            IO.Printer.Out.PrintLine(-1);

        }
        internal IO.StreamScanner sc;
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            System.Diagnostics.Debug.AutoFlush = false;
            var sw = new Watch();
            sw.Start();
            try
            {
#endif
                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                IO.Printer.Out = new IO.Printer(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                System.Diagnostics.Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}
#region IO Helper
namespace Solver.IO
{
    public class Printer
    {
        static Printer()
        {
            Out = new Printer(Console.Out);
        }
        public static Printer Out { get; set; }
        private readonly System.IO.TextWriter writer;
        private readonly System.Globalization.CultureInfo info;
        public string Separator { get; set; }
        public string NewLine { get { return writer.NewLine; } set { writer.NewLine = value ?? "\n"; } }
        public Printer(System.IO.TextWriter tw = null, System.Globalization.CultureInfo ci = null, string separator = null, string newLine = null)
        {
            writer = tw ?? System.IO.TextWriter.Null;
            info = ci ?? System.Globalization.CultureInfo.InvariantCulture;
            NewLine = newLine;
            Separator = separator ?? " ";
        }
        public void Print(int num) { writer.Write(num.ToString(info)); }
        public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }
        public void Print(long num) { writer.Write(num.ToString(info)); }
        public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }
        public void Print(double num) { writer.Write(num.ToString("F12", info)); }
        public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }
        public void Print(string str) { writer.Write(str); }
        public void Print(string format, params object[] arg) { writer.Write(string.Format(info, format, arg)); }
        public void Print<T>(string format, IEnumerable<T> sources) { writer.Write(format, sources.OfType<object>().ToArray()); }
        public void Print(IEnumerable<char> sources) { writer.Write(sources.AsString()); }
        public void Print<T>(IEnumerable<T> sources)
        {
            var res = new System.Text.StringBuilder();
            foreach (var x in sources)
            {
                res.AppendFormat(info, "{0}", x);
                if (string.IsNullOrEmpty(Separator))
                    res.Append(Separator);
            }
            writer.Write(res.ToString(0, res.Length - Separator.Length));
        }
        public void PrintLine() { writer.WriteLine(); }
        public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }
        public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }
        public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }
        public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }
        public void PrintLine(double num) { writer.WriteLine(num.ToString("F12", info)); }
        public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }
        public void PrintLine(string str) { writer.WriteLine(str); }
        public void PrintLine(string format, params object[] arg) { writer.WriteLine(string.Format(info, format, arg)); }
        public void PrintLine<T>(string format, IEnumerable<T> sources) { writer.WriteLine(format, sources.OfType<object>().ToArray()); }
        public void PrintLine<T>(IEnumerable<T> sources)
        {
            var res = new StringBuilder();
            foreach (var x in sources)
            {
                res.AppendFormat(info, "{0}", x);
                if (!string.IsNullOrEmpty(Separator))
                    res.Append(Separator);
            }
            writer.WriteLine(res.ToString(0, res.Length - Separator.Length));
        }
        public void Flush() { writer.Flush(); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream)
        {
            iStream = stream;
        }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool EndOfStream { get { return eof; } }
        private byte readByte()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len)
            {
                ptr = 0;
                len = iStream.Read(buf, 0, 1024);
                if (len <= 0)
                {
                    eof = true;
                    return 0;
                }
            }
            return buf[ptr++];
        }
        private bool inSpan(byte c)
        {
            const byte lb = 33, ub = 126;
            return !(c >= lb && c <= ub);
        }
        private byte skip()
        {
            byte b = 0;
            do b = readByte();
            while (!eof && inSpan(b));
            return b;
        }
        public char Char()
        {
            return (char)skip();
        }
        public char[] Char(int n)
        {
            var a = new char[n];
            for (int i = 0; i < n; i++)
                a[i] = (char)skip();
            return a;
        }
        public char[][] Char(int n, int m)
        {
            var a = new char[n][];
            for (int i = 0; i < n; i++)
                a[i] = Char(m);
            return a;
        }
        public string Scan()
        {

            const byte lb = 33, ub = 126;
            if (eof) throw new System.IO.EndOfStreamException();

            do
            {
                while (ptr < len && (buf[ptr] < lb || ub < buf[ptr]))
                {
                    ptr++;
                }
                if (ptr < len)
                    break;
                ptr = 0;
                len = iStream.Read(buf, 0, 1024);
                if (len <= 0)
                {
                    eof = true;
                    return null;
                }
                continue;
            } while (true);

            StringBuilder sb = null;
            do
            {
                var i = ptr;
                while (i < len)
                {
                    if (buf[i] < lb || ub < buf[i])
                    {
                        string s;
                        if (sb != null)
                        {
                            sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                            s = sb.ToString();
                        }
                        else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                        ptr = i + 1;
                        return s;
                    }
                    i++;
                }
                i = len - ptr;
                if (sb == null) sb = new StringBuilder(i + 32);
                sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));
                ptr = 0;
            } while ((len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true;
            return sb.ToString();
        }
        public string[] Scan(int n)
        {
            var a = new string[n];
            for (int i = 0; i < n; i++)
                a[i] = Scan();
            return a;
        }
        public string ScanLine()
        {
            const byte el = 10, cr = 13;
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            do
            {
                var i = ptr;
                while (i < len)
                {
                    if (buf[i] == cr || buf[i] == el)
                    {
                        string s;
                        if (sb != null)
                        {
                            sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                            s = sb.ToString();
                        }
                        else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                        if (buf[i] == cr) i++;
                        if (buf[i] == el) i++;
                        ptr = i;
                        return s;
                    }
                    i++;
                }
                i = len - ptr;
                if (sb == null) sb = new StringBuilder(i + 32);
                sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));
                ptr = 0;
            } while ((len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true;
            return sb.ToString();
        }
        public double Double()
        {
            return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture);
        }
        public double[] Double(int n)
        {
            var a = new double[n];
            for (int i = 0; i < n; i++)
                a[i] = Double();
            return a;
        }
        public int Integer()
        {
            var ret = 0;
            byte b = 0;
            bool isMynus = false;
            const byte zero = 48, nine = 57, mynus = 45;
            do b = readByte();
            while (!eof && !((b >= zero && b <= nine) || b == mynus));

            if (b == mynus)
            {
                isMynus = true;
                b = readByte();
            }
            while (true)
            {
                if (b >= zero && b <= nine)
                {
                    ret = ret * 10 + b - zero;
                }
                else return isMynus ? -ret : ret;
                b = readByte();
            }

        }
        public int[] Integer(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = Integer();
            return a;
        }
        public long Long()
        {
            long ret = 0;
            byte b = 0;
            bool isMynus = false;
            const byte zero = 48, nine = 57, mynus = 45;
            do b = readByte();
            while (!eof && !((b >= zero && b <= nine) || b == mynus));
            if (b == '-')
            {
                isMynus = true;
                b = readByte();
            }
            while (true)
            {
                if (b >= zero && b <= nine)
                    ret = ret * 10 + (b - zero);
                else return isMynus ? -ret : ret;
                b = readByte();
            }

        }
        public long[] Long(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = Long();
            return a;
        }
        public void Flush()
        {
            iStream.Flush();
        }

    }

}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> source)
        {
            return new string(source.ToArray());
        }
        static public string AsJoinedString<T>(this IEnumerable<T> source, string separator = " ")
        {
            return string.Join(separator, source);
        }
        static public T[] Enumerate<T>(this int n, Func<int, T> selector)
        {
            var res = new T[n];
            for (int i = 0; i < n; i++)
                res[i] = selector(i);
            return res;
        }
    }
}
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int sum = 0;
            for (int i = 0; i < 5; i++)
            {
                sum += int.Parse(str[i]);
            }
            if (sum % 5 == 0 && sum / 5 > 0)
            {
                Console.WriteLine(sum / 5);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            int answer = 0;
            for(int i=0; i<input.Length; ++i)
              answer += int.Parse(input[i]);
            Console.WriteLine((((answer%5)==0 && answer>0)?(answer/5):-1));
        }
    }

using System;
using System.Linq;

namespace tren
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (n.Count(x => x == 0) == 5)
            {
                Console.Write(-1);
                return;
            }
            Console.Write(n.Sum() % n.Count() == 0? n.Sum() / n.Count() : -1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace CodeForces.PRACTICE
{
    // Initial Bet (implementation)
    class _478A
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int sum = 0;
            for (int i = 0; i < 5; i++)
                sum += int.Parse(ss[i]);
            if (sum % 5 == 0 && sum > 0) Console.WriteLine(sum / 5); else Console.WriteLine(-1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;

namespace ConsoleApplication1
{
	class Program
	{

		static void Main(string[] args)
		{
			var input = Console.ReadLine();

			var numbers = input.Split(' ');

			var gamble = numbers.Select(number => int.Parse(number)).ToList();

			var sum = gamble.Sum();

			if (sum == 0)
			{
				Console.WriteLine(-1);
			} else
			if (sum%5 == 0)
			{
				Console.WriteLine(sum/5);
			}
			else
			{
				Console.WriteLine(-1);
			}

		}
	}
}

using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Linq;
    using System.Text;

    public class Program
    {
        public static void Main(string[] args)
        {
            var str = Console.ReadLine().Split();
            var c0 = int.Parse(str[0]);
            var c1 = int.Parse(str[1]);
            var c2 = int.Parse(str[2]);
            var c3 = int.Parse(str[3]);
            var c4 = int.Parse(str[4]);
            if (c0 + c1 + c2 + c3 + c4 == 0)
            {
                Console.WriteLine("-1");
                return;
            }
            if ((c0 + c1 + c2 + c3 + c4) % 5 == 0)
            {
                Console.WriteLine((c0 + c1 + c2 + c3 + c4) / 5);
            }
            else
            {
                Console.WriteLine("-1");
            }

        }
    }

using System;
using System.IO;
using System.Text;

namespace Initial_Bet
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            int sum = 0;
            for (int i = 0; i < 5; i++)
            {
                sum += Next();
            }
            if (sum>0 && sum % 5 == 0)
                writer.WriteLine(sum/5);
            else
            {
                writer.WriteLine("-1");
            }
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Class35
    {
        public static void Main()
        {
            string[] s = Console.ReadLine().Split(' ');
            int a1 = int.Parse(s[0]);
            int a2 = int.Parse(s[1]);
            int a3 = int.Parse(s[2]);
            int a4 = int.Parse(s[3]);
            int a5 = int.Parse(s[4]);
            int cnt = a1 + a2 + a3 + a4 + a5;
            if (cnt % 5 != 0 || cnt / 5 == 0)
            Console.WriteLine(-1);
            else
                Console.WriteLine(cnt / 5);
        }
    }
}

using System;
using System.Linq;

namespace Na4alnayaStavka
{
    class Program
    {
        static void Main(string[] args)
        {
            int sum = 0;
            int[] arr = Console.ReadLine().Split(' ').Select(e => {
               sum += Int32.Parse(e);
               return Int32.Parse(e);
            }).ToArray();
            if (sum == 0) {
                Console.WriteLine(-1);
                return;
            }
            Console.WriteLine(sum % arr.Length == 0 ? sum / arr.Length : -1);

        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Olimp
{
    class Program
    {
        public static void Main(string[] arg)
        {
            var str = Console.ReadLine().Split();
            long k = 0;
            foreach (var s in str) k += long.Parse(s);
            if (k % 5 == 0 && k>0) Console.WriteLine(k / 5);
            else Console.WriteLine(-1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] l = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int sum = 0;
            foreach (int i in l)
            {
                sum += i;
            }
            if (sum > 0 && sum % 5 == 0)
            {
                Console.WriteLine(sum / 5);
            }
            else
                Console.WriteLine("-1");

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InitialBet
{
    class Program
    {

        static void Main(string[] args)
        {
            var input = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s)).Sum();
            Console.WriteLine(input > 0 ? (input % 5 == 0 ? input / 5 : -1) : -1);

        }

    }
}

using System;
using System.Collections.Generic;

namespace Olymp
{
	public class Program
	{
		static void Z1A ()
		{
			uint n, m, a;
			string str = Console.ReadLine ();
			string [] strs = str.Split (' ');
			n = UInt32.Parse (strs [0]);
			m = UInt32.Parse (strs [1]);
			a = UInt32.Parse (strs [2]);

			uint nn = n / a;
			if (n % a > 0)
				nn++;
			uint nm = m / a;
			if (m % a > 0)
				nm++;
			ulong result = (ulong)nn * (ulong)nm;
			Console.WriteLine (result);
		}

		static void Z4A ()
		{
			int w = Int32.Parse (Console.ReadLine ());
			if (w % 2 == 0 && w > 2)
				Console.WriteLine ("YES");
			else
				Console.WriteLine ("NO");
		}

		static void Z158A ()
		{
			int n, k;
			string [] strs = Console.ReadLine ().Split (' ');
			n = Int32.Parse (strs [0]);
			k = Int32.Parse (strs [1]);
			strs = Console.ReadLine ().Split (' ');
			int max = 0;
			int i;
			for (i = 0; i < k; i++) {
				max = Int32.Parse (strs [i]);
				if (max == 0) {
					Console.WriteLine (i);
					return;
				}
			}
			int sum = k;
			for (; i < n; i++) {
				if (Int32.Parse (strs [i]) < max)
					break;
				sum++;
			}
			Console.WriteLine (sum);
		}

		static void Z71A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			string str;
			for (int i = 0; i < n; i++) {
				str = Console.ReadLine ();
				if (str.Length > 10) {
					Console.WriteLine (str [0] + (str.Length - 2).ToString () + str [str.Length - 1]);
				} else {
					Console.WriteLine (str);
				}

			}
		}

		static void Z118A ()
		{
			string str = Console.ReadLine ();
			str = str.ToLower ();
			str = str.Replace ("a", "");
			str = str.Replace ("o", "");
			str = str.Replace ("y", "");
			str = str.Replace ("e", "");
			str = str.Replace ("u", "");
			str = str.Replace ("i", "");
			for (int i = 0; i < str.Length; i++) {
				Console.Write ("." + str [i]);
			}

		}

		static void Z50A ()
		{

			string   [] strs = Console.ReadLine ().Split (' ');
			int N = Int32.Parse (strs [0]);
			int M = Int32.Parse (strs [1]);
			int result = 0;
			result = (N / 2) * M;
			N %= 2;
			M /= 2;
			result += M * N;
			Console.WriteLine (result);

		}

		static void Z158B ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			string[] strs = Console.ReadLine ().Split (' ');
			int[] com = new int[4];
			for (int i = 0; i < 4; i++) {
				com [i] = 0;
			}
			int temp = 0;
			for (int i = 0; i < n; i++) {
				temp = Int32.Parse (strs [i]);
				com [temp - 1]++;
			}
			int sum = com [3];
			temp = Math.Min (com [2], com [0]);
			com [2] -= temp;
			com [0] -= temp;
			sum += temp;
			sum += com [2];
			sum += com [1] / 2;
			com [1] %= 2;
			sum += com [1];
			com [0] -= com [1] * 2;
			if (com [0] > 0) {

				sum += com [0] / 4;
				com [0] %= 4;
				if (com [0] > 0)
					sum++;
			}
			Console.WriteLine (sum);

		}

		static void Z231A ()
		{

			int n = Int32.Parse (Console.ReadLine ());
			string[] strs;
			int sum = 0;

			for (int i = 0; i < n; i++) {
				strs = Console.ReadLine ().Split (' ');
				if (Int32.Parse (strs [0]) + Int32.Parse (strs [1]) + Int32.Parse (strs [2]) > 1)
					sum++;
			}
			Console.WriteLine (sum);
		}

		static void Z282A ()
		{

			int n = Int32.Parse (Console.ReadLine ());
			int x = 0;
			string str;
			for (int i = 0; i < n; i++) {
				str = Console.ReadLine ();
				str = str.Replace ("X", "");
				if (str == "++") {
					x++;
				} else {
					x--;
				}
			}
			Console.WriteLine (x);
		}

		static  void Z116A ()
		{

			int n = Int32.Parse (Console.ReadLine ());
			int a = 0, b = 0;
			int sum = 0;
			int max = 0;
			string [] strs;
			for (int i = 0; i < n; i++) {
				strs = Console.ReadLine ().Split (' ');
				a = Int32.Parse (strs [0]);
				b = Int32.Parse (strs [1]);
				sum -= a;
				sum += b;
				if (sum > max) {
					max = sum;
				}
			}
			Console.WriteLine (max);
		}

		static void Z131A ()
		{
			bool caps = true;
			string str = Console.ReadLine ();
			char first = str [0];
			for (int i = 1; i < str.Length; i++) {
				if (str [i] < 'A' || str [i] > 'Z')
					caps = false;
			}
			if (caps) {
				str = str.ToLower ();
				if (first >= 'a' && first <= 'z')
					first = first.ToString ().ToUpper () [0];
				else
					first = first.ToString ().ToLower () [0];
				str = first + str.Substring (1);

			}
			Console.WriteLine (str);
		}

		static void Z96A ()
		{
			string str = Console.ReadLine ();
			int n = 0;
			char ch = 'w';
			for (int i = 0; i < str.Length; i++) {
				if (ch == str [i])
					n++;
				else {
					if (n >= 7) {
						Console.WriteLine ("YES");
						return;
					}
					ch = str [i];
					n = 1;
				}
			}
			if (n < 7)
				Console.WriteLine ("NO");
			else
				Console.WriteLine ("YES");
		}

		static void Z266A ()
		{

			string str = Console.ReadLine ();
			str = Console.ReadLine ();
			int n = 0;
			int m = 0;
			char ch = ' ';
			for (int i = 0; i < str.Length; i++) {
				if (ch == str [i])
					n++;
				else {
					m += n;
					ch = str [i];
					n = 0;
				}
			}
			m += n;
			Console.WriteLine (m);
		}

		static void Z133A ()
		{
			string str = Console.ReadLine ();
			for (int i = 0; i < str.Length; i++) {
				if (str [i] == 'H' || str [i] == 'Q' || str [i] == '9') {

					Console.WriteLine ("YES");
					return;
				}

			}
			Console.WriteLine ("NO");

		}

		static void Z112A ()
		{
			string str1 = Console.ReadLine ();
			str1 = str1.ToLower ();
			string str2 = Console.ReadLine ();
			str2 = str2.ToLower ();
			int n = String.Compare (str1, str2);
			if (n != 0)
				Console.WriteLine (n / Math.Abs (n));
			else
				Console.WriteLine (0);
		}

		static void Z339A ()
		{
			int [] ch = new int[3];
			for (int i = 0; i < 3; i++) {
				ch [i] = 0;
			}
			string str = Console.ReadLine ();
			bool flag = false;
			for (int i = 0; i < str.Length; i++) {
				if (flag)
					i++;
				else
					flag = true;
				ch [Int32.Parse (str [i].ToString ()) - 1]++;
			}
			int j = 0;
			flag = false;
			while (j<3) {
				ch [j]--;

				if (ch [j] >= 0) {
					if (flag) {
						Console.Write ("+");
					} else
						flag = true;
					Console.Write (j + 1);
				} else
					j++;
			}
		}

		static void Z281A ()
		{
			string str = Console.ReadLine ();
			string f = str [0].ToString ();
			f = f.ToUpper ();
			str = f [0] + str.Substring (1);
			Console.Write (str);
		}

		static void Z82A ()
		{
			string[] names = new	string[5];
			names [0] = "Sheldon";
			names [1] = "Leonard";
			names [2] = "Penny";
			names [3] = "Rajesh";
			names [4] = "Howard";
			int n = Int32.Parse (Console.ReadLine ());
			int m = 5;
			while (m<n) {
				n -= m;
				m *= 2;
			}
			m /= 5;
			int i = 0;
			while (m<n) {
				n -= m;
				i++;
			}
			Console.Write (names [i]);
		}

		static void Z160A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			string[] str = Console.ReadLine ().Split (' ');
			List<int> moneys = new List<int> ();
			int sum = 0;
			for (int i = 0; i < n; i++) {
				moneys.Add (Int32.Parse (str [i]));
				sum += moneys [i];
			}

			int[] armon = moneys.ToArray ();
			Array.Sort (armon);
			int blz = 0;
			int j = armon.Length - 1;
			int ni = 0;
			while (blz<=sum&&j>=0) {
				blz += armon [j];
				sum -= armon [j];
				j--;
				ni++;
			}
			Console.WriteLine (ni);
		}

		static void Z148A ()
		{
			int k = Int32.Parse (Console.ReadLine ());
			int l = Int32.Parse (Console.ReadLine ());
			int m = Int32.Parse (Console.ReadLine ());
			int n = Int32.Parse (Console.ReadLine ());
			int d = Int32.Parse (Console.ReadLine ());
			int sum = 0;

			for (int i = 1; i <= d; i++) {
				if (i % k == 0 || i % l == 0 || i % m == 0 || i % n == 0)
					sum++;
			}
			Console.WriteLine (sum);
		}

		static void Z236A ()
		{
			string str = Console.ReadLine ();
			int n = 0;
			string ne = "";
			bool k;
			for (int i = 0; i < str.Length; i++) {
				k = false;
				for (int j = 0; j < ne.Length; j++) {
					if (str [i] == ne [j]) {
						k = true;
					}
				}
				if (!k) {
					ne += str [i];
					n++;
				}
			}
			if (n % 2 == 0) {
				Console.WriteLine ("CHAT WITH HER!");
			} else {
				Console.WriteLine ("IGNORE HIM!");
			}
		}

		static int gdc (int left, int right)
		{
			while (left>0&&right>0) {
				if (left > right) {
					left %= right;
				} else
					right %= left;
			}
			return left + right;
		}

		static void Z119A ()
		{
			string[] str = Console.ReadLine ().Split (' ');
			int[] ab = new int[2];

			ab [0] = Int32.Parse (str [0]);
			ab [1] = Int32.Parse (str [1]);
			int n = Int32.Parse (str [2]);
			int i = 0;
			int m;
			while (true) {
				if (n == 0) {
					Console.WriteLine ((i + 1) % 2);
					return;
				}
				m = gdc (ab [i], n);
				n -= m;
				i = (i + 1) % 2;

			}

		}

		static void Z110A ()
		{
			string str = Console.ReadLine ();
			int n = 0;
			for (int i = 0; i < str.Length; i++) {
				if (str [i] == '4' || str [i] == '7') {
					n++;
				}
			}
			if (n == 4 || n == 7) {
				Console.WriteLine ("YES");
			} else {
				Console.WriteLine ("NO");
			}
		}

		static void Z467A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			int res = 0;
			string [] strs;
			for (int i = 0; i < n; i++) {
				strs = Console.ReadLine ().Split (' ');
				if (Int32.Parse (strs [1]) - Int32.Parse (strs [0]) >= 2) {
					res++;
				}
			}
			Console.WriteLine (res);
		}

		static void Z271A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			int [] ye = new int[4];
			n++;
			for (int i = 0; i < 4; i++) {
				ye [i] = n / 1000;
				n %= 1000;
				n *= 10;
			}
			bool flag = true;
			while (flag) {
				for (int i = 0; i < 4; i++) {
					for (int j = 0; j < i; j++) {
						if (ye [i] == ye [j]) {
							ye [i]++;

							for (int k = i+1; k < 4; k++) {
								ye [k] = 0;
							}
							i--;
						}
					}
				}
				flag = false;
				for (int i = 1; i < 4; i++) {
					if (ye [i] == 10) {
						ye [i] %= 10;
						ye [i - 1]++;
						flag = true;
					}
				}
			}
			for (int i = 0; i < 4; i++) {
				Console.Write (ye [i]);
			}

		}

		static void Z58A ()
		{
			string str = Console.ReadLine ();
			str.ToLower ();
			string sstr = "hello";
			int j = 0;
			for (int i = 0; i < str.Length; i++) {
				if (sstr [j] == str [i])
					j++;
				if (j == sstr.Length) {
					Console.WriteLine ("YES");
					return;
				}
			}
			Console.WriteLine ("NO");
		}

		static void Z472A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			if (n % 2 == 0) {
				Console.Write ("4 ");
				Console.Write (n - 4);
			} else {
				Console.Write ("9 ");
				Console.Write (n - 9);
			}
		}

		static void Z460A ()
		{
			int res = 0;
			int days = 0;
			string[] strs = Console.ReadLine ().Split (' ');
			int nosk = Int32.Parse (strs [0]);
			int nd = Int32.Parse (strs [1]);
			while (nosk!=0) {
				days += nosk;
				res += nosk;
				nosk = 0;
				nosk = days / nd;
				days %= nd;
			}
			Console.Write (res);
		}

		static void Z379A ()
		{
			string[] strs = Console.ReadLine ().Split (' ');
			int a = Int32.Parse (strs [0]);
			int b = Int32.Parse (strs [1]);
			int ogaroks = 0;
			int h = 0;
			while (a!=0) {
				h += a;
				ogaroks += a;
				a = ogaroks / b;
				ogaroks %= b;
			}
			Console.WriteLine (h);
		}

		static bool IsLucky (int n)
		{
			while (n>0) {
				int m = n % 10;
				if (m != 4 && m != 7) {
					return false;
				}
				n /= 10;
			}
			return true;
		}

		static void Z122A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			for (int i = 2; i <= n; i++) {
				if (n % i == 0 && IsLucky (i)) {
					Console.WriteLine ("YES");
					return;
				}
			}
			Console.WriteLine ("NO");
		}

		static void Z136A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			int[] pod = new int[n];
			string[] strs = Console.ReadLine ().Split (' ');
			for (int i = 0; i < n; i++) {
				pod [Int32.Parse (strs [i]) - 1] = i + 1;
			}
			for (int i = 0; i < n; i++) {
				Console.Write (pod [i].ToString () + " ");
			}
		}

		static void Z228A ()
		{
			string[] strs = Console.ReadLine ().Split (' ');
			List<int> n = new List<int> ();
			for (int i = 0; i < 4; i++) {
				bool flag = true;
				for (int j = 0; j < n.Count; j++) {
					if (Int32.Parse (strs [i]) == n [j]) {
						flag = false;
						break;
					}
				}
				if (flag) {
					n.Add (Int32.Parse (strs [i]));
				}
			}
			Console.WriteLine (4 - n.Count);
		}

		static void Z263A ()
		{
			string[] strs;
			int x = 0, y = 0;
			for (int i = 0; i < 5; i++) {
				strs = Console.ReadLine ().Split (' ');
				for (int j = 0; j < 5; j++) {
					if (strs [j] == "1") {
						x = j + 1;
						y = i + 1;
					}
				}

			}
			Console.WriteLine ((Math.Abs (3 - x) + Math.Abs (3 - y)));
		}

		static void Z266B ()
		{
			string[] strs = Console.ReadLine ().Split (' ');
			int n = Int32.Parse (strs [0]);
			int t = Int32.Parse (strs [1]);
			string str = Console.ReadLine ();
			char[] chs = new char[str.Length];
			for (int i = 0; i < str.Length; i++) {
				chs [i] = str [i];
			}
			for (int i = 0; i < t; i++) {
				int j = 0;
				while (j+1<n) {
					if (chs [j] == 'B' && chs [j + 1] == 'G') {
						char ch = chs [j];
						chs [j] = chs [j + 1];
						chs [j + 1] = ch;
						j += 2;
					} else {
						j++;
					}
				}
			}
			for (int i = 0; i < chs.Length; i++) {
				Console.Write (chs [i]);
			}

		}

		static void Z41A ()
		{
			string str1 = Console.ReadLine ();
			string str2 = Console.ReadLine ();
			if (str1.Length != str2.Length) {
				Console.WriteLine ("NO");
				return;
			}
			for (int i = 0; i < str1.Length; i++) {
				if (str1 [i] != str2 [str2.Length - i - 1]) {

					Console.WriteLine ("NO");
					return;
				}
			}
			Console.WriteLine ("YES");
		}

		static void Z144A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			string[] strs = Console.ReadLine ().Split (' ');
			int[] rost = new int[n];
			int max = 0;
			int min = n - 1;
			for (int i = 0; i < n; i++) {
				rost [i] = Int32.Parse (strs [i]);
				if (rost [i] > rost [max])
					max = i;
			}
			int sum = 0;
			while (max!=0) {
				int temp = rost [max];
				rost [max] = rost [max - 1];
				rost [max - 1] = temp;
				sum++;
				max--;
			}

			for (int i = n-1; i >=0; i--) {

				if (rost [i] < rost [min]) {
					min = i;
				}
			}
			while (min!=rost.Length-1) {
				int temp = rost [min];
				rost [min] = rost [min + 1];
				rost [min + 1] = temp;
				sum++;
				min++;
			}
			Console.WriteLine (sum);
		}

		static void Z451A ()
		{
			string[] names = new string[2];
			names [0] = "Akshat";
			names [1] = "Malvika";
			string[] strs = Console.ReadLine ().Split (' ');
			int n = Int32.Parse (strs [0]);
			int m = Int32.Parse (strs [1]);
			n = Math.Min (n, m) - 1;
			n %= 2;
			Console.WriteLine (names [n]);

		}

		static void Z344A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			int ostr = 1;
			string str = Console.ReadLine ();
			char ch = str [1];
			for (int i = 1; i < n; i++) {
				str = Console.ReadLine ();
				if (ch == str [0]) {
					ostr++;
				}
				ch = str [1];
			}
			Console.WriteLine (ostr);
		}

		static void Z486A ()
		{
			long n = Int64.Parse (Console.ReadLine ());
			long sum = n / 2;
			sum -= (n % 2) * n;
			Console.WriteLine (sum);
		}

		static void Z500A ()
		{
			string[] str = Console.ReadLine ().Split (' ');
			int n = Int32.Parse (str [0]);
			int t = Int32.Parse (str [1]);
			int[] a = new int[n - 1];
			str = Console.ReadLine ().Split (' ');
			int j = 0;
			t--;
			for (int i = 0; i < n-1; i++) {
				a [i] = Int32.Parse (str [i]);
				if (i == j)
					j += a [i];
				if (j >= t)
					break;
			}
			if (j == t)
				Console.WriteLine ("YES");
			else
				Console.WriteLine ("NO");
		}

		static void Z61A ()
		{
			string str1 = Console.ReadLine ();
			string str2 = Console.ReadLine ();
			string str3 = "";
			for (int i = 0; i < str1.Length; i++) {
				if (str1 [i] == str2 [i])
					str3 += "0";
				else
					str3 += "1";
			}
			Console.WriteLine (str3);
		}

		static void Z268A ()
		{
			int n = Int32.Parse (Console.ReadLine ());
			int[] h = new int[n];
			int[] a = new int[n];
			string[] strs;
			for (int i = 0; i < n; i++) {
				strs = Console.ReadLine ().Split (' ');
				h [i] = Int32.Parse (strs [0]);
				a [i] = Int32.Parse (strs [1]);
			}
			int sum = 0;
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i != j && h [i] == a [j])
						sum++;
				}
			}
			Console.WriteLine (sum);
		}

		static void Z208A ()
		{
			string str = Console.ReadLine ();
			string[] separ = new string[1];
			separ [0] = "WUB";
			string[] strs = str.Split (separ, StringSplitOptions.RemoveEmptyEntries);
			for (int i = 0; i < strs.Length; i++) {
				Console.Write (strs [i] + " ");
			}
		}

		static void Z478A ()
		{
			string []strs=Console.ReadLine().Split(' ');
			int n=0;
			for (int i = 0; i < 5; i++) {
				n+=Int32.Parse(strs[i]);
			}
			if (n%5==0&&n!=0) {
				Console.WriteLine(n/5);
			}
			else {
				Console.WriteLine(-1);
			}
		}
		public static void Main ()
		{
			Z478A ();
		}

	}
}

using System;
using System.Linq;

public class InitialBet
{
    private static void Main()
    {
    	var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

		var sum = input.Sum();
    	Console.WriteLine(sum > 0 && sum % input.Length == 0 ? sum / input.Length : -1);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            //var n = int.Parse(Console.ReadLine());
             var list = Console.ReadLine().Split().Select(int.Parse).ToList();
            if (list.Sum() % list.Count() == 0 &&list.Sum()!=0)
                Console.WriteLine(list.Sum() / list.Count());
            else
                Console.WriteLine(-1);

            // var are =Console.ReadLine().ToList();
            // var word = Console.ReadLine().Select(s=>s).ToArray();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
    {
        static void Main()
        {

            string[] arr = Console.ReadLine().Split();

            List<int> bets_list = arr.Select(int.Parse).ToList();
            int intial_bet_sum = 0;
            for(int i=0; i < bets_list.Count; i++)
            {
                intial_bet_sum += bets_list[i];
            }

            if(intial_bet_sum == 0){
                Console.WriteLine(-1);
            }else{
             if ((intial_bet_sum % bets_list.Count) == 0)
            {
                Console.WriteLine(intial_bet_sum / bets_list.Count);
            }
            else
            {
                Console.WriteLine(-1);
            }
            }

        }

    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace codefcsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var spl = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).Sum();
            Console.WriteLine( ( (spl % 5 == 0) && (spl > 0)) ? spl/5 : -1 );
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF_478A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);
            if (a.Sum() == 0)
            {
                Console.WriteLine(-1);
                return;
            }

            Array.Sort(a);
            int n = a.Length;

            while (true)
            {
                bool hasChange = false;
                for (int i = 0; i < n - 1; i++)
                {
                    if (a[i] < a[i + 1])
                    {
                        hasChange = true;
                        a[i]++;
                        a[i + 1]--;
                    }
                }
                if (!hasChange) break;
            }

            Console.WriteLine(a.All(x => x == a[0]) ? a[0] : -1);
        }
    }
}

using System;
using System.Linq;

namespace _478A
{
    class Program
    {
        static void Main()
        {
            var s = Console.ReadLine().Split().Sum(x => int.Parse(x));
            Console.WriteLine(s>=5&&s%5==0?s/5:-1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = 0;
            string s = Console.ReadLine();
            string [] numbers = s.Split(new char[]{' '});
            int[] a = new int[numbers.Length];
            for (int i = 0; i < numbers.Length; ++i)
            {
                a[i] = Int32.Parse(numbers[i]);
                k = k + a[i];
            }

            if ((k % 5 == 0) &&(k !=0)) Console.WriteLine(k / 5);
            else Console.WriteLine("-1");

        }
    }
}

using System;
using System.Linq;
class Program
{
    static void Main()
    {
        var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        var r = c.Sum() / 5;
        Console.WriteLine(r * 5 == c.Sum() && c.Sum() != 0 ? r : -1);
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            int answer = 0;
            for(int i=0; i<input.Length; ++i)
              answer += int.Parse(input[i]);
            Console.WriteLine((((answer%5)==0 && answer>0)?(answer/5):-1));
        }
    }

using System;

public class Test
{
	public static void Main()
	{
		string[] tok = Console.ReadLine().Split(' ');
        int sum = 0;
        for(int i = 0; i < 5; i++)
            sum += Int32.Parse(tok[i]);
        if(sum % 5 != 0 || sum == 0)
        {
            Console.WriteLine(-1);
        }else{
            Console.WriteLine(sum / 5);
        }
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication3
{
    public class Program
    {
        public static void Main(string[] args)
        {

            string[] masStr = Console.ReadLine().Split(new string[] { " " },
                StringSplitOptions.RemoveEmptyEntries);
            int res = 0;
            int count = 0;

            int[] masInt = new int[masStr.Length];

            foreach (string str in masStr)
            {
                masInt[count] = int.Parse(str);
                res += masInt[count];
                count++;
            }

            int average = res / masStr.Length;
            if (average > 0 && average * masStr.Length == res)
                Console.WriteLine(average);
            else Console.WriteLine(-1);
        }
    }
}

using System;

public class Program
{
    static public void Main()
    {
        string[] s = Console.ReadLine().Split();
        int q = int.Parse(s[0]);
        int w = int.Parse(s[1]);
        int e = int.Parse(s[2]);
        int r = int.Parse(s[3]);
        int t = int.Parse(s[4]);
        if ((q + w + e + r + t) > 0 && (q + w + e + r + t) % 5 == 0) Console.WriteLine((q + w + e + r + t) / 5);
        else Console.WriteLine("-1");
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Globalization;
using System.Numerics;

namespace Saba
{
    public class Test
    {
        public static void Main()
        {
            ProblemA.MainFunc();
        }
    }

    public static class ProblemA
    {
        public static void MainFunc()
        {
            int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            int sum = 0;
            for (int i = 0; i < coins.Length; i++)
            {
                sum += coins[i];
            }
            int dif = 0;
            int coin = sum / 5;
            if (sum == 0) { Console.WriteLine("-1"); goto end; }
            if (sum % 5 != 0) { Console.WriteLine("-1"); }
            else
            {
                for (int i = 0; i < coins.Length; i++)
                {
                    if (coins[i] < coin) { dif = dif - (coin - coins[i]); }
                    else if (coins[i] > coin) { dif = dif + (coins[i] - coin); }
                }
                if (dif == 0) { Console.WriteLine(coin); }
                else { Console.WriteLine("-1"); }
            }
        end: { }
        }
    }

    public static class ProblemB
    {
        public static BigInteger pairs(BigInteger max, BigInteger min)
        {
            return (max - 1 + min) * (max - 1 - min + 1) / 2;
        }
        public static void MainFunc()
        {
            Int64[] person = Console.ReadLine().Split(' ').Select(x => Convert.ToInt64(x)).ToArray();
            BigInteger n = person[0], m = person[1];
            BigInteger max = pairs(n - (m - 1), 1);
            BigInteger min = 0;
            BigInteger k = n;
            while (k % m != 0)
            {
                k--;
            }
            int ad = 0;
            if (k != n) ad = 1;
            BigInteger minFirst = pairs(k / m, 1);
            BigInteger minSecond = pairs(k / m + ad, 1);
            for (int i = 0; i < m - (n - k); i++)
            {
                min += minFirst;
            }
            for (int i = 0; i < n - k; i++)
            {
                min += minSecond;
            }
            //max = (first >= second) ? max + first + pairs(n - (m - 1), k / m) : max + second + pairs(n - (m - 1), k / m + ad);
            //if (first >= second) { max += first; max += pairs(n - (m - 1), k / m + 1); }
            //else { max += second; max += pairs(n - (m - 1), k / m + ad + 1); }
            Console.WriteLine("{0} {1}", min, max);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _478A
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] str2 = str.Split();
            int a = Convert.ToInt32(str2[0]);
            int b = Convert.ToInt32(str2[1]);
            int c = Convert.ToInt32(str2[2]);
            int d = Convert.ToInt32(str2[3]);
            int e = Convert.ToInt32(str2[4]);
            int sum = a + b + c + d + e;
            if ((sum % 5 == 0)&&(sum>=5)) { Console.WriteLine(sum/5); } else
            {
                Console.WriteLine(-1);
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Initial_Bet
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] ar1 = Console.ReadLine().Split();
            int s = int.Parse(ar1[0]);
            int x = int.Parse(ar1[1]);
            int a = int.Parse(ar1[2]);
            int w = int.Parse(ar1[3]);
            int q = int.Parse(ar1[4]);
            int count = a+s+x+w+q;
            if (count%5==0&&count>0)
            {
                int v = count / 5;
                Console.WriteLine(v);

            }
            else
                Console.WriteLine(-1);

        }
    }
}

using System;
using System.Linq;

public class Test
{
	public static void Main()
	{
		var c = Console.ReadLine().Split().Select(int.Parse);
		Console.WriteLine(c.Sum() % 5 == 0  && c.Sum() > 0 ? c.Average() : -1);
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int s=0;
            for (int i=0; i < c.Length; i++)
                s += c[i];
            if (s == 0)
            {
                Console.WriteLine(-1);
                return;
            }
            if (s % 5 == 0) Console.WriteLine(s / 5); else Console.WriteLine(-1);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
public class Test
{
    public static void Main()
    {
        // your code goes here
        int[] num = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();
        int sum = num.Sum();
        if(sum % 5 != 0 || sum == 0)
             Console.WriteLine(-1);
         else
            Console.WriteLine(sum / 5);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string[] dd = a.Split(new char[] { ' ' });
            int s=0;
            for (int i = 0; i < dd.Length; i++)
                s += Int32.Parse(dd[i].ToString());
            if (s!=0 && s % 5 == 0)
                Console.WriteLine(s / 5);
            else
                Console.WriteLine(-1);

            //Console.WriteLine();
        }
    }
}

using System;
namespace codeCsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            const int n = 5;
            int[] arr = new int[n]; int sum = 0, c;
            string[] s = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                arr[i] = int.Parse(s[i]);
                sum += arr[i];
            }
            if (sum % n == 0 && sum != 0)
                c = sum / 5;
            else
                c = -1;
            Console.Write(c);
        }
    }
}

using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    public class Program
    {

        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            int sum = 0;

            foreach(var a in data)
            {
                sum += Convert.ToInt32(a);
            }

            if (sum == 0)
            {
                Console.WriteLine(-1);
                return;
            }
            Console.WriteLine(sum % 5 == 0 ? sum / 5 : -1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication11
{
    class Program
    {
        static void Main(string[] args)
        {
            int a;
            var num = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();
           a = num[0] + num[1] + num[2] + num[3] + num[4];
            if (a % 5 == 0 && a != 0)
            {
                Console.WriteLine(a / 5);
            }
            else
                Console.WriteLine(-1);
            Console.ReadLine();
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

public class Program
{
	public static void Main()
	{
		var arr=Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
		int sum=arr.Select(x=>x).Sum();
		if(sum>=5 && sum%5==0)
		    Console.WriteLine(sum/5);
		else if(sum<5)
			Console.WriteLine(-1);
		else
			Console.WriteLine(-1);

	}
}

using System;

using System.Linq;

namespace ConsoleApplication14
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string[] v = s.Split(' ');
            int[] n = Array.ConvertAll(v, int.Parse);
            int sum = n.Sum();

            if (sum > 0 && sum % 5 == 0)
            {
                Console.WriteLine(sum/5);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Threading;

namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            var s = Console.ReadLine().Split(' ').Select(Int32.Parse).Sum();

            Console.WriteLine(s > 0 && s % 5 == 0 ? s / 5 : -1);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace Olimp
{
    class Program
    {
        public static void Main(string[] arg)
        {
            var str = Console.ReadLine().Split();
            long k = 0;
            foreach (var s in str) k += long.Parse(s);
            if (k % 5 == 0 && k>0) Console.WriteLine(k / 5);
            else Console.WriteLine(-1);
        }
    }
}

using System;
using System.Collections;
using System.Linq;

namespace mainnm
{
    class main
    {
        static void Main()
        {
            int[] ta = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();

            int sum = ta.Sum();

            if (sum % 5 == 0 && sum != 0) Console.WriteLine(sum / 5);
            else Console.WriteLine(-1);
      }
    }
}

using System;
using System.Linq;

namespace Task_TD
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] lines = Console.ReadLine().Split(' ');

            int c1 = Int32.Parse(lines[0]);
            int c2 = Int32.Parse(lines[1]);
            int c3 = Int32.Parse(lines[2]);
            int c4 = Int32.Parse(lines[3]);
            int c5 = Int32.Parse(lines[4]);

            Console.WriteLine(getResult(c1, c2, c3, c4, c5));

            Console.ReadLine();
        }

        static int getResult(int c1, int c2, int c3, int c4, int c5)
        {
            int sum = c1 + c2 + c3 + c4 + c5;
            if (sum % 5 != 0 || sum == 0)
                return -1;

            return sum / 5;
        }

    }
}

using System;
using System.Linq;

class A478 {
    public static void Main() {
        var sum = Console.ReadLine().Split().Sum(int.Parse);
        Console.WriteLine(sum != 0 && sum % 5 == 0 ? sum / 5 : -1);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication21
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int sum = 0;

            for (int i = 0; i < input.Length; i++)
            {
                sum += int.Parse(input[i]);
            }
            if (sum < 5)
            {
                Console.WriteLine(-1);
                Environment.Exit(0);
            }
            if (sum % 5 == 0)
            {
                Console.WriteLine(sum / 5);
            }
            else
            {
                Console.WriteLine(-1);
            }

        }
    }
}

using System;
using System.Linq;
class Program{
    static void Main(){
        int s = Array.ConvertAll(Console.ReadLine().Split(), int.Parse).Sum();
        Console.WriteLine(s % 5 == 0 & s != 0 ? s / 5 : -1);
    }
}

using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] s = Console.ReadLine().Split(' ');
           int temp=0;
           for (int i=0;i<s.Length;i++)
           {
               temp+=Convert.ToInt32(s[i]);
           }
            if (temp/s.Length*s.Length==temp && temp>0) Console.WriteLine(temp/s.Length);
            else Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;

namespace prA {

    class Program {
#if ONLINE_JUDGE
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
#else
        private static readonly StreamWriter writer = new StreamWriter("output");
        private static readonly StreamReader reader = new StreamReader("input");
#endif
        static void Main(string[] args) {
            int k = Next() + Next() + Next() + Next() + Next();
            writer.WriteLine(k % 5 == 0 && k != 0 ? k / 5 : -1);

            writer.Flush();
#if !ONLINE_JUDGE
            writer.Close();
#endif
        }
        private static int Next() {
            int c;
            int res = 0;
            do {
                c = reader.Read();
                if(c == -1)
                    return res;
            } while(c != '-' && (c < '0' || c > '9'));
            int sign = 1;
            if(c == '-') {
                sign = -1;
                c = reader.Read();
            }
            res = c - '0';
            while(true) {
                c = reader.Read();
                if(c < '0' || c > '9')
                    return res * sign;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;

namespace CodeForces.PRACTICE
{
    // Initial Bet (implementation)
    class _478A
    {
        static void Main(string[] args)
        {
            string[] ss = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
            int sum = 0;
            for (int i = 0; i < 5; i++)
                sum += int.Parse(ss[i]);
            if (sum % 5 == 0 && sum > 0) Console.WriteLine(sum / 5); else Console.WriteLine(-1);
        }
    }
}

using System;
namespace codeCsharp
{
    class Program
    {
        static void Main(string[] args)
        {
            const int n = 5;
            int[] arr = new int[n]; int sum = 0, c;
            string[] s = Console.ReadLine().Split();
            for (int i = 0; i < n; i++)
            {
                arr[i] = int.Parse(s[i]);
                sum += arr[i];
            }
            if (sum % n == 0 && sum != 0)
                c = sum / 5;
            else
                c = -1;
            Console.Write(c);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            string[] dd = a.Split(new char[] { ' ' });
            int s=0;
            for (int i = 0; i < dd.Length; i++)
                s += Int32.Parse(dd[i].ToString());
            if (s!=0 && s % 5 == 0)
                Console.WriteLine(s / 5);
            else
                Console.WriteLine(-1);

            //Console.WriteLine();
        }
    }
}

using System;
namespace R_A_273
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int[] c = new int[5];
            int sum = 0;
            for (int i = 0; i < 5; i++)
            {
                c[i] = int.Parse(s[i]);
                sum += c[i];
            }
            if ((sum % 5 == 0) && (sum >= 5)) Console.WriteLine(sum / 5);
            else Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InitialBet
{
    class Program
    {

        static void Main(string[] args)
        {
            var input = Array.ConvertAll(Console.ReadLine().Split(' '), s => Int32.Parse(s)).Sum();
            Console.WriteLine(input > 0 ? (input % 5 == 0 ? input / 5 : -1) : -1);

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] kubiki = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (kubiki.Sum() != 0 && kubiki.Sum() % 5 == 0)
            {
                Console.WriteLine(kubiki.Sum() / 5);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforce16
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] arr = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(arr.Sum() % 5 == 0 && arr.Sum() != 0? arr.Sum() / 5: -1);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class dr:IComparable<dr>
{
    public long a, b;
    public dr(string s)
    {
        string[] f = s.Split();
        a = long.Parse(f[0]);
        b = long.Parse(f[1]);
    }
    public int CompareTo(dr d)
    {
        return this.a.CompareTo(d.a);
    }

}
namespace ConsoleApplication235
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int sum = 0;
            for (int i = 0; i < 5; i++)
            {
                sum += int.Parse(s[i]);
            }
            if (sum%5!=0)
            {
                Console.WriteLine(-1);
            }
            else
            {
                Console.WriteLine(sum/5);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Class35
    {
        public static void Main()
        {
            string[] s = Console.ReadLine().Split(' ');
            int a1 = int.Parse(s[0]);
            int a2 = int.Parse(s[1]);
            int a3 = int.Parse(s[2]);
            int a4 = int.Parse(s[3]);
            int a5 = int.Parse(s[4]);
            int cnt = a1 + a2 + a3 + a4 + a5;
            if (cnt % 5 != 0 && cnt / 5 != 0)
            Console.WriteLine(-1);
            else
                Console.WriteLine(cnt / 5);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication19
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] vvod = Console.ReadLine().Split(' ');
            int sum = 0;
            bool qwe = true;
            for (int i = 0; i < 5; i++)
            {
                if (Int32.Parse(vvod[i]) < 0) { qwe = false; break;  }
                sum = sum + Int32.Parse(vvod[i]);

            }
            if ((sum % 5 == 0)&(qwe == true)) Console.WriteLine(sum / 5);
            else
                Console.WriteLine("-1");
            //Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static int[] ReadInt(int size)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] res = new int[size];
            for (int i=0; i<input.Length; i++)
            {
                res[i] = Convert.ToInt32(input[i]);
            }
            return res;
        }

        static int ReadInt()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            return n;
        }

        static void ReadInt(out int a, out int b)
        {
            int[] input = ReadInt(2);
            a = input[0];
            b = input[1];
        }

        static void ReadInt(out int a, out int b, out int c)
        {
            int[] input = ReadInt(3);
            a = input[0];
            b = input[1];
            c = input[2];
        }

        static String ReadString()
        {
            return Console.ReadLine();
        }

        static int Max(int a, int b)
        {
            return (a > b ? a : b);
        }

        static void WL<T> (T s)
        {
            Console.WriteLine(s);
        }

        static void swap(ref int a, ref int b)
        {
            int temp = a;
            a = b;
            b = temp;
        }

        static void Main(string[] args)
        {
            int[] input = ReadInt(5);
            int sum = 0;
            for (int i = 0; i < 5; i++) sum += input[i];
            if (sum % 5 == 0) WL(sum / 5); else WL(-1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

class Program
    {
        static void Main()
        {

            string[] arr = Console.ReadLine().Split();

            List<int> bets_list = arr.Select(int.Parse).ToList();
            int intial_bet_sum = 0;
            for(int i=0; i < bets_list.Count; i++)
            {
                intial_bet_sum += bets_list[i];
            }
            //decimal bet = intial_bet_sum / bets_list.Count;
            //double b = intial_bet_sum / bets_list.Count;

            if ((intial_bet_sum % bets_list.Count) == 0)
            {
                Console.WriteLine(intial_bet_sum / bets_list.Count);
            }
            else
            {
                Console.WriteLine(-1);
            }

        }

    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

     class Program
     {
        static void Main(string[] args)
        {
            int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int symma=mas[0]+mas[1]+mas[2]+mas[3]+mas[4];
            if (mas[0] == 0 && mas[1] == 0 && mas[2] == 0 && mas[3] == 0 && mas[4] == 0) { Console.WriteLine("0"); }
            else
            {
            if (symma % 5 == 0) { Console.WriteLine(symma / 5); }
            else { Console.WriteLine("-1"); }
            }
            Console.ReadLine ();
        }
     }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Data_Structure_Train_XX20
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] arr = str.Split(' ');
            int sum = int.Parse(arr[0].ToString()) + int.Parse(arr[1].ToString()) + int.Parse(arr[2].ToString()) +
                 int.Parse(arr[3].ToString()) + int.Parse(arr[4].ToString());
            double sumll = int.Parse(arr[0].ToString()) + int.Parse(arr[1].ToString()) + int.Parse(arr[2].ToString()) +
     int.Parse(arr[3].ToString()) + int.Parse(arr[4].ToString());
            if (((sum / 5) - (sumll / 5)) <=0)
                Console.Write("-1");
            else
                Console.Write(sum / 5);
        }
    }
}

using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    public class Program
    {

        static void Main(string[] args)
        {
            string[] data = Console.ReadLine().Split(' ');
            int sum = 0;

            foreach(var a in data)
            {
                sum += Convert.ToInt32(a);
            }

            Console.WriteLine(sum % 5 == 0 ? sum / 5 : -1);
        }
    }
}

using System;
using System.Text;

namespace Codeforces
{
    class Program
    {

        static void Main( string[] args )
        {
            StartingBid startingBid = new StartingBid( Console.ReadLine().Split( ' ' ) );
            startingBid.PrintStartingBid();
            Console.ReadLine();

        }
    }

    class StartingBid
    {
        private const int person = 5;
        private int[] bids = new int[person];
        public StartingBid( string[] s )
        {
            for ( int i = 0; i < 5; ++i )
            {
                bids[i] = int.Parse( s[i] );
            }
        }
        private int Average( int[] a )
        {
            int average = 0;
            for ( int i = 0; i < person; ++i )
            {
                average += a[i];
            }
            if ( average % person != 0 )
            {
                return -1;
            }
            else
            {
                return average / person;
            }
        }
        public void PrintStartingBid(){
            Console.WriteLine(Average(bids));
        }

    }

}

using System;
using System.Linq;

public class InitialBet
{
    private static void Main()
    {
    	var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

		var sum = input.Sum();
    	Console.WriteLine(sum % input.Length == 0 ? sum / input.Length : -1);
    }
}

using System;

public class Class1
{
    public static void Main()
    {
        bool flag = true;
        string[] bet = Console.ReadLine().Split();
        int count = 0;
        for (int i = 0; i < 5; i++)
        {
            count += Convert.ToInt32(bet[i]);
            if (Convert.ToInt32(bet[i]) == 0)
                flag = false;
        }
        if (count % 5 != 0 || flag == false)
            Console.WriteLine("-1");
        else Console.WriteLine(count/5);
    }
}

using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] s = Console.ReadLine().Split(' ');
           int temp=0;
           for (int i=0;i<s.Length;i++)
           {
               temp+=Convert.ToInt32(s[i]);
           }
            if (temp/s.Length*s.Length==temp) Console.WriteLine(temp/s.Length);
            else Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] l = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int sum = 0;
            foreach (int i in l)
            {
                sum += i;
            }
            if (sum >= 0 && sum % 5 == 0)
            {
                Console.WriteLine(sum / 5);
            }
            else
                Console.WriteLine("-1");

        }
    }
}

using System;

public class Class1
{
	public static void Main()
	{
        string[] bet = Console.ReadLine().Split();
        int count = 0;
        for (int i = 0; i < 5; i++)
            count += Convert.ToInt32(bet[i]);
        if (count % 5 != 0)
            Console.WriteLine("-1");
        else Console.WriteLine(count/5);
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static int[] ReadInt(int size)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] res = new int[size];
            for (int i=0; i<input.Length; i++)
            {
                res[i] = Convert.ToInt32(input[i]);
            }
            return res;
        }

        static int ReadInt()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            return n;
        }

        static void ReadInt(out int a, out int b)
        {
            int[] input = ReadInt(2);
            a = input[0];
            b = input[1];
        }

        static void ReadInt(out int a, out int b, out int c)
        {
            int[] input = ReadInt(3);
            a = input[0];
            b = input[1];
            c = input[2];
        }

        static String ReadString()
        {
            return Console.ReadLine();
        }

        static int Max(int a, int b)
        {
            return (a > b ? a : b);
        }

        static void WL<T> (T s)
        {
            Console.WriteLine(s);
        }

        static void swap(ref int a, ref int b)
        {
            int temp = a;
            a = b;
            b = temp;
        }

        static void Main(string[] args)
        {
            int[] input = ReadInt(5);
            int sum = 0;
            for (int i = 0; i < 5; i++) sum += input[i];
            if (sum % 5 == 0 || sum == 0) WL(sum / 5); else WL(-1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string[] splitStp = str.Split(' ');
            int result = 0;
            for (int i = 0; i < 5; i++)
            {
                result += int.Parse(splitStp[i]);
            }
            if (result % 5 == 0)
            {
                result /= 5;
                Console.WriteLine(result);
            }
            else
                Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            Console.WriteLine((Arr.Sum() % 5 != 0) ? -1 : (Arr.Sum() / 5));
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var num = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();
            int b;
            b = num[0] + num[1] + num[2] + num[3] + num[4];

            if (b%5==0)
            {
                Console.WriteLine(b / 5);
            }
            else
            {
                Console.WriteLine(-1);
            }

            Console.ReadLine();

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InitialBet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            float sum = (float)(a.Sum());
            float check = ((float)sum / 5.0f);
            if (5 * (int)check == (float)sum)
                Console.WriteLine((int)check);
            else
                Console.WriteLine(-1);
            Console.ReadLine();
        }
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            int answer = 0;
            for(int i=0; i<input.Length; ++i)
              answer += int.Parse(input[i]);
            Console.WriteLine(((answer % 5) == 0 ? (answer / 5) : (-1)));
        }
    }

using System;

public class Program
{
    static public void Main()
    {
        string[] s = Console.ReadLine().Split();
        int q = int.Parse(s[0]);
        int w = int.Parse(s[1]);
        int e = int.Parse(s[2]);
        int r = int.Parse(s[3]);
        int t = int.Parse(s[4]);
        if ((q + w + e + r + t) > 0 || (q + w + e + r + t) % 5 == 0) Console.WriteLine((q + w + e + r + t) / 5);
        else Console.WriteLine("-1");
    }
}

using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] s = Console.ReadLine().Split(' ');
           int temp=0;
           for (int i=0;i<s.Length;i++)
           {
               temp+=Convert.ToInt32(s[i]);
           }
            if (temp/s.Length*s.Length==temp) Console.WriteLine(temp/s.Length);
            else Console.WriteLine("-1");
            //HUI;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            var cs = Console.ReadLine().Split().Select(e => Convert.ToInt32(e)).ToList();
            int sum = cs.Sum();
            if (sum % 5 == 0)
                Console.WriteLine(sum / 5);
            else
                Console.WriteLine(-1);
        }
    }
}

using System;
using System.Linq;

public class InitialBet
{
    private static void Main()
    {
    	var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

		var sum = input.Sum();
    	Console.WriteLine(sum > 0 && sum % sum % input.Length == 0 ? sum / input.Length : -1);
    }
}

using System;
using System.Linq;

namespace Na4alnayaStavka
{
    class Program
    {
        static void Main(string[] args)
        {
            int sum = 0;
            int[] arr = Console.ReadLine().Split(' ').Select(e => {
               sum += Int32.Parse(e);
               return Int32.Parse(e);
            }).ToArray();

            Console.WriteLine(sum % arr.Length == 0 ? sum / arr.Length : -1);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace p1
{
    class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();
            String[] inp = input.Split(' ');
            int sum=0;
            for (int i = 0; i < inp.Length; i++)
                sum += int.Parse(inp[i]);
            if (sum % 5 != 0)
                Console.WriteLine(-1);
            else
                Console.WriteLine(sum / 5);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

public static class solver
{
    public static void Main()
    {
        var coins = Console.ReadLine().Split(null).Select(int.Parse).ToArray();
        Console.WriteLine(coins.Sum() % 5 == 0 ? coins.Sum() / 5 : -1);

#if !ONLINE_JUDGE
        Console.ReadLine();
#endif
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace ConsoleApplication13
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] kubiki = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (kubiki.Sum() % 5 == 0)
            {
                Console.WriteLine(kubiki.Sum() / 5);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }
    }
}

using System;

namespace _478A
{
	class Program
	{
		static void Main(string[] args)
		{
			int[] a = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
			int sum = 0;
			for (int i = 0; i < 5; i++)
			{
				sum += a[i];
			}
			Console.WriteLine(sum % 5 == 0 ? sum / 5 : -1);
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Initial_Bet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] omar = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if ( omar.Sum() % 5 == 0)
            {
                Console.WriteLine(omar.Sum()/5);
            }
            else
                Console.WriteLine("-1");

        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;

namespace ConsoleApplication1
{
	class Program
	{

		static void Main(string[] args)
		{
			var input = Console.ReadLine();

			var numbers = input.Split(' ');

			var gamble = numbers.Select(number => int.Parse(number)).ToList();

			var sum = gamble.Sum();

			if (sum%5 == 0)
			{
				Console.WriteLine(sum/5);
			}
			else if (sum == 0)
			{
				Console.WriteLine(0);
			} else
			{
				Console.WriteLine(-1);
			}

		}
	}
}

using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] s = Console.ReadLine().Split(' ');
           int temp=0;
           for (int i=0;i<s.Length;i++)
           {
               temp+=Convert.ToInt32(s[i]);
           }
            if (temp/s.Length*s.Length==temp) Console.WriteLine(temp/s.Length);
            else Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace p1
{
    class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();
            String[] inp = input.Split(' ');
            int sum=0;
            for (int i = 0; i < inp.Length; i++)
                sum += int.Parse(inp[i]);
            if (sum % 5 != 0 && inp.Length!=5)
                Console.WriteLine(-1);
            else
                Console.WriteLine(sum / 5);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
        {

       string[] s = Console.ReadLine().Split(' '); int k=0;
       int[]a=new int[s.Length];
            for( int i=0;i<s.Length;i++)
            {
              a[i] = Convert.ToInt32(s[i]);
            }
            for (int i=0;i<a.Length;i++)
            { k += a[i]; }

            if (k % 5 == 0 || k != 0)
            { Console.WriteLine(k / 5); }
            else Console.WriteLine("-1");

            }
        }

}

using System;

public class Class1
{
    public static void Main()
    {
        bool flag = true;
        string[] bet = Console.ReadLine().Split();
        int count = 0;
        for (int i = 0; i < 5; i++)
        {
            count += Convert.ToInt32(bet[i]);
            if (Convert.ToInt32(bet[i]) == 0)
                flag = false;
        }
        if (count % 5 != 0 || flag == false)
            Console.WriteLine("-1");
        else Console.WriteLine(count/5);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestProblesm
{
    class Program
    {
        static void Main(string[] args)
        {

            int Counter = 0;
            int Result = 0;
            List<int> CoinsNum = new List<int>();
            string[] Coins = Console.ReadLine().Split(' ');
            for (int i = 0; i < Coins.Length; i++)
            {
                CoinsNum.Add(Convert.ToInt32(Coins[i]));
            }

            foreach (int coin in CoinsNum)
            {
                if (coin >= 0 && coin <= 100)
                {
                    Counter += coin;
                }
            }
            if (Counter % 5 == 0)
            {
                Result = Counter / 5;
                Console.WriteLine(Result);
            }
            else
            {
                Result = -1;
                Console.WriteLine(Result);
            }

        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		var d=ria();
		int cnt=0;
		for(int i=0;i<d.Length;i++){
			cnt+=d[i];
		}

		if(cnt==0){
			Console.WriteLine(-1);
		}
		if(cnt%d.Length==0){
			Console.WriteLine(cnt/d.Length);
			return;
		}
		Console.WriteLine(-1);

	}

	public Sol(){
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimusCSharpSolution
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = (from item in Console.ReadLine().Split() select Convert.ToInt32(item)).Sum();
            if (a % 5 == 0)
            {
                Console.WriteLine(a / 5);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
public class Test
{
    public static void Main()
    {
        // your code goes here
        int[] num = Console.ReadLine().Trim().Split().Select(x => int.Parse(x)).ToArray();
        int sum = num.Sum();
        if(sum % num.Length != 0)
             Console.WriteLine(-1);
         else
            Console.WriteLine(sum / num.Length);
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(new char[] {' ', '\t'}, StringSplitOptions.RemoveEmptyEntries);
            int rs = 0;
            for (int i = 0; i < input.Length;)
                rs += int.Parse(input[i++]);
            Console.WriteLine(rs % 5 == 0 ? (rs / 5).ToString() : "-1");
        }
    }

using System;

namespace Issue_478A
{
    class Program
    {
        public static void Main(string[] args) {
            const int CoinsCount = 5;

            var coins = new int[CoinsCount];

            for (int i = 0; i < CoinsCount; ++i) {
                coins[i] = ReadInt();
            }

            var balanced = IsBalanced(coins);

            while (!balanced) {
                var max = coins.MaxIndex();
                var min = coins.MinIndex();

                if (coins[max] - coins[min] == 1) {
                    break;
                }

                coins[max]--;
                coins[min]++;

                balanced = IsBalanced(coins);
            }

            Console.WriteLine(balanced ? coins[0] : -1);
        }

        public static bool IsBalanced(int[] array) {
            if (array.Length == 0)
                return true;

            var value = array[0];

            for (int i = 1; i < array.Length; ++i) {
                if (array[i] != value) {
                    return false;
                }
            }

            return true;
        }

        private static bool IsInputError = false;
        private static bool IsEndOfLine = false;

        private static int ReadInt() {
            const int zeroCode = (int) '0';

            var result = 0;
            var isNegative = false;
            var symbol = Console.Read();
            IsInputError = false;
            IsEndOfLine = false;

            while (symbol == ' ') {
                symbol = Console.Read();
            }

            if (symbol == '-') {
                isNegative = true;
                symbol = Console.Read();
            }

            for ( ;
                (symbol != -1) && (symbol != ' ');
                symbol = Console.Read()
            ) {
                var digit = symbol - zeroCode;

                // if symbol == \n
                if (symbol == 13) {
                    // skip next \r symbol
                    Console.Read();
                    IsEndOfLine = true;
                    break;
                }

                if (digit < 10 && digit >= 0) {
                    var cache1 = result << 1;
                    var cache2 = cache1 << 2;
                    result = cache1 + cache2 + digit;
                } else {
                    IsInputError = true;
                    break;
                }
            }

            return isNegative ? ~result + 1 : result;
        }
    }

    public static class Extensions
    {
        public static int MaxIndex(this int[] array) {
            if (array.Length == 0)
                return -1;

            var value = array[0];
            var index = 0;

            for (int i = 1; i < array.Length; ++i) {
                if (array[i] > value) {
                    value = array[i];
                    index = i;
                }
            }

            return index;
        }

        public static int MinIndex(this int[] array) {
            if (array.Length == 0)
                return -1;

            var value = array[0];
            var index = 0;

            for (int i = 1; i < array.Length; ++i) {
                if (array[i] < value) {
                    value = array[i];
                    index = i;
                }
            }

            return index;
        }

        public static void Print(this int[] array) {
            for (int i = 0; i < array.Length; ++i) {
                Console.Write("{0} ", array[i]);
            }

            Console.Write(Environment.NewLine);
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        private static void MyMain()
        {
            int[] coins = RInts();
            int sum = coins.Sum();
            if (sum % 5 == 0)
            {
                WLine(sum/5);
                return;
            }
            WLine(-1);
        }

        static void Main()
        {
#if !HOME
            MyMain();
#else
            var tmp = Console.In;
            Console.SetIn(new StreamReader("in.txt"));
            while (Console.In.Peek() > 0)
            {
                MyMain();
            }
            Console.In.Close();
            Console.SetIn(tmp);
            Console.ReadKey();
#endif
        }

        #region Utils
        static string RLine()
        {
            return Console.ReadLine();
        }

        static int RInt()
        {
            var str = Console.ReadLine();
            return Convert.ToInt32(str);
        }

        static int[] RInts()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), s => Convert.ToInt32(s));
        }

        static void RInts(out int a, out int b)
        {
            var ints = RInts();
            a = ints[0];
            b = ints[1];
        }

        static void WLine<T>(T s)
        {
            Console.WriteLine(s);
        }
        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int s=0;
            for (int i=0; i < c.Length; i++)
                s += c[i];
            if (s == 0)
            {
                Console.WriteLine(0);
                return;
            }
            if (s % 5 == 0) Console.WriteLine(s / 5); else Console.WriteLine(-1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

     class Program
     {
        static void Main(string[] args)
        {
            int[] mas = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int symma=mas[0]+mas[1]+mas[2]+mas[3]+mas[4];
            if (symma % 5 == 0) { Console.WriteLine(symma / 5); }
            else { Console.WriteLine("-1"); }
            Console.ReadLine ();
        }
     }

#region imports
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;

#endregion

namespace CodeForces
{
    class Problem
    {
        const bool IsContest = true;

        private void Solve()
        {
            var sum = _.Cin.ReadLine().Split(" ".ToCharArray(), 5).Select(int.Parse).Sum();
            _.WriteLine(sum % 5 == 0 ? sum / 5 : -1);
        }

        #region shit
        private readonly InOut _ = new InOut(IsContest);
        static void Main(string[] args)
        {
            var p = new Problem();
            p.Solve();
            p._.Close();
        }
    }
    class InOut
    {
        private const string InputFile = "input.txt";
        private const string OutputFile = "output.txt";
        public StreamWriter Cout { get; private set; }
        public StreamReader Cin { get; private set; }
        private void SetConsoleIo()
        {
            Cin = new StreamReader(new BufferedStream(Console.OpenStandardInput()));
            Cout = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));
        }
        private void SetFileIo(string inputFile, string outputFile) { Cin = new StreamReader(inputFile); Cout = new StreamWriter(outputFile); }
        public InOut() { SetConsoleIo(); }
        public InOut(string inputFile, string outputFile) { SetFileIo(inputFile, outputFile); }
        public InOut(bool isContest) { if (isContest) SetConsoleIo(); else SetFileIo(InputFile, OutputFile); }
        public void WriteLine(object x) { Cout.WriteLine(x); }
        public void Close() { Cin.Close(); Cout.Close(); }
        public void WriteLine(string format, params object[] args) { Cout.WriteLine(format, args); }
        private int _pos;
        private string[] _tokens;
        public string NextToken()
        {
            while (_tokens == null || _pos == _tokens.Length)
            {
                // ReSharper disable once PossibleNullReferenceException
                _tokens = Cin.ReadLine().Split(" \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                _pos = 0;
            }
            return _tokens[_pos++];
        }
        public int NextInt() { return int.Parse(NextToken()); }
        public long NextLong() { return long.Parse(NextToken()); }
        public double NextDouble() { return double.Parse(NextToken(), CultureInfo.InvariantCulture); }

        #endregion
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Globalization;

namespace Saba
{
    public class Test
    {
        public static void Main()
        {
            int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            int sum = 0;
            for (int i = 0; i < coins.Length; i++)
            {
                sum += coins[i];
            }
            int diff = 0;
            for (int i = 0; i < coins.Length; i++)
            {
                if (coins[i] > sum / 5) { diff += coins[i] - sum / 5; }
                else if (coins[i] < sum / 5) { diff -= sum / 5 - coins[i]; }
                else { }
            }
            if (diff == 0) { Console.WriteLine(sum / 5); }
            else { Console.WriteLine("-1"); }
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Globalization;

namespace Saba
{
    public class Test
    {
        public static void Main()
        {
            int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            int sum = 0;
            for (int i = 0; i < coins.Length; i++)
            {
                sum += coins[i];
            }
            int diff = 0;
            int coin = sum / 5;
            for (int i = 0; i < coins.Length; i++)
            {
                if (coins[i] > coin) { diff += (coins[i] - coin); }
                else if (coins[i] < coin) { diff -= (coin - coins[i]); }
                else { }
            }
            if (sum % 5 == 0)
            {
                if (diff == 0) { Console.WriteLine(coin); }
                else { Console.WriteLine("-1"); }
            }
            else Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            int[] l = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int sum = 0;
            foreach (int i in l)
            {
                sum += i;
            }
            if (sum >= 0 && sum % 5 == 0)
            {
                Console.WriteLine(sum / 5);
            }
            else
                Console.WriteLine("-1");

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CF_478A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Convert.ToInt32);
            Array.Sort(a);
            int n = a.Length;

            while (true)
            {
                bool hasChange = false;
                for (int i = 0; i < n - 1; i++)
                {
                    if (a[i] < a[i + 1])
                    {
                        hasChange = true;
                        a[i]++;
                        a[i + 1]--;
                    }
                }
                if (!hasChange) break;
            }

            Console.WriteLine(a.All(x => x == a[0]) ? a[0] : -1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace p1
{
    class Program
    {
        static void Main(string[] args)
        {
            String input = Console.ReadLine();
            String[] inp = input.Split(' ');
            int sum=0;
            for (int i = 0; i < inp.Length; i++)
                sum += int.Parse(inp[i]);
            if (sum % 5 != 0)
                Console.WriteLine(-1);
            else
                Console.WriteLine(sum / 5);
        }
    }
}

using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] s = Console.ReadLine().Split(' ');
           int temp=0;
           for (int i=0;i<s.Length;i++)
           {
               temp+=Convert.ToInt32(s[i]);
           }
            if (temp/s.Length*s.Length==temp) Console.WriteLine(temp/s.Length);
            else Console.WriteLine("-1");
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces_478A_Initial_Bet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] player = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (player.Sum() % 5 != 0)
                Console.WriteLine("-1");
            else
                Console.WriteLine(player.Sum() / 5);
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TimusCSharpSolution
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = (from item in Console.ReadLine().Split() select Convert.ToInt32(item)).Sum();
            if (a % 5 == 0)
            {
                Console.WriteLine(a / 5);
            }
            else
            {
                Console.WriteLine(-1);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace InitialBet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            float sum = (float)(a.Sum());
            float check = ((float)sum / 5.0f);
            if (5 * (int)check == (float)sum)
                Console.WriteLine((int)check);
            else
                Console.WriteLine(-1);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            int b;
            var num = Console.ReadLine().Split().Select(e=>Convert.ToInt32(e)).ToList();
            b = num[0] + num[1] + num[2] + num[3] + num[4];
            if (b % 5 == 0)
            {
                Console.WriteLine(b / 5);
            }
            else
                Console.WriteLine(-1);
            if (b == 0)
                Console.WriteLine(-1);
            Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
namespace Solver
{

    public class Solver
    {
        public void Solve()
        {
            var sum = sc.Integer(5).Sum();
            if (sum % 5 == 0)
            {
                IO.Printer.Out.PrintLine(sum/5);
                return;
            }
            IO.Printer.Out.PrintLine(-1);

        }
        internal IO.StreamScanner sc;
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            System.Diagnostics.Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            System.Diagnostics.Debug.AutoFlush = false;
            var sw = new Watch();
            sw.Start();
            try
            {
#endif
                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                IO.Printer.Out = new IO.Printer(new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                System.Diagnostics.Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}
#region IO Helper
namespace Solver.IO
{
    public class Printer
    {
        static Printer()
        {
            Out = new Printer(Console.Out);
        }
        public static Printer Out { get; set; }
        private readonly System.IO.TextWriter writer;
        private readonly System.Globalization.CultureInfo info;
        public string Separator { get; set; }
        public string NewLine { get { return writer.NewLine; } set { writer.NewLine = value ?? "\n"; } }
        public Printer(System.IO.TextWriter tw = null, System.Globalization.CultureInfo ci = null, string separator = null, string newLine = null)
        {
            writer = tw ?? System.IO.TextWriter.Null;
            info = ci ?? System.Globalization.CultureInfo.InvariantCulture;
            NewLine = newLine;
            Separator = separator ?? " ";
        }
        public void Print(int num) { writer.Write(num.ToString(info)); }
        public void Print(int num, string format) { writer.Write(num.ToString(format, info)); }
        public void Print(long num) { writer.Write(num.ToString(info)); }
        public void Print(long num, string format) { writer.Write(num.ToString(format, info)); }
        public void Print(double num) { writer.Write(num.ToString("F12", info)); }
        public void Print(double num, string format) { writer.Write(num.ToString(format, info)); }
        public void Print(string str) { writer.Write(str); }
        public void Print(string format, params object[] arg) { writer.Write(string.Format(info, format, arg)); }
        public void Print<T>(string format, IEnumerable<T> sources) { writer.Write(format, sources.OfType<object>().ToArray()); }
        public void Print(IEnumerable<char> sources) { writer.Write(sources.AsString()); }
        public void Print<T>(IEnumerable<T> sources)
        {
            var res = new System.Text.StringBuilder();
            foreach (var x in sources)
            {
                res.AppendFormat(info, "{0}", x);
                if (string.IsNullOrEmpty(Separator))
                    res.Append(Separator);
            }
            writer.Write(res.ToString(0, res.Length - Separator.Length));
        }
        public void PrintLine() { writer.WriteLine(); }
        public void PrintLine(int num) { writer.WriteLine(num.ToString(info)); }
        public void PrintLine(int num, string format) { writer.WriteLine(num.ToString(format, info)); }
        public void PrintLine(long num) { writer.WriteLine(num.ToString(info)); }
        public void PrintLine(long num, string format) { writer.WriteLine(num.ToString(format, info)); }
        public void PrintLine(double num) { writer.WriteLine(num.ToString("F12", info)); }
        public void PrintLine(double num, string format) { writer.WriteLine(num.ToString(format, info)); }
        public void PrintLine(string str) { writer.WriteLine(str); }
        public void PrintLine(string format, params object[] arg) { writer.WriteLine(string.Format(info, format, arg)); }
        public void PrintLine<T>(string format, IEnumerable<T> sources) { writer.WriteLine(format, sources.OfType<object>().ToArray()); }
        public void PrintLine<T>(IEnumerable<T> sources)
        {
            var res = new StringBuilder();
            foreach (var x in sources)
            {
                res.AppendFormat(info, "{0}", x);
                if (!string.IsNullOrEmpty(Separator))
                    res.Append(Separator);
            }
            writer.WriteLine(res.ToString(0, res.Length - Separator.Length));
        }
        public void Flush() { writer.Flush(); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream)
        {
            iStream = stream;
        }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool EndOfStream { get { return eof; } }
        private byte readByte()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len)
            {
                ptr = 0;
                len = iStream.Read(buf, 0, 1024);
                if (len <= 0)
                {
                    eof = true;
                    return 0;
                }
            }
            return buf[ptr++];
        }
        private bool inSpan(byte c)
        {
            const byte lb = 33, ub = 126;
            return !(c >= lb && c <= ub);
        }
        private byte skip()
        {
            byte b = 0;
            do b = readByte();
            while (!eof && inSpan(b));
            return b;
        }
        public char Char()
        {
            return (char)skip();
        }
        public char[] Char(int n)
        {
            var a = new char[n];
            for (int i = 0; i < n; i++)
                a[i] = (char)skip();
            return a;
        }
        public char[][] Char(int n, int m)
        {
            var a = new char[n][];
            for (int i = 0; i < n; i++)
                a[i] = Char(m);
            return a;
        }
        public string Scan()
        {

            const byte lb = 33, ub = 126;
            if (eof) throw new System.IO.EndOfStreamException();

            do
            {
                while (ptr < len && (buf[ptr] < lb || ub < buf[ptr]))
                {
                    ptr++;
                }
                if (ptr < len)
                    break;
                ptr = 0;
                len = iStream.Read(buf, 0, 1024);
                if (len <= 0)
                {
                    eof = true;
                    return null;
                }
                continue;
            } while (true);

            StringBuilder sb = null;
            do
            {
                var i = ptr;
                while (i < len)
                {
                    if (buf[i] < lb || ub < buf[i])
                    {
                        string s;
                        if (sb != null)
                        {
                            sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                            s = sb.ToString();
                        }
                        else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                        ptr = i + 1;
                        return s;
                    }
                    i++;
                }
                i = len - ptr;
                if (sb == null) sb = new StringBuilder(i + 32);
                sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));
                ptr = 0;
            } while ((len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true;
            return sb.ToString();
        }
        public string[] Scan(int n)
        {
            var a = new string[n];
            for (int i = 0; i < n; i++)
                a[i] = Scan();
            return a;
        }
        public string ScanLine()
        {
            const byte el = 10, cr = 13;
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            do
            {
                var i = ptr;
                while (i < len)
                {
                    if (buf[i] == cr || buf[i] == el)
                    {
                        string s;
                        if (sb != null)
                        {
                            sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                            s = sb.ToString();
                        }
                        else s = new string(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i - ptr));
                        if (buf[i] == cr) i++;
                        if (buf[i] == el) i++;
                        ptr = i;
                        return s;
                    }
                    i++;
                }
                i = len - ptr;
                if (sb == null) sb = new StringBuilder(i + 32);
                sb.Append(System.Text.UTF8Encoding.Default.GetChars(buf, ptr, i));
                ptr = 0;
            } while ((len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true;
            return sb.ToString();
        }
        public double Double()
        {
            return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture);
        }
        public double[] Double(int n)
        {
            var a = new double[n];
            for (int i = 0; i < n; i++)
                a[i] = Double();
            return a;
        }
        public int Integer()
        {
            var ret = 0;
            byte b = 0;
            bool isMynus = false;
            const byte zero = 48, nine = 57, mynus = 45;
            do b = readByte();
            while (!eof && !((b >= zero && b <= nine) || b == mynus));

            if (b == mynus)
            {
                isMynus = true;
                b = readByte();
            }
            while (true)
            {
                if (b >= zero && b <= nine)
                {
                    ret = ret * 10 + b - zero;
                }
                else return isMynus ? -ret : ret;
                b = readByte();
            }

        }
        public int[] Integer(int n)
        {
            var a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = Integer();
            return a;
        }
        public long Long()
        {
            long ret = 0;
            byte b = 0;
            bool isMynus = false;
            const byte zero = 48, nine = 57, mynus = 45;
            do b = readByte();
            while (!eof && !((b >= zero && b <= nine) || b == mynus));
            if (b == '-')
            {
                isMynus = true;
                b = readByte();
            }
            while (true)
            {
                if (b >= zero && b <= nine)
                    ret = ret * 10 + (b - zero);
                else return isMynus ? -ret : ret;
                b = readByte();
            }

        }
        public long[] Long(int n)
        {
            var a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = Long();
            return a;
        }
        public void Flush()
        {
            iStream.Flush();
        }

    }

}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> source)
        {
            return new string(source.ToArray());
        }
        static public string AsJoinedString<T>(this IEnumerable<T> source, string separator = " ")
        {
            return string.Join(separator, source);
        }
        static public T[] Enumerate<T>(this int n, Func<int, T> selector)
        {
            var res = new T[n];
            for (int i = 0; i < n; i++)
                res[i] = selector(i);
            return res;
        }
    }
}
#endregion

using System;

public class Test
{
	public static void Main()
	{
		string[] tok = Console.ReadLine().Split(' ');
        int sum = 0;
        for(int i = 0; i < 5; i++)
            sum += Int32.Parse(tok[i]);
        if(sum % 5 != 0)
        {
            Console.WriteLine(-1);
        }else{
            Console.WriteLine(sum / 5);
        }
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Начальная_ставка
{
    class Program
    {
        static void Main(string[] args)
        {
            var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(PR(mas));
            Console.ReadLine();

        }

        static int PR(int[] mas)
        {
            if (mas.Sum() % mas.Length == 0)
                return mas.Sum() / mas.Length;
            else
                return -1;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using System.IO;
using System.Numerics;

namespace probleme {
    class Program {
        static void Main(string[] args) {
            int[] v = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
            int s = v.Sum();
            if (s % 5 == 0)
                Console.WriteLine(s / 5);
            else
                Console.WriteLine(-1);

              // Console.ReadKey();
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;
class x
{
	static void Main()
	{
		List<int> boys = Console.ReadLine().Split(' ').Select(x=>int.Parse(x)).ToList();
		Console.Write(boys.Sum()%5==0?boys.Sum()/5:-1);
	}
}

/*
 * Created by SharpDevelop.
 * User: user419
 * Date: 21.10.2014
 * Time: 15:52
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;

namespace ConsoleApplication1
{
    class Program
    {
        public static void Main(string[] args)
        {
            string[] abcde = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(abcde[0]);
            int b = Convert.ToInt32(abcde[1]);
            int c = Convert.ToInt32(abcde[2]);
            int d = Convert.ToInt32(abcde[3]);
            int e = Convert.ToInt32(abcde[4]);
            int sum = a+b+c+d+e;
            if(sum%5!=0)
                Console.WriteLine("-1");
            else Console.WriteLine(sum/5);
        }
    }
}

using System;
using System.Linq;

namespace Test
{
    class Program
    {
        static void Main()
        {
            byte[] input = Console.ReadLine().Split(' ').Select(num => Convert.ToByte(num)).ToArray();

            int total = 0;
            foreach ( byte value   in input)
            {
                total += value;
            }

            Console.WriteLine(total % input.Length == 0 ? total / input.Length : -1);
        }
    }
}

using System;
using System.Linq;

namespace Task_TD
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] lines = Console.ReadLine().Split(' ');

            int c1 = Int32.Parse(lines[0]);
            int c2 = Int32.Parse(lines[1]);
            int c3 = Int32.Parse(lines[2]);
            int c4 = Int32.Parse(lines[3]);
            int c5 = Int32.Parse(lines[4]);

            Console.WriteLine(getResult(c1, c2, c3, c4, c5));

            Console.ReadLine();
        }

        static int getResult(int c1, int c2, int c3, int c4, int c5)
        {
            int sum = c1 + c2 + c3 + c4 + c5;
            if (sum % 5 != 0)
                return -1;

            return sum / 5;
        }

    }
}

using System;
using System.Linq;

namespace CSharp
{
    public class _478A
    {
        public static void Main(string[] args)
        {
            int[] coins = Console.ReadLine().Split().Select(token => int.Parse(token)).ToArray();

            int sum = coins.Sum();

            Console.WriteLine(sum % coins.Length == 0 ? sum / coins.Length : -1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

namespace ReadTemplate
{
    public class Solver
    {
        public static void Solve()
        {
            var sum = ReadIntArray().Sum();
            Writer.WriteLine(sum % 5 == 0 ? sum / 5 : -1);
        }

        public static void Main()
        {
            Reader = Console.In; Writer = Console.Out;
            //Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");

            Solve();

            Reader.Close();
            Writer.Close();
        }

        #region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

        #endregion
    }
}

using System;
using System.Collections;
using System.Linq;

namespace mainnm
{
    class main
    {
        static void Main()
        {
            int[] ta = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();

            int sum = ta.Sum();

            if (sum % 5 == 0) Console.WriteLine(sum / 5);
            else Console.WriteLine(-1);
      }
    }
}

using System;
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
           string[] s = Console.ReadLine().Split(' ');
           int temp=0;
           for (int i=0;i<s.Length;i++)
           {
               temp+=Convert.ToInt32(s[i]);
           }
            if (temp/s.Length*s.Length==temp) Console.WriteLine(temp/s.Length);
            else Console.WriteLine("-1");
            //HUI;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            decimal[] n = Console.ReadLine().Split().Select(Convert.ToDecimal).ToArray();

            decimal ave = n.Sum() / n.Length;

            if (ave == Convert.ToInt32(ave))
            {
                Console.WriteLine(ave);
            }
            else
            {
                Console.WriteLine(-1);
            }

            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Initial_Bet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] omar = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if ( omar.Sum() % 5 == 0)
            {
                Console.WriteLine(omar.Sum()/5);
            }
            else
                Console.WriteLine("-1");

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication16
{
    class Program
    {
        static void Main(string[] args)
        {
            var sum = Console.ReadLine().Split(' ').Select(int.Parse).ToList();

            if (sum.Sum() % sum.Count() == 0)
                Console.WriteLine(sum.Sum() / sum.Count());
            else
                Console.WriteLine(-1);
            Console.ReadLine();
        }
    }
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
            int answer = 0;
            for(int i=0; i<input.Length; ++i)
              answer += int.Parse(input[i]);
            Console.WriteLine(((answer % 5) == 0 ? (answer / 5) : (-1)));
        }
    }

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public object Solve()
    {
        int sum = ReadIntArray().Sum();
        if (sum % 5 > 0)
            return -1;
        return sum / 5;

        return null;
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
//        reader = new StreamReader("army.in");
//        writer = new StreamWriter("army.out");
#endif
        try
        {
            object result = new Solver().Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            Console.WriteLine(ex);
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }

    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            Console.WriteLine((Arr.Sum() % 5 != 0) ? -1 : (Arr.Sum() / 5));
            Console.ReadLine();
        }
    }
}

using System;
using System.Linq;

namespace Task_TD
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] lines = Console.ReadLine().Split(' ');

            int c1 = Int32.Parse(lines[0]);
            int c2 = Int32.Parse(lines[1]);
            int c3 = Int32.Parse(lines[2]);
            int c4 = Int32.Parse(lines[3]);
            int c5 = Int32.Parse(lines[4]);

            Console.WriteLine(getResult(c1, c2, c3, c4, c5));

            Console.ReadLine();
        }

        static int getResult(int c1, int c2, int c3, int c4, int c5)
        {
            int sum = c1 + c2 + c3 + c4 + c5;
            if (sum % 5 == 0)
                return -1;

            return sum / 5;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication34
{

    class Program
    {
        static void Main(string[] args)
        {
            int s = 0;
            string[] q = Console.ReadLine().Split(); ;

            int a = int.Parse(q[0]);
            int b = int.Parse(q[1]);
            int c = int.Parse(q[2]);
            int d = int.Parse(q[3]);
            int e = int.Parse(q[4]);
            s = a + b + c + e + d ;

            if (s%5==0)
                Console.WriteLine(s/5);
            else
                Console.WriteLine(-1);

        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Globalization;

namespace Saba
{
    public class Test
    {
        public static void Main()
        {
            int[] coins = Console.ReadLine().Split(' ').Select(x => Convert.ToInt32(x)).ToArray();
            int sum = 0;
            for (int i = 0; i < coins.Length; i++)
            {
                sum += coins[i];
            }
            int diff = 0;
            int coin = sum / 5;
            bool correct = true;
            bool minFound = false;
            for (int i = 0; i < coins.Length; i++)
            {
                if (coins[i] > coin) { diff += (coins[i] - coin); }
                else if (coins[i] < coin) { if (!minFound) { minFound = true; } else { correct = false; break; } diff -= (coin - coins[i]); }
                else { }
            }
            if (sum % 5 != 0 || !correct)
            {
                Console.WriteLine("-1");
            }
            else
            {
                if (diff == 0) { Console.WriteLine(coin); }
                else { Console.WriteLine("-1"); }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace A.Начальная_ставка
{
    class Program
    {
        static void Main(string[] args)
        {
            var mas = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Console.WriteLine(PR(mas));
            Console.ReadLine();

        }

        static int PR(int[] mas)
        {
            if (mas.Sum() % mas.Length == 0)
                return mas.Sum() / mas.Length;
            else
                return -1;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GameCoins
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int sum = 0;
            for (int i=0;i<5;i++)
            {
                int c = int.Parse(s[i]);
                sum += c;
            }

            if (sum%5==0)
            {
                Console.Write(sum / 5);
            }
            else
            {
                Console.Write(-1);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces_478A_Initial_Bet
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] player = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            if (player.Sum() % 5 != 0)
                Console.WriteLine("-1");
            else
                Console.WriteLine(player.Sum() / 5);
        }
    }
}