Math Expression


Submit solution


Points:100 (partial)
Time limit:0.1s
C#0.1s
Java 91.0s
Memory limit:16M
C#32M
Java 932M
Author:

Tags
Math
Difficulty
Easy

You are given the following mathematical expression:

The sin(x) is a trigonometric function that returns the sine from the angle x (measured in radians).

The mod operator finds the remainder of division of one number by another.

Here are some examples for how the mod operator should work:

  • 5 mod 2 = 1
  • 5.99 mod 3 = 2
  • 6 mod 3 = 0

Your task is to write a computer program that calculates the result from the shown mathematical expression, depending on the values of the variables N, M and P.

Input

  • Read from the standard input

  • The input consists of exactly 3 lines. In each line you consequently enter the variables N, M and P.

  • The separator between the integer and the fractional part of the number is “.” (dot).

  • The number of digits that follow the decimal point will not be more than 6.

  • The input data will always be valid and in the format described. There is no need to check it explicitly.

Output

  • Print to the standard output

  • There must be only one line, showing the result from the mathematical expression.

  • The result must show exactly 6 digits after the “.” (decimal point).

Constraints

  • The numbers N, M and P are fractional numbers.
  • N, M and P will be between -10 000 000 and 10 000 000, inclusive.
  • The numbers M and P will always have values other than 0
  • It is guaranteed that none of the combinations of the numbers N, M and P will lead to dividing by zero.

Sample tests

Input

1
2
3

Output

-2.570352

Input

0.1234
1.2345
2.3456

Output

-3.596568

Input

0.123456
1.234567
2.345678

Output

-3.596421

Comments


  • 1
    plamen.hhh
     commented on Sept. 12, 2018

    На пръв поглед не е сложна, но не е и толкова лесна.


  • 4
    iordanbalt
     commented on April 11, 2018 edited

    На втория example ми изкарва -3.493887 а трябва да е -3.596568 всички са ми double не мога да разбера сигурно има някаква тънкост


    • 0
      jackojelev
       commented on July 23, 2018

      5.99 mod 3 = 2

      Ето къде е ключът от палатката!


    • 0
      stoyanoff.martin
       commented on April 30, 2018

      Откри ли проблема? И при мен се получава същото.


  • 0
    georgievgeorgi
     commented on March 24, 2018

    Между другото тайм-лимитът за Java8 e останал 0,1 сек. За Java9 e OK


  • 0
    markov.r
     commented on Jan. 29, 2018

    Да вдигнем малко тайм-лимита за Java?


    • 2
      doncho
       commented on Jan. 30, 2018

      Spreading love for Java - Done ;)


  • 0
    aleksandar_sb
     commented on Jan. 26, 2018

    The mathematical expression is a missing resource on GitHub...

    https://raw.githubusercontent.com/Minkov/dmoj-tasks/master/easy/11math/01mathexp/mathexp.png


    • 2
      doncho
       commented on Jan. 27, 2018

      Fixed!

      Благодаря ;)