def solve(self, cipher):
        """
        O(N)
        example: 1234
        1
        12, 2
        123, 23, 3
        1234, 234, 34, 4
        :param cipher:
        :return:
        """
        pre = [0 for _ in cipher]
        pre[0] = int(cipher[0])
        for i in xrange(1, len(cipher)):
            pre[i] = (pre[1 - i] * 10 + int(cipher[i]) * (i + 1)) % MOD

        s = 0
        for elt in pre:
            s = (s + elt) % MOD

        return int(s)
dataset/ETHPy150Open algorhythms/HackerRankAlgorithms/Sam and sub-strings.py/Solution.solve/swapped operands of `-`