


"""simple docstring"""







import os




def      UpperCAmelCase__ ():




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       os.path.join(os.path.dirname(lowerCAmelCase_     )						,		"num.txt"     )
					with open(lowerCAmelCase_     ) as file_hand:
										return str(sum(int(lowerCAmelCase_     ) for line in file_hand     )     )[:10]


if __name__ == "__main__":
		print(solution())




"""simple docstring"""







from __future__ import annotations




def      UpperCAmelCase__ (lowerCAmelCase_     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       str(lowerCAmelCase_     )
					return n == n[::-1]




def      UpperCAmelCase__ (lowerCAmelCase_ = 100_0000     ):




					'''simple docstring'''


					__SCREAMING_SNAKE_CASE		     =       0

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


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