
"""simple docstring"""

from math import pow




def      lowercase__    (       lowerCAmelCase					:       int			,					lowerCAmelCase					:       int			,					lowerCAmelCase					:       int			,					lowerCAmelCase					:       int			,					lowerCAmelCase					:       int			,					)			->   tuple[int, int]:






    """simple docstring"""




    if current_sum == needed_sum:
        # If the sum of the powers is equal to needed_sum, then we have a solution.
        solutions_count += 1
        return current_sum, solutions_count

    UpperCAmelCase          =       int(pow(lowerCAmelCase			,					lowerCAmelCase			)			)
    if current_sum + i_to_n <= needed_sum:
        # If the sum of the powers is less than needed_sum, then continue adding powers.
        current_sum += i_to_n
        UpperCAmelCase      ,				UpperCAmelCase          =       backtrack(
            lowerCAmelCase			,					lowerCAmelCase			,					current_number + 1			,					lowerCAmelCase			,					lowerCAmelCase			)
        current_sum -= i_to_n
    if i_to_n < needed_sum:
        # If the power of i is less than needed_sum, then try with the next power.
        UpperCAmelCase      ,				UpperCAmelCase          =       backtrack(
            lowerCAmelCase			,					lowerCAmelCase			,					current_number + 1			,					lowerCAmelCase			,					lowerCAmelCase			)
    return current_sum, solutions_count




def      lowercase__    (       lowerCAmelCase					:       int			,					lowerCAmelCase					:       int			)			->   int:






    """simple docstring"""




    if not (1 <= needed_sum <= 1_000 and 2 <= power <= 10):
        raise ValueError(
            'Invalid input\n'
            'needed_sum must be between 1 and 1000, power between 2 and 10.'			)

    return backtrack(lowerCAmelCase			,					lowerCAmelCase			,					1			,					0			,					0			)[1]  # Return the solutions_count


if __name__ == "__main__":
   import doctest

   doctest.testmod()





"""simple docstring"""

def      lowercase__    (       lowerCAmelCase					:       str			)			->   bool:






    """simple docstring"""




    UpperCAmelCase          =       [int(lowerCAmelCase			) for i in ip_va_address.split('.'			) if i.isdigit()]
    return len(lowerCAmelCase			) == 4 and all(0 <= int(lowerCAmelCase			) <= 254 for octet in octets			)


if __name__ == "__main__":
   SCREAMING_SNAKE_CASE_            =    input().strip()
   SCREAMING_SNAKE_CASE_            =    '''valid''' if is_ip_va_address_valid(ip) else '''invalid'''
   print(F'{ip} is a {valid_or_invalid} IP v4 address.')



