Binomial distribution with random variable parameter Im stucked with this exercise:

Let $p\in(0,1)$, $T\in\mathbb{N}$ and $d,u\in \mathbb{R}_+$ such that $d<u$. 
  Further let $(\Omega,\mathcal{F})=(\{u,d\}^T,\mathcal{P}(\Omega))$ be a 
  measurable space. For $1\leq j\leq T$ let $\omega_j:\Omega\to\{u,d\}$. 
Define for $\omega\in\Omega$ the function $$P(\{\omega\})=p^{U(\omega)}(1-p)^{T-{U(\omega)}}$$ where $U(\omega)=\operatorname{card}(\{j=1,\dots,T:w_j(\omega)=u\})$. And let for all $A\in \mathcal{F}$
$$P(A):=\sum_{\omega \in A}P(\{\omega\})$$
Prove that $P$ is a probability measure and compute the expectation $E_P[\omega_1]$.

For me this looks like some complicated writing for a binomial distribution, so I try to rewrite
$$P(A):=\sum_{\omega \in A}p^{U(\omega)}(1-p)^{T-{U(\omega)}}$$
As the pmf of the binomial distribution. Here are my thoughts: $U$ is random variable on the space $1,\dots ,T$, depending on the outcome of the Bernoulli variables $\omega_j$ with some unkown parameter $q$, we have that $U$ has a binomial distribution with parameter $(T,q)$. Now I somehow try to substitute the $U(\omega)$ with a non random variable, but I don't see how.
I also have troubles to visualize how such an event $A$ looks like. $A$ has multiple $\omega$'s so we have for every $A$ also multiple values for $U$?
Also it confuses me that we do not have any probability for the random variables $w_j$.
Edit: Hint's or just explanations would also be highly appreciated!
 A: You are on the right track with the binomial thinking. I'll just expand on the notation and definitions.
I will refer to the positive values $u, d$ as the up and down values in a coin toss for ease of thinking. An element of $Ω$ then looks like a $T$-tuple with either a $u$ or $d$ in each component, which could be interpreted as the outcome of $T$ consecutive coin tosses (Bernoulli trials).
I suppose $ω_j$ is the $j$-th component projection of the vector $ω = (x_1, \dots, x_T)$:
$$ω_j(ω) = ω_j((x_1, \dots, x_T)) = x_j.$$
The function $P$ is defined for singleton sets of outcomes $ω$, each of which is a list of $T$ possible coin toss outcomes $ω_1(ω), \dots, ω_T(ω)$. Each $ω_j(ω)$ here corresponds to an outcome of a single toss. 
The definition of $U(ω)$ just says "count the number of ups in the $T$ tosses". Reading the definition of $P$ and comparing it to the binomial distribution makes it apparent that $p$ is supposed to be the probability of getting an up and $(1-p)$ the one of getting a down in each independent toss, making it a $B(T, p)$ distribution.
An event $A$ will be a collection of outcomes $ω$, each comprising $T$ trials. For example, the event that you get up in the first trial contains several $ω$: all possible combinations of $T$ trials that have up as the first outcome. That would be written like this: $\{ω \in \Omega : ω_1(ω) = u\}.$
The way to compute the probability of an event is given in the definition: just sum all probabilities corresponding to each outcome $ω$. In order to prove that $P$ is a probability it will be necessary to prove that $P(\Omega) = 1$.
Afterwards, the expectation of $ω_1$ can be computed by definition:
$$E_P(ω_1) = \sum_{ω \in \Omega} ω_1(ω) P({ω}) = \sum_{x_1, ..., x_T \in \{u, d\}} x_1 P(\{(x_1, \dots, x_T)\}).$$ 
The best way I can think of to evaluate this $T$-fold sum is to split it depending on the value of $x_1$:
$$\sum_{x_2, ..., x_T \in \{u, d\}} u \cdot P(\{(u, x_2, \dots, x_T)\}) + \sum_{x_2, ..., x_T \in \{u, d\}} d \cdot P(\{(d, x_2, \dots, x_T)\}).$$
Call these two sums $S_u$ and $S_d$, respectively. Now you can use what you know about $x_1$ in each to evaluate them. For example, for $S_u$ you know that you already have one $u$, so $P(\{(u, x_2, \dots, x_T)\}) = p \cdot p^\alpha\cdot (1-p)^\beta$, where $\alpha$ and $\beta$ are the number of ups and downs in $\{x_2, \dots, x_T\}$. 
The $p^\alpha\cdot (1-p)^\beta$ bit is actually the probability mass of a $B(T-1, p)$ distribution for outcomes $\{x_2, \dots, x_T\}$, so summing over all possible combinations of $T-1$ coin toss outcomes should give $1$ (good thing they asked us to prove it first for arbitrary $T$). It follows that $S_u = pu$ and, similarly, $S_d = (1-p)d$. 
