Problem:
Score : 100 points

Problem Statement

Takahashi has K 500-yen coins. (Yen is the currency of Japan.)
If these coins add up to X yen or more, print Yes; otherwise, print No.

Constraints

1 \leq K \leq 100

1 \leq X \leq 10^5

Input

Input is given from Standard Input in the following format:

K X

Output

If the coins add up to X yen or more, print Yes; otherwise, print No.

Sample Input 1

2 900

Sample Output 1

Yes

Two 500-yen coins add up to 1000 yen, which is not less than X = 900 yen.

Sample Input 2

1 501

Sample Output 2

No

One 500-yen coin is worth 500 yen, which is less than X = 501 yen.

Sample Input 3

4 2000

Sample Output 3

Yes

Four 500-yen coins add up to 2000 yen, which is not less than X = 2000 yen.

Solution in Haskell (GHC 7.10.3) (judge verdict: Runtime Error)

import Data.List

main = do
  n <- readLn :: IO Int
  cs <- map read . words <$> getLine :: IO [Int]
  putStrLn $ show (ans n cs)

ans :: Int -> [Int] -> Int
ans n cs = multMod (powMod 2 n) (foldl1 (addMod) (zipWith (multMod) (map (f n) [1..n]) (sort cs)))

f :: Int -> Int -> Int
f 1 a = 1
f n a = multMod (powMod 2 (n-2)) (n+2-a)

modulus = 10^9+7

aMod :: Int -> Int  
aMod n = n `mod` modulus

addMod :: Int -> Int -> Int
addMod a b 
    | a + b > modulus = a + b - modulus
    | otherwise = a + b

subMod :: Int -> Int -> Int
subMod a b
    | a - b < 0 = a - b + modulus
    | otherwise = a - b

multMod :: Int -> Int -> Int
multMod a b = (a * b) `mod` modulus

powMod :: Int -> Int -> Int
powMod a b 
    | b == 0 = 1
    | otherwise = f a b
  where
        f x y | even y = f (multMod x x) (y `quot` 2)
              | y == 1 = x
              | otherwise = g (multMod x x) (y `quot` 2) x
        g x y z | even y = g (multMod x x) (y `quot` 2) z
                | y == 1 = multMod x z
                | otherwise = g (multMod x x) (y `quot` 2) (multMod x z)