#include <bits/stdc++.h>
using namespace std;
int a[200];
int n = 0;
int main() {
  char c;
  while (scanf("%c", &c) > 0 && (c >= '0') && (c <= '9')) a[++n] = c - '0';
  int m = 0;
  for (int i = 1; i <= n; i++) m = (2 * m + a[i]) % 1000000007;
  for (int i = 1; i <= n - 1; i++) m = (2 * m) % 1000000007;
  cout << m;
  return 0;
}
