Problem description

Unary is a minimalistic Brainfuck dialect in which programs are written using only one token.

Brainfuck programs use 8 commands: "+", "-", "[", "]", "<", ">", "." and "," (their meaning is not important for the purposes of this problem). Unary programs are created from Brainfuck programs using the following algorithm. First, replace each command with a corresponding binary code, using the following conversion table:

  • ">"  →  1000,
  • "<"  →  1001,
  • "+"  →  1010,
  • "-"  →  1011,
  • "."  →  1100,
  • ","  →  1101,
  • "["  →  1110,
  • "]"  →  1111.

Next, concatenate the resulting binary codes into one binary number in the same order as in the program. Finally, write this number using unary numeral system — this is the Unary program equivalent to the original Brainfuck one.

You are given a Brainfuck program. Your task is to calculate the size of the equivalent Unary program, and print it modulo 1000003 (106 + 3).

Input

The input will consist of a single line p which gives a Brainfuck program. String pwill contain between 1 and 100 characters, inclusive. Each character of p will be "+", "-", "[", "]", "<", ">", "." or ",".

Output

Output the size of the equivalent Unary program modulo 1000003 (106 + 3).

Examples

Input

,.

Output

220

Input

++++[>,.<-]

Output

61425

Note

To write a number n in unary numeral system, one simply has to write 1 n times. For example, 5 written in unary system will be 11111.

In the first example replacing Brainfuck commands with binary code will give us 1101 1100. After we concatenate the codes, we'll get 11011100 in binary system, or 220 in decimal. That's exactly the number of tokens in the equivalent Unary program.

解题思路:有8个字符,每个字符对应一个4位数的二进制码。将输入的字符串中每个字符转化成对应的二进制码后就得到一长串的二进制数,要求输出它的10进制值(注意模拟过程中要取模,避免数据溢出)。简单模拟一下二进制运算,水过。

AC代码:

 #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
const int mod = 1e6+;
int main(){
map<char,string> mp;string obj="";char str[];LL ans=,base=;
mp['>']="";mp['<']="";//键值对
mp['+']="";mp['-']="";
mp['.']="";mp[',']="";
mp['[']="";mp[']']="";
cin>>str;
for(int i=;str[i]!='\0';++i)obj+=mp[str[i]];//转化成对应的二进制码
for(int i=obj.size()-;i>=;--i){//简单模拟二进制运算
if(obj[i]=='')ans=(ans+base)%mod;
base=*base%mod;
}
cout<<ans<<endl;
return ;
}

最新文章

  1. ABP的语言切换
  2. [Node.js] 对称加密、公钥加密和RSA
  3. mysql-now()读取当日日期-格式化
  4. 常用RSS订阅地址
  5. LINQ inner join
  6. Laravel 5 基础(十二)- 认证
  7. hdu 1540 Tunnel Warfare (区间线段树(模板))
  8. 8-18-Exercise
  9. js基本框架
  10. Linux网络常用头文件说明
  11. Loadrunner之文件的上传(八)
  12. selenium,html高宽设置成了0,会影响元素可见性,怎么手动修改某个元素的高宽?
  13. Java面向对象 继承(下)
  14. BZOJ_3438_小M的作物_最小割
  15. VsCode 使用专用编程字体FiraCode
  16. [NOIP2017赛前复习第二期]复赛考试技巧与模版-普及组
  17. SpringBoot学习笔记1
  18. [Be a Coding Plasterer] Components 1:get Basic Things
  19. laravel自定义门面
  20. C/C++ 全局变量的访问

热门文章

  1. Java_Web之俱乐部会员信息管理系统
  2. 三种“BIOS设置光驱第一启动的图解”
  3. 下拉框处理(select)
  4. Call to undefined function openssl_decrypt()
  5. BZOJ 3744 Gty的妹子序列 (分块+树状数组+主席树)
  6. Problem 19
  7. Python之scrapy linkextractors使用错误
  8. 1.Eclipse创建普通java工程
  9. 如何使用qtp12 utf进行功能测试
  10. springboot整合mybatis统一配置bean的别名