Mishka wants to buy some food in the nearby shop. Initially, he has ss burles on his card.

Mishka can perform the following operation any number of times (possibly, zero): choose some positive integer number 1≤x≤s1≤x≤s , buy food that costs exactly xx burles and obtain ⌊x10⌋⌊x10⌋ burles as a cashback (in other words, Mishka spends xx burles and obtains ⌊x10⌋⌊x10⌋ back). The operation ⌊ab⌋⌊ab⌋ means aa divided by bb rounded down.

It is guaranteed that you can always buy some food that costs xx for any possible value of xx .

Your task is to say the maximum number of burles Mishka can spend if he buys food optimally.

For example, if Mishka has s=19s=19 burles then the maximum number of burles he can spend is 2121 . Firstly, he can spend x=10x=10 burles, obtain 11 burle as a cashback. Now he has s=10s=10 burles, so can spend x=10x=10 burles, obtain 11 burle as a cashback and spend it too.

You have to answer tt independent test cases.

Input

The first line of the input contains one integer tt (1≤t≤1041≤t≤104 ) — the number of test cases.

The next tt lines describe test cases. Each test case is given on a separate line and consists of one integer ss (1≤s≤1091≤s≤109 ) — the number of burles Mishka initially has.

Output

For each test case print the answer on it — the maximum number of burles Mishka can spend if he buys food optimally.

Example
Input

 
6
1
10
19
9876
12345
1000000000
Output

 
1
11
21
10973
13716
1111111111
大意就是假设花出去x元,能返还x/10向下取整的钱数,问有ss元的话最多可以花出去多少。根据题意可以想到每次应该在返还钱数一定的情况下尽可能少的花,这样省下来的钱加上返还的钱花出去以后相比于原来有可能获得更多的返还。
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
long long ans=n;
int res=n;
while(res)
{
ans+=res/;
if(res>=)res=res%+res/;//剩下的钱满十元的话尽可能少花,即模10
else res/=;//剩下的钱不满十元的话直接花掉
}
cout<<ans<<endl;
}
}

最新文章

  1. Hibernate映射文件创建和删除触发器,存储过程等数据库对象
  2. FastDFS----recovery状态问题排查记录
  3. HTTP请求中的form data和request payload的区别
  4. Raft
  5. javax.xml.ws.webserviceexception class do not have a property of the name
  6. OpenGL的glViewport视口变换函数详解[转]
  7. Java对ArrayList进行排序
  8. MVC的项目使用html编辑器UEditorMINI
  9. opencv 彩色图像亮度、对比度调节 直方图均衡化
  10. 【转】iOS开发者账号和证书
  11. hibernate详解
  12. c#(winform,webform通用)利用npoi将xls文件复制为xlsx文件(excel的修改,保存,包括excel2003-office2007+的处理)
  13. Bootstrap3级联多选下拉框
  14. 推荐前端开发手机调试打印神器console.log()
  15. 前端面试:谈谈 JS 垃圾回收机制
  16. python3 sys.path
  17. canvas实现点连线动画
  18. BZOJ4124 : [Baltic2015]Tug of war
  19. C#在Winform程序中显示QQ在线状态
  20. TypeScript设计模式之装饰、代理

热门文章

  1. html2canvas.js 图片不显示
  2. pwnable.kr-bof-Writeup
  3. Aggregate 聚合用法
  4. XMOS发布集单片机,AI,FPGA,DSP于一身的跨界处理器完全体xcore.ai,致力于AIOT,售价1美元起步
  5. 02hive数据类型
  6. Python学习之面向对象进阶
  7. Git创建和删除标签
  8. 让 typora和word一样好用
  9. JVM 初始
  10. Sudo临时提权配置