Problem:
Score : 100 points

Problem Statement

There are three airports A, B and C, and flights between each pair of airports in both directions.

A one-way flight between airports A and B takes P hours, a one-way flight between airports B and C takes Q hours, and a one-way flight between airports C and A takes R hours.

Consider a route where we start at one of the airports, fly to another airport and then fly to the other airport.

What is the minimum possible sum of the flight times?

Constraints

1 \leq P,Q,R \leq 100

All values in input are integers.

Input

Input is given from Standard Input in the following format:

P Q R

Output

Print the minimum possible sum of the flight times.

Sample Input 1

1 3 4

Sample Output 1

4

The sum of the flight times in the route A \rightarrow B \rightarrow C: 1 + 3 = 4 hours

The sum of the flight times in the route A \rightarrow C \rightarrow C: 4 + 3 = 7 hours

The sum of the flight times in the route B \rightarrow A \rightarrow C: 1 + 4 = 5 hours

The sum of the flight times in the route B \rightarrow C \rightarrow A: 3 + 4 = 7 hours

The sum of the flight times in the route C \rightarrow A \rightarrow B: 4 + 1 = 5 hours

The sum of the flight times in the route C \rightarrow B \rightarrow A: 3 + 1 = 4 hours

The minimum of these is 4 hours.

Sample Input 2

3 2 3

Sample Output 2

5

Solution in C# (Mono 4.6.2.0) (judge verdict: Time Limit Exceeded)

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

public class MainClass
{

	public static void Main(string[] args)
	{
	

		
		kekka.Add(10 ,89);
		kekka.Add(11 ,144);
		kekka.Add(12 ,233);
		kekka.Add(13 ,377);
		kekka.Add(14 ,610);
		kekka.Add(15 ,987);
		kekka.Add(16 ,1597);
		kekka.Add(17 ,2584);
		kekka.Add(18 ,4181);
		kekka.Add(19 ,6765);
		kekka.Add(20 ,10946);
		kekka.Add(21 ,17711);
		kekka.Add(22 ,28657);
		kekka.Add(23 ,46368);
		kekka.Add(24 ,75025);
		kekka.Add(25 ,121393);
		kekka.Add(26 ,196418);
		kekka.Add(27 ,317811);
		kekka.Add(28 ,514229);
		kekka.Add(29 ,832040);
		kekka.Add(30 ,1346269);
		kekka.Add(31 ,2178309);
		kekka.Add(32 ,3524578);
		kekka.Add(33 ,5702887);
		kekka.Add(34 ,9227465);
		kekka.Add(35 ,14930352);
		kekka.Add(36 ,24157817);
		kekka.Add(37 ,39088169);
		kekka.Add(38 ,63245986);
		kekka.Add(39 ,102334155);
		kekka.Add(40 ,165580141);
		kekka.Add(41 ,267914296);
		kekka.Add(42 ,433494437);
		kekka.Add(43 ,701408733);
		kekka.Add(44 ,1134903170);
		kekka.Add(45 ,1836311903);
		kekka.Add(46 ,2971215073);
		kekka.Add(47 ,4807526976);
				for(int i = 46; i<100;i++)
		{
			Console.WriteLine("kekka.Add("+i+" ,"+CountPattern(i)+");");
		}
		

		string[] s = Console.ReadLine().Split(' ');
		int n = int.Parse(s[0]);
		int m = int.Parse(s[1]);
		
		bool[] a = new bool[n];
		int last = -10;
		int q = 0;
		long ppp = 1;
		for(int i = 0; i < m; i++)
		{
			int index = int.Parse(Console.ReadLine());
			if(index == last+1) {
				Console.WriteLine(0);
				return;
			}
			a[index]=true;
			
			int o = Math.Max(0,last+1);
			if(index-o-1>1)
			{
				q = (index-1-o);
				ppp *= CountPattern(q);
				ppp %= 1000000007;
			}
			last = index;
		}
		q = (n-Math.Max(0,last+1));
		if(q>1)
		{
			ppp *= Math.Max(1,CountPattern(q));
		
		}
		
		
		Console.WriteLine(ppp%1000000007);
	
		
	}
	public static long count;
	public static Dictionary<int,long> kekka = new Dictionary<int,long>();
	public static long CountPattern(int n)
	{
		count = 0;
		if(kekka.ContainsKey(n))
			return kekka[n];
		C(0, n);
		kekka.Add(n,count);
		return count;
	}
	
	public static void C(int p, int n)
	{
		A(p,n);
		B(p,n);
	}
	
	public static bool A(int p, int n)
	{
		p+=2;
		
		if(p==n) {
			count++;
			return true;
		}
		if(p<n) {
			C(p,n);
		}
		return false;
	}
	
	public static bool B(int p, int n)
	{
		p+=1;
		if(p==n) {
			count++;
			return true;
		}
		if(p<n) {
			C(p,n);
		}
		return false;
	}

	public static int Clamp(int val, int max, int min = 0)
	{
		return Math.Min(max, Math.Max(min, val));
	}

	
}