Codeforces Round 299 (Div. 2)
B
Tavas and SaDDas
Codeforces
1100
原题
← AC →
翻译中…

Once again Tavas started eating coffee mix without water! Keione told him that it smells awful, but he didn't stop doing that. That's why Keione told his smart friend, SaDDas to punish him! SaDDas took Tavas' headphones and told him: "If you solve the following problem, I'll return it to you."

翻译中…

image

翻译中…

The problem is:

翻译中…

You are given a lucky number $*n*$. Lucky numbers are the positive integers whose decimal representations contain only the lucky digits 4 and 7. For example, numbers 47, 744, 4 are lucky and 5, 17, 467 are not.

翻译中…

If we sort all lucky numbers in increasing order, what's the 1-based index of $*n*$?

翻译中…

Tavas is not as smart as SaDDas, so he asked you to do him a favor and solve this problem so he can have his headphones back.

翻译中…

Input

翻译中…

The first and only line of input contains a lucky number $*n*$ ($1 ≤ *n* ≤ 10^{9}$).

翻译中…

Output

翻译中…

Print the index of $*n*$ among all lucky numbers.

翻译中…

样例

Input #1
4
Output #1
1
InputCopy OutputCopy
Input #2
7
Output #2
2
InputCopy OutputCopy
Input #3
77
Output #3
6
InputCopy OutputCopy
题目信息
题号
535B
时间限制
1 s
内存限制
256 MB
标签
位运算
暴力
组合数学
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。