public static int upperBound(int key) {
		int lower = 0, upper = dig.length - 1, ans = -1;
		while (lower <= upper) {
            int mid = (lower + upper) / 2;
            if (key < dig[mid].s)
                upper = mid - 1;
            else {
                lower = mid + 1;
                ans = mid;
            }
        }
		if (ans >= 0 && key >= dig[ans].s && key <= dig[ans].e)
			return ans;
		return -1;
	}