import string


def parse_letternumber(st):
    """
    Parse CDMS's two-letter QNs

    From the CDMS docs:
    "Exactly two characters are available for each quantum number. Therefore, half
    integer quanta are rounded up ! In addition, capital letters are used to
    indicate quantum numbers larger than 99. E. g. A0 is 100, Z9 is 359. Small
    types are used to signal corresponding negative quantum numbers."
    """
    asc = string.ascii_lowercase
    ASC = string.ascii_uppercase
    newst = ''.join(['-' + str(asc.index(x)+10) if x in asc else
                     str(ASC.index(x)+10) if x in ASC else
                     x for x in st])
    return int(newst)