#!/usr/bin/python3
# -*- coding: utf-8 -*-

# MAIN PROGRAM
def main():
    color = int(input("Type color 0xHHHHHH>"), 16)

    r = color >> 16
    g = (color >> 8) & 0x0000FF
    b = color & 0x0000FF

    r1 = int(r / 255 * 31)
    g1 = int(g / 255 * 63)
    b1 = int(b / 255 * 31)

    color = r1 << 11
    color = color + (g1 << 5)
    color = color + b1

    print('RED:   0x%X, %i' % (r, r1))
    print('GREEN: 0x%X, %i' % (g, g1))
    print('BLUE:  0x%X, %i' % (b, b1))
    print('COLOR:  0x%X' % color)



# MAIN PROGRAM
if __name__ == "__main__":
    main()
