Problem description

SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The probability of shooting the target each time is  for SmallR while  for Zanoes. The one who shoots in the target first should be the winner.

Output the probability that SmallR will win the match.

Input

A single line contains four integers .

Output

Print a single real number, the probability that SmallR will win the match.

The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6.

Examples

Input

1 2 1 2

Output

0.666666666667
解题思路:等比数列极限求和。推导公式如下:

AC代码:
 #include <bits/stdc++.h>
using namespace std;
int main(){
double a,b,c,d;
cin>>a>>b>>c>>d;
cout<<setiosflags(ios::fixed)<<setprecision()<<((a/b)*(/(-(-a/b)*(-c/d))))<<endl;
//printf("%.12f\n",(a/b)*(1/(1-(1-a/b)*(1-c/d))));
return ;
}

最新文章

  1. oracle调用JAVA类的方法
  2. ASP.NET WebAPi(selfhost)之文件同步或异步上传
  3. SQL简单语法
  4. ng-repeat产生的对象会带有$$hashkey属性处理方法
  5. coursera机器学习-logistic回归,正则化
  6. php 分享两种给图片加水印的方法
  7. HelloWorld和数据绑定
  8. POJ2723-Get Luffy Out(2-SAT)
  9. 新API:AttachThreadInput
  10. Android APK反编译具体解释(附图)
  11. asp.net mvc Ajax服务器跳转
  12. js 数组方法总结
  13. 兼容IE6/7/8/9的css3插件
  14. 2019-02-20 在PyPI测试平台发布Python包
  15. Information Retrieval 倒排索引 学习笔记
  16. Vue.js入门系列教程(二)
  17. java:模拟队列操作
  18. XuLA/XuLA2
  19. Android之GPS定位详解
  20. notifyDataSetChanged() 动态更新ListView

热门文章

  1. 《The Swift Programming Language》的笔记-第27页
  2. Android自己定义之TextView跑马灯的监听
  3. 在 Ubuntu 开启 GO 程序编译之旅
  4. 在线生成32位和16位大小写MD5密文
  5. 操作系统学习笔记:I/O输入系统
  6. Win7下安装iMac系统
  7. HttpClient服务端发送http请求
  8. 设计模式-(6)适配器 (swift版)
  9. The android gradle plugin version 2.3.0-beta2 is too old, please update to the latest version.
  10. c语言和oc对比