#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
private:
vector<int> sum;
public:
Solution(vector<int> w) {
sum.clear();
sum.push_back(0);
for(int e: w)
sum.push_back(sum.back() + e);
}
int pickIndex() {
int randNum = rand() % sum.back();
int index = lower_bound(sum.begin(), sum.end(), randNum) - sum.begin();
if(sum[index] != randNum)
index --;
return index;
}
};
int main() {
return 0;
}