How find this minimum of the value $f(1)+f(2)+\cdots+f(100)$ Give the positive integer set $A=\{1,2,3,\cdots,100\}$, and define function
$f:A\to A$ and 
(1):such for any $1\le i\le 99$,have
$$|f(i)-f(i+1)|\le 1$$
(2): for any $1\le i\le 100$,have $$f(f(i))=100$$
find the minium of the value
$$f(1)+f(2)+f(3)+f(4)+\cdots+f(99)+f(100)$$
maye this is nice problem,and I want use $|f(i)-f(i+1)|\le 1$,But I can't it.Thank you
Now it is said this answer is 8350

(Edited)
My try:
$$
f(x)=\left\{ \begin{array}{ll}
67,& \mbox{if } 1\le x\le 34;\\
33+x,& \mbox{if } 34\le x \le 67;\\
100, &\mbox{if } 67\le x \le 100.\end{array} \right.
$$
Then $$f(1)+f(2)+...+f(100)=34\cdot 67 + (68+69+...+99) + 34\cdot 100 =2278 + 2672 + 3400 = \large{8350}.$$

My approach:
Denote $A_{100}$ is the set of $a\in A$, that $f(a)=100$.
If $A_{100}=A$, it isn't optimal solution ($f(x)\equiv 100$).
Then $A_{100}$ is "bounded" with the set $A_{99}$ (set of such $a\in A$, that $f(a)=99$).
Then (2) $\implies f(99)=100$.
But if $A_{99} \bigcup A_{100} = A$, then it isn't optimal solution too.
Next step: then $A_{99}$ is "bounded" with the set $A_{98}$ (set of such $a$ ...). Then (2) $\implies f(98)=100$.
And so on...
