B. Mushroom Scientists
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

As you very well know, the whole Universe traditionally uses three-dimensional Cartesian system of coordinates. In this system each point corresponds to three real coordinates (x, y, z). In this coordinate system, the distance between the center of the Universe and the point is calculated by the following formula: . Mushroom scientists that work for the Great Mushroom King think that the Universe isn't exactly right and the distance from the center of the Universe to a point equals xa·yb·zc.

To test the metric of mushroom scientists, the usual scientists offered them a task: find such x, y, z (0 ≤ x, y, zx + y + z ≤ S), that the distance between the center of the Universe and the point (x, y, z) is maximum possible in the metric of mushroom scientists. The mushroom scientists aren't good at maths, so they commissioned you to do the task.

Note that in this problem, it is considered that 00 = 1.

Input

The first line contains a single integer S (1 ≤ S ≤ 103) — the maximum sum of coordinates of the sought point.

The second line contains three space-separated integers abc (0 ≤ a, b, c ≤ 103) — the numbers that describe the metric of mushroom scientists.

Output

Print three real numbers — the coordinates of the point that reaches maximum value in the metrics of mushroom scientists. If there are multiple answers, print any of them that meets the limitations.

A natural logarithm of distance from the center of the Universe to the given point in the metric of mushroom scientists shouldn't differ from the natural logarithm of the maximum distance by more than 10 - 6. We think that ln(0) =  - ∞.

Sample test(s)
input
3
1 1 1
output
1.0 1.0 1.0
input
3
2 0 0
output
3.0 0.0 0.0

SL: 

1 // by caonima

 2 // hehe
 3 #include <bits/stdc++.h>
 4 using namespace std;
 5 const int MAX= 1e5+;
 6 int main() {
 7     double S,a,b,c;
 8     double x,y,z;
 9     while(scanf("%lf",&S)==) {
         scanf("%lf %lf %lf",&a,&b,&c);
         if(a==&&b==&&c==) printf("0.0 0.0 0.0\n");
         else {
             x=a*S/(a+b+c); y=b*S/(a+b+c); z=c*S/(a+b+c);
             printf("%.15lf %.15lf %.15lf\n",x,y,z);
         }
     }
     return ;
 }

最新文章

  1. JS定时刷新页面及跳转页面
  2. python 代码片段21
  3. 使用audio标签播放音频文件
  4. 使用 CSS 去掉 iPhone 网页上按钮的超大圆角默认样式
  5. 用JS编写日历的简单思路
  6. centos 如何用 rsyslog 搭建本地日志服务
  7. kettle Add XML 、 XML Join
  8. careercup-栈与队列 3.5
  9. WPF笔记(2.3 StackPanel)——Layout
  10. JavaScript高级内容:原型链、继承、执行上下文、作用域链、闭包
  11. 基于java:读写一个英文的txt文件,记录单词个数,并输出十个出现最多的单词及出现的个数;
  12. 爬虫day 04_01(爬百度页面)
  13. 网站开发进阶(四)Tomcat Server处理一个http请求的过程
  14. 解决python编码问题
  15. dbForge Studio for MySQL V8.0 Enterprise
  16. php将用户信息提交到表单并且以txt文档打印出来
  17. Android Studio打包程序时出现transformClassesWithDexForRelease错误
  18. RestTemplate的使用
  19. 利用 SPL 快速实现 Observer 设计模式
  20. HDU - 5157 :Harry and magic string (回文树,求多少对不相交的回文串)

热门文章

  1. 0623-TP框架整理一(下载、入口文件、路由、创建控制器、调用模板、系统常量、命名空间)
  2. Python机器学习算法 — 支持向量机(SVM)
  3. [Swift通天遁地]一、超级工具-(6)通过JavaScript(脚本)代码调用设备的源生程序
  4. 汇编程序49:实验14 访问CMOS RAM(显示系统时间)
  5. jQuery——表单应用(3)
  6. ASP.Net 知识点总结(五)
  7. hdu6195 cable cable cable
  8. linux学习之路4 系统目录架构
  9. 数学 FZU 2074 Number of methods
  10. mysqldump使用笔记