


'''simple docstring'''



from __future__ import annotations







def       _UpperCamelCase (						UpperCamelCase__   ):
			UpperCAmelCase__					:   Dict       				=       str(UpperCamelCase__   )
			return n == n[::-1]







def       _UpperCamelCase (						UpperCamelCase__ = 1_0_0_0_0_0_0   ):
			UpperCAmelCase__					:   Dict       				=       0

			for i in range(1	, UpperCamelCase__   ):
						if is_palindrome(UpperCamelCase__   ) and is_palindrome(bin(UpperCamelCase__   ).split("""b"""   )[1]   ):
									total += i
			return total


if __name__ == "__main__":
		print(solution(int(str(input().strip()))))



'''simple docstring'''



def       _UpperCamelCase (						UpperCamelCase__ = 4_0_0_0_0_0_0   ):
			UpperCAmelCase__					:   List[str]       				=       [0, 1]
			UpperCAmelCase__					:   Any       				=       0
			while fib[i] <= n:
						fib.append(fib[i] + fib[i + 1]   )
						if fib[i + 2] > n:
									break
						i += 1
			UpperCAmelCase__					:   str       				=       0
			for j in range(len(UpperCamelCase__   ) - 1   ):
						if fib[j] % 2 == 0:
									total += fib[j]

			return total


if __name__ == "__main__":
		print(f"""{solution() = }""")