def format_price(price):
    """
    formats number 12345678 -> 12 345 678
    """
    s_list = []
    while price:
        s_list.append(str(price % 1000))
        price /= 1000
    s_list.reverse()
    return ' '.join(s_list).strip()