If both 4 s and 7 s are there in digit sum , we subtract a 4.
else : NEW_LINE INDENT a += 1 NEW_LINE s -= 4 NEW_LINE DEDENT string = " " NEW_LINE if ( s < 0 ) : NEW_LINE string = " - 1" NEW_LINE return string NEW_LINE string += "4" * a NEW_LINE string += "7" * b NEW_LINE return string NEW_LINE