Problem description

Little girl Tanya is learning how to decrease a number by one, but she does it wrong with a number consisting of two or more digits. Tanya subtracts one from a number by the following algorithm:

  • if the last digit of the number is non-zero, she decreases the number by one;
  • if the last digit of the number is zero, she divides the number by 10 (i.e. removes the last digit).

You are given an integer number n. Tanya will subtract one from it k times. Your task is to print the result after all k subtractions.

It is guaranteed that the result will be positive integer number.

Input

The first line of the input contains two integer numbers n and k (2≤n≤10^9, 1≤k≤50) — the number from which Tanya will subtract and the number of subtractions correspondingly.

Output

Print one integer number — the result of the decreasing n by one k times.

It is guaranteed that the result will be positive integer number.

Examples

Input

512 4

Output

50

Input

1000000000 9

Output

1

Note

The first example corresponds to the following sequence: 512→511→510→51→50512→511→510→51→50.

解题思路:题目的意思就是给一个数n和要求执行k次操作:如果尾数是0,那么n/=10;否则就n-=1;简单模拟即可!

AC代码:

 #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k;
cin>>n>>k;
for(int i=;i<=k;++i){
if(n%)n-=;
else n/=;
}
cout<<n<<endl;
return ;
}

最新文章

  1. iOS之数据解析时&lt;null&gt;的处理
  2. ELK日志管理之——logstash部署
  3. 剑指offer系列58---把数组排成最小的数
  4. 【CSS3】---last-of-type选择器+nth-last-of-type(n)选择器
  5. 这是html5中WebGL的演示
  6. 《Dive into Python》Chapter 2 and Chapter 3 笔记
  7. [转]让ORACLE LIKE 时不区分大小写
  8. 编程中的 if ()else() 语句
  9. 四舍六入五成双银行家算法的 PHP和Javascript实现
  10. 关于windows service不能访问网络共享盘(NetWork Drive)的解决方案
  11. 去除移动端点击事件出现的背景框 tap-highlight-color
  12. Mysql修改id自增值
  13. 在0~N个数字中,取指定个数的不重复数字,要求这些数字的和为指定值,求所有结果
  14. Nethogs - 网络流量监控工具
  15. Customer Form Issue: Automatic Matching Rule Set Defaults Value AutoRuleSet-1
  16. bzoj 4770 图样 - 概率与期望 - 动态规划
  17. 一个linux 驱动升级的小问题记录
  18. LeetCode算法题-Intersection of Two Linked Lists(Java实现)
  19. 爬虫 写入文件时遇到gbk编码错误
  20. The 2018 ACM-ICPC Asia Beijing Regional Contest

热门文章

  1. sysbench基准测试工具
  2. Linux之网络ping(unknown host)故障及yum no more mirrors to try
  3. Huawei-R&amp;S-网络工程师实验笔记20190608-VLAN划分基础(基于端口、MAC地址、子网地址、协议)
  4. ActiveMQ学习总结(5)——Java消息服务JMS详解
  5. 利用Linux中的crontab实现分布式项目定时任务
  6. NYIST 760 See LCS again
  7. fzu 2124
  8. 刷新PHP缓冲区
  9. nyoj_212_K尾相等数_210402272239
  10. 利用Calendar类测试电脑运行速度