#include <stdio.h> int main() { char c; int n=0; while (scanf("%c",&c),c!='\n') n=7*n+((c>='6')?c-'0'-1:c-'0'); printf("%d\n",n); system("pause"); }