We have a function $F:\{0, \ldots, n-1\} \rightarrow\{0, \ldots, m-1\} .$ We know that, for $0 \leq x, y \leq n-1, F((x+y) \bmod n)=(F(x)+F(y)) \bmod m$. The only way we have for evaluating $F$ is to use a lookup table that stores the values of $F$. Unfortunately, an Evil Adversary has changed the value of $1 / 5$ of the table entries when we were not looking.
Describe a simple randomized algorithm that, given an input $z$, outputs a value that equals $F(z)$ with probability at least $1 / 2$. Your algorithm should work for every value of $z_{*}$ regardless of what values the Adversary changed. Your algorithm should use as few lookups and as little computation as possible.
Suppose I allow you to repeat your initial algorithm three times. What should you do in this case, and what is the probability that your enhanced algorithm retums the correct answer?