C# Solution
\npublic class RLEIterator \n{\n    int index;\n    int [] array;\n\n    public RLEIterator(int[] A) \n    {\n        array = A;\n        index = 0;\n    }\n   
```\npublic class RLEIterator \n{\n    int index;\n    int [] array;\n\n    public RLEIterator(int[] A) \n    {\n        array = A;\n        index = 0;\n    }\n    \n    public int Next(int n) \n    {\n        while(index < array.Length && n > array[index])\n        {\n            n = n - array[index];\n            index += 2;\n        }\n        \n        if(index >= array.Length)\n            return -1;\n        \n        array[index] = array[index] - n;\n        return array[index + 1];\n    }\n}\n```
[]