import struct

def binary_to_float(binary_str):
    # Convert the binary string to an integer
    int_rep = int(binary_str, 2)
    
    # Pack the integer as a 32-bit binary and unpack it as a float
    float_rep = struct.unpack('!f', struct.pack('!I', int_rep))[0]
    
    return float_rep

# Query the binary number from input eg. 01000001111100000000000000000000 for 30.0 or 01000001010010000000000000000000 for 12.5
binary_str = input("Enter a 32-bit binary number (avoid blank spaces): ") 

# Convert the binary number to a decimal number
decimal_number = binary_to_float(binary_str)

# Print the result
print(f"The decimal representation of the 32-bit binary number {binary_str} is {decimal_number}.")
