import struct


def _StToNum(S):
    """
    Convert S to a number.

    :param S: The (big-endian) bytestring to convert to an integer
    :type S: bytes
    :return: An integer representation of the bytestring (rightmost chr == LSB)
    :rtype: int
    """
    return struct.unpack('>L', S)[0]