This challenge is only forPython 2. 

input()

In Python 2, the expression input() is equivalent to eval(raw _input(prompt)).

Code

>>> input()  
1+2
3
>>> company = 'HackerRank'
>>> website = 'www.hackerrank.com'
>>> input()
'The company name: '+company+' and website: '+website
'The company name: HackerRank and website: www.hackerrank.com'

Task  

You are given a polynomial $\mbox{P}$ of a single indeterminate (or variable), $\boldsymbol{x}$. 

You are also given the values of $\boldsymbol{x}$ and $\boldsymbol{\mbox{k}}$. Your task is to verify if $P(x)=k$.

Constraints 

All coefficients of polynomial $\mbox{P}$ are integers. 

$\boldsymbol{x}$ and $y$ are also integers.

Input Format

The first line contains the space separated values of $\boldsymbol{x}$ and $\boldsymbol{\mbox{k}}$. 

The second line contains the polynomial $\mbox{P}$. 

Output Format

Print True if $P(x)=k$. Otherwise, print False.

Sample Input
1 4
x**3 + x**2 + x + 1

Sample Output
True

Explanation

$P(1)=1^3+1^2+1+1=4=k$ 

Hence, the output is True.

Source: hackerrank | Difficulty: EASY


Solutions:
(x, k) = [int(i) for i in input().split()]
exp = input()
print(eval(exp.replace('x', '{0}').format(x)) == k)


(x, k) = input().strip().split()
[x, k] = [int(x), int(k)]
s = input()
if eval(s) == k:
	print(True)
else:
	print(False)


(x, k) = map(int, input().split())
if eval(input()) == k:
	print('True')
else:
	print('False')


(x, k) = map(int, input().split())
print(eval(input() + '==k'))


from math import *
main = list(map(int, input().split()))
x = main[0]
result = eval('{}'.format(input()))
if result == main[1]:
	print('True')
else:
	print('False')


temp = list(map(int, input().split()))
x = temp[0]
k = temp[1]
p = input()
p = p.replace('x', str(x))
t = eval(p)
if t == k:
	print('True')
else:
	print('False')


(x, k) = map(float, input().split())
print(eval(input()) == k)


(x, y) = map(int, input().split())
print(eval(input()) == y)


(x, k) = list(map(int, input().split(' ')))
eq = input()
print(eval(eq) == k)


(n, k) = [int(m) for m in input().split()]
f = input()
l = eval(f.replace('x', str(n)))
if l == k:
	print('True')
else:
	print('False')


l = list(map(int, input().split()))
x = l[0]
y = l[1]
if eval(input()) == y:
	print('True')
else:
	print('False')


(x, o) = list(map(int, input().split()))
print(eval(input()) == o)


(x, k) = map(int, input().split(' '))
k2 = eval(input())
print(k == k2)


import re
(x, k) = map(int, input().split())
f = lambda x: eval(input())
print(f(x) == k)


(x, k) = [int(x) for x in input().split(' ')]
print(eval('k==' + input()))


(x, k) = input().strip().split()
print(eval(input().replace('x', x)) == int(k))


(y, k) = map(int, input().split())
f = lambda x: eval(input())
if f(y) == k:
	print('True')
else:
	print('False')


(x, k) = map(int, input().split())
print(eval(input()) == k)


inputs = list(map(int, input().split()))
x = inputs[0]
y = inputs[1]
print(eval(input()) == y)


p = list(map(int, input().split()))
s = input()
for i in range(len(s)):
	if s[i] == 'x':
		s = s[:i] + str(p[0]) + s[i + 1:]
print(p[1] == eval(s))


i = list(map(int, input().split()))
(x, k) = (i[0], i[1])
ex = input()
a = ex.replace('x', str(x))
keval = eval(a)
if k == keval:
	print('True')
else:
	print('False')


(x, k) = map(int, input().split())
p = input()
print(k == eval(p))


(x, k) = map(int, input().split())
command = input()
t = eval(command)
print(t == k)


xk = input().strip().split(sep=' ')
x = int(xk[0])
k = int(xk[1])
poly = input()
if eval(poly) == k:
	print('True')
else:
	print('False')


(x, k) = map(int, input().split())
print(eval('{}=={}'.format(input(), k)))


(x, k) = map(int, input().split())
Px = eval(input())
print(Px == k)


ass = input().split(' ')
x = int(ass[0])
k = int(ass[1])
poly = input()
print(eval(str(poly)) == k)


(x, k) = [int(j) for j in input().split()]
f = input()
print(k == eval(f))


(x, k) = map(int, input().split())
result = eval(input())
print(result == k)


(x, k) = list(map(int, input().split()))
S = True if eval(input()) == k else False
print(S)


ui = list(map(int, input().split()))
x = ui[0]
k = ui[1]
print(eval(input()) == k)


(x, k) = map(int, input().strip().split())
print(k == eval(input().strip()))


(x, y) = map(int, input().split())
rawstring = input()
px = eval(rawstring)
print(px == y)


(x, m) = map(int, input().split())
eq = lambda x: eval(input())
print(eq(x) == m)


(x, k) = map(int, input().split())
poly = input()
print(eval(poly.replace('x', str(x))) == k)


a = list(map(int, input().split()))
b = input()
x = a[0]
if eval(b) == a[1]:
	print('True')
else:
	print('False')


(x, k) = map(int, input().split())
exp = input()
f = (lambda x: eval(exp))(x)
if f == k:
	print('True')
else:
	print('False')


l = list(map(int, input().split()))
string = input()
string = string.replace('x', str(l[0]))
print(l[1] == eval(string))


(x, y) = map(int, input().split())
print('True' if eval(input()) == y else 'False')


a = list(map(int, input().split()))
b = eval(input().replace('x', str(a[0])))
if b == a[1]:
	print(True)
else:
	print(False)


(x, y) = [int(x) for x in input().split()]
ex = input()
ex_ = ex.replace('x', str(x))
if eval(ex_) == y:
	print(True)
else:
	print(False)


[x, k] = [int(i) for i in input().split()]
r = eval(input())
print(r == k)


(x, k) = input().split()
poly = input()
poly_x = poly.replace('x', x)
print(eval(poly_x) == int(k))


i = input()
(x, k) = i.split()
x = int(x)
k = int(k)
i = input()
print(eval(i + ' == k'))


a = list(map(float, input().split()))
x = int(a[0])
k = a[1]
p = input().replace('x', str(x))
print('True') if eval(p) == k else print('False')


(x, k) = map(int, input().split())
strs = input()
if eval(strs) == k:
	print(True)
else:
	print(False)


(x, k) = input().split()
x1 = int(x)
k1 = int(k)
p = input()
l = list(p)
t = l[0]
l1 = [x if i == t else i for i in l]
l2 = ''.join(l1)
l3 = eval(l2)
if l3 == k1:
	print('True')
else:
	print('False')


(x, y) = input().split()
z = eval(x.join(input().split('x')))
if z == int(y):
	print(True)
else:
	print(False)


(x, k) = [int(a) for a in input().split()]
print(eval(input().replace('x', str(x))) == k)


(x, v) = map(int, input().split())
f = lambda x: eval(input())
print(f(x) == v)


(x, k) = map(int, input().split())
print(k == eval(input()))


(p, k) = input().strip().split(' ')
(p, k) = [int(p), int(k)]
l = input()
x = p
r = eval(l)
if r == k:
	print(True)
else:
	print(False)


(x, k) = map(int, input().split())
print(eval(input().replace('x', str(x))) == k)


x1 = list(map(int, input().split()))
x = x1[0]
print(eval(input()) == x1[1])


(e, k) = input().split()
p = input()
check = eval(p.replace('x', e))
if check == int(k):
	print(True)
else:
	print(False)


(x, ans) = map(int, input().strip().split())
poly = input()
if eval(poly) == ans:
	print('True')
else:
	print('False')


(x, k) = map(int, input().strip().split(' '))
expression_value = eval(input())
if expression_value == k:
	print(True)
else:
	print(False)


a = input().split()
y = input()
x = int(a[0])
print(eval(y) == int(a[1]))


(x, k) = [int(d) for d in input().strip().split(' ')]
P = input().strip()
print(eval(P) == k)


i = input().split()
(x, k) = (int(i[0]), int(i[1]))
print(eval(input() + ' == k'))


x = [int(x) for x in input().strip().split()]
s = list(input())
for i in range(len(s)):
	if s[i] == 'x':
		s[i] = str(x[0])
t = ''.join(s)
if eval(str(t)) == x[1]:
	print('True')
else:
	print('False')


(x, k) = map(int, input().split())
expr = input()
ans = eval(expr)
if ans == k:
	print(True)
else:
	print(False)


(x, k) = map(int, input().split())
e = eval(input())
print(e == k)


(x, k) = map(int, input().split())
expr = input()
if eval(expr) == k:
	print('True')
else:
	print('False')


(x, k) = map(int, input().split())
f = lambda x: eval(input())
print(f(x) == k)


(x, k) = [int(i) for i in input().split()]
s = input().replace('x', str(x))
print(k == eval(s))


(x, k) = input().split()
x = float(x)
k = float(k)
f = lambda x: eval(input())
print(eval('{}=={}'.format(input(), k)))


(x, k) = map(int, input().split())
wielomian = input()

def f(x):
	y = wielomian
	return y
if eval(f(x)) == k:
	print(True)
else:
	print(False)


a = input().split()
b = input()
x = a[0]
k = int(a[1])
print(eval(b.replace('x', x)) == k)


(x, k) = map(int, input().split())
poly = input()
out = eval(poly)
if out == k:
	print('True')
else:
	print('False')


a = list(input().split())
ex = str(input())
ex = ex.replace('x', a[0])
res = eval(ex)
if res == int(a[1]):
	print('True')
if res != int(a[1]):
	print('False')


(x, k) = input().strip().split()
code = input().replace('x', x)
print(eval(code) == int(k))


def __starting_point():
	(x, k) = map(int, input().strip().split())
	string = input().strip()
	if eval(string) == k:
		print(True)
	else:
		print(False)
__starting_point()


def func():
	(x, k) = map(int, input().split())
	marks = []
	pol = list(input())
	for i in range(len(pol)):
		if pol[i] == 'x':
			pol[i] = str(x)
	print(eval(''.join(pol)) == k)
func()


ui = input().split()
x = int(ui[0])
print(eval(input()) == int(ui[1]))