Problem:
Score : 100 points

Problem Statement

Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.

In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".

The current time is A o'clock, and a contest will begin in exactly B hours.
When will the contest begin? Answer in 24-hour time.

Constraints

0 \leq A,B \leq 23

A and B are integers.

Input

The input is given from Standard Input in the following format:

A B

Output

Print the hour of the starting time of the contest in 24-hour time.

Sample Input 1

9 12

Sample Output 1

21

In this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.

Sample Input 2

19 0

Sample Output 2

19

The contest has just started.

Sample Input 3

23 2

Sample Output 3

1

The contest will begin at 1 o'clock the next day.

Solution in C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Linq;

namespace ABC057_D
{
    class Program
    {
        static void Main(string[] args)
        {
            var NAB = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var N = NAB[0];
            var A = NAB[1];
            var B = NAB[2];
            var v = Console.ReadLine().Split().Select(long.Parse).ToArray();

            Array.Sort(v);
            Array.Reverse(v);

            long[,] pt = new long[51, 51];
            for (int i = 0; i <= N; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    if (j == 0 || j == i)
                        pt[i, j] = 1;
                    else
                        pt[i, j] = pt[i - 1, j - 1] + pt[i - 1, j];
                }
            }

            var take = v.Take(A).ToArray();

            long res = 0;
            if (take.First() == take.Last())
            {
                var n = v.Where(x => x == take.Last()).Count();
                res = Enumerable.Range(A, B).Select(x => pt[n, x]).Sum();
            }
            else
            {
                var n = v.Where(x => x == take.Last()).Count();
                var r = take.Where(x => x == take.Last()).Count();
                res = pt[n, r];
            }

            Console.WriteLine((decimal)take.Average());
            Console.WriteLine(res);
        }
    }
}