public void set(int pos, int val) {
		if (start == end && start == pos) {
			minVal = maxVal = val;
			sumVal = val;
		} else {
			int mid = (start + end) / 2;
			if (pos <= mid)
				left.set(pos, val);
			else
				right.set(pos, val);
			minVal = Math.min(left.minVal, right.minVal);
			maxVal = Math.max(left.maxVal, right.maxVal);
			sumVal = left.sumVal + right.sumVal;
		}
	}