# 0043. Iteration-2

Input file name: | iterate2.in |

Output file name: | iterate2.out |

Time limit: | 1 s |

Memory limit: | 64 megabytes |

Misha has written another program that solves a difficult problem using iterative method. He wants to estimate the number of iterations again.

This method also uses another sequence **z _{i}** as its part. This
sequence is constructed according the following rules.
The first number in sequence is a given non-zero real number

**z**. The subsequent numbers are calculated using formula . The method stops if the value of

_{0}**z**is negative. It is guaranteed there will be neither division by zero nor zero-valued

_{i}**z**before termination condition.

_{i}Write a program that evaluates the number of the first negative member of this sequence.

Input file

Input file consists of three numbers: **A**, **B** (**|A|, |B| ≤ 10 ^{9}**) and

**z**.

_{0}**z**is a real number with no more than 9 digits after decimal point. Also

_{0}**z**will not have more than 9 significant digits or exceed

_{0}**10**by its absolute value.

^{5}**A**and

**B**are integer numbers.

Output file

Write only one integer number **n** – the minimal **n** satisfying condition **z _{n}<0**.
If all numbers in the sequence will be positive, display

**-1**.

Examples:

iterate2.in | iterate2.out |
---|---|

1 -2 3 | 1 |

*Source: Petrozavodsk training camp, Summer 2002. Conclusive contest*

*Author: Andrew Lopatin, Nick Durov*

Discuss Submit a solution

Printable version