Subscript to sum is not in {}