Ergodic theorem