def extractInstrValues(expresions, fomatStr):
    """
    Extracts values of register addresses and immedaete
    expresions - array of srings as parts of instruction (letter code followed by parametrs)
    fomatStr   - format string of the instruction
    return: reg - array of register addr in oreder Rd, Rs1, Rs2
            imm - value of immedaete
    """
    reg = []
    imm = None
    for i,ch in enumerate(fomatStr):
        if ch == "R":
            reg.append(int(expresions[i+1][1:]))
        elif ch == "U" or ch == "S":
            imm = expresions[i+1]
    return reg, imm