Humpy, the little elephant, has his birthday coming up. He invited all his cousins but doesn’t know how many of them are really coming as some of them are having exams coming up. He will only get to know how many of them are coming on the day of his birthday.

He ordered sugarcane for his party, of length L.

Humpy’s mom decided that she will be dividing the sugarcane among Humty and his friends in a way such that they get the sugarcane in ratio of their ages.

Your task is to determine whether it is possible to serve sugarcane to everyone as integral multiples of their ages.

-----INPUT-----
First line of input contains an integer N, denoting the number of test cases.

Then N test cases follow.

The first line of each test case contains three integers K, L and E. K denoting the number of friends coming; L denoting the length of the sugarcane and E denoting the age of the little elephant. Next line has  K  space separated integers denoting the age of friends who came to the party.

-----OUTPUT-----

For each test case, output “YES” (without quotes) if everyone gets their part as integral multiples of their ages; otherwise output “NO”(without quotes).

-----CONSTRAINTS-----

- 1 <= T<=30
- 1 <= K<=1000
- 1 <= L<=1000000
- 1 <= E<=100000
- 1 <= Age of Cousins<=100000

-----Example-----
Input:
2
4 10 2
2 2 3 1
4 12 3
6 5 7 3

Output:
YES 
NO

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
from sys import stdin, stdout
n = int(stdin.readline())
while n:
	n -= 1
	(k, l, e) = map(int, stdin.readline().strip().split(' '))
	a = map(int, stdin.readline().strip().split(' '))
	x = float(l) / float(e + sum(a))
	if x - int(x):
		stdout.write('NO\n')
	else:
		stdout.write('YES\n')


n = ['']
for x in range(0, int(input())):
	(k, l, e) = list(map(int, input().split()))
	sum = 0
	n = list(map(int, input().split()))
	for i in range(0, k):
		sum += n[i]
	sum += e
	if l % sum == 0:
		print('YES')
	else:
		print('NO')


from math import *
t = int(input())
for i in range(t):
	a = list(map(float, input().split()))
	b = list(map(float, input().split()))
	c = sum(b) + a[2]
	d = float(a[1] / c)
	if ceil(d) == d:
		print('YES')
	else:
		print('NO')


for _ in range(0, int(input())):
	(ans, [l, m, n]) = (['NO', 'YES'], list(map(int, input().split())))
	o = list(map(int, input().split())) + [n]
	print(ans[m % sum(o) == 0])


for __ in range(eval(input())):
	(k, l, e) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	val = sum(arr) + e
	if l % val == 0:
		print('YES')
	else:
		print('NO')


for __ in range(eval(input())):
	(n, l, e) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	if l % (sum(a) + e) == 0:
		print('YES')
	else:
		print('NO')


for t in range(int(input())):
	(k, l, e) = list(map(int, input().split()))
	a = list(map(int, input().split()))
	s = float(sum(a) + e)
	if l / s == int(l / s):
		print('YES')
	else:
		print('NO')