# -*- coding:utf-8 -*-
def find(numbers,key):
record = []
dirc = {}
for i in range(len(numbers)): #用哈希表换来O(n^2)的时间复杂度
if key-numbers[i] in dirc:
dirc[key-numbers[i]] += [i]
else:
dirc[key-numbers[i]] = [i]
for i in range(len(numbers)-1):
for j in range(i+1,len(numbers)):
if numbers[i] + numbers[j] in dirc:
if i not in dirc[numbers[i] + numbers[j]] and j not in dirc[numbers[i] + numbers[j]]:
return True
return False
if __name__=="__main__":
num = input().split(",")
numbers = [int(i) for i in num[0].split()]
key = int(num[-1])
print(find(numbers, key))