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;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;
using System.Text.RegularExpressions;

namespace CsTest
{
    class Program
    {
        static void Main()
        {
            int[] NAB = AtCoder.ReadInt32Array();
            int N = NAB[0];
            int A = NAB[1];
            int B = NAB[2];

            long[] vals = AtCoder.ReadInt64Array();
            Array.Sort<long>(vals, (x, y) => -x.CompareTo(y));

            long[] aves = new long[A];
            Array.Copy(vals, 0, aves, 0, A);


            Console.WriteLine(aves.Average());

            int avenum = aves.Count(l => l == aves[A - 1]);
            int allnum = vals.Count(l => l == aves[A - 1]);

            long maxnum = Math.Min(allnum, B - (A - avenum));
            BigInteger ret = nCr(allnum, avenum);
            for (int i = avenum + 1; i <= maxnum; i++)
            {
                ret += nCr(allnum, i);
            }
            Console.WriteLine(ret);
        }

        static BigInteger factorial(int n)
        {
            if (n == 1) return n;
            else return n * factorial(n - 1);
        }
        static BigInteger nPr(int n, int r)
        {
            BigInteger ret = 1;
            for (int l = n; l > n - r; l--)
            {
                ret *= l;
            }
            return ret;
        }
        static BigInteger nCr(int n, int r) => nPr(n, r) / factorial(r);
    }

    public class AtCoder
    {
        public static string[] ReadStringArray() => Console.ReadLine().Split(Array.Empty<char>(), StringSplitOptions.RemoveEmptyEntries);
        public static int[] ReadInt32Array() => ReadStringArray().Select(s => int.Parse(s)).ToArray();
        public static long[] ReadInt64Array() => ReadStringArray().Select(s => long.Parse(s)).ToArray();
    }
}