#include "bits/stdc++.h"

using namespace std;
#define ll long long
#define endl '\n'
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i,a,b) for(int i=int(a);i<int(b);i++)
#define pb push_back
#define all(x) (x).begin(),(x).end()
int mod=1e9+7;
int mod2=998244353;
const int INF=1e9;

signed main(){
    string l;
    cin>>l;
    vector<vector<ll> > dp(2,vector<ll>(l.size()+1,0));
    dp[0][0]=1;
    rep(i,l.size()){
        dp[1][i+1]+=(dp[1][i]*3)%mod;
        dp[1][i+1]%=mod;
        if(l[i]=='0'){
            dp[0][i+1]+=dp[0][i];
        }else{
            dp[1][i+1]+=dp[0][i];
            dp[0][i+1]+=(dp[0][i]*2)%mod;
        }
        dp[0][i+1]%=mod;
        dp[1][i+1]%=mod;
    }
    cout<<(dp[0][l.size()]+dp[1][l.size()])%mod<<endl;
}

// `.`..`(WNNNNNNMNWWWH9rttwgHM8OtttwwVtttrrtrttrw0rtrtwrrrtrZUAOOrrrXWppHMHyZHpWHMHMkWWVHMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
// `.`.`..`(WMNMHfWH9ZtrtAdNM8ttttOwVtrrtrrtrrrrrdrrttrZkOrrrrrrXWyrtrrZWWWWMmwXWppWHHMmWHkWMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
// .`.```_..(HMfWH9OtttwXWHBrttrOw0rttrOvrrrtrZrrRrtrrrtZHwrrrrrwwZHyrrrrZWWpWMmwWppkWHHMkHNkVWMNNNNN#NN#NN#NN#NN#NN#NN#NN#NN#NN#NNNN
// .``.. ..HNfWW9wtrrOdWHM0trttOdSrtrtwwrtrtrw0twSrtOrrrrZHwtrrrrrXwdWwrrrrXHppWNkXWpkvWH@MkHMHkWMMNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN
// `.`. -jMWWXXwtrttO0d@BrtrttwXVrtrrwVrrrtrtXrrd0rrXrrrrrZWyrrrrrrZXwWyZOrrvWWpWMkZHb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WOlllllldW$..?!     `     ` ?@MMHHMM#NMMmMkXXWkHuzuzuWNHSXHHHuuXNSWuzuuzuzuzuWkHNgMkkkMHSuWkqmqHHMNNK
// WHMkvvrvrXHHMppHHHMNMTN_``` 4kWOz====vXP` `   `        ``.HggmgM@MH###NKkkuXWHzzuXHHMzdMHHuzWNXKzuuzuzuzuuHkHHNMkkHHBuzWkHHHHuHMMM
// WHHNzvvrvwHMMppHMMMM>.#L`````?kyy====?0S``  `     ` ``...dmqqqmmHHHMMM#WRSzuzWHuzXHq#uWHHHzuWHXKzuzzuzuzuXHkHWMNkWM#uzuWHHHHSuuWM#
// WM@MkwvvrzXMMHpgHMMM[.MN.`````(HXy1???zd.``  `  `   ` dHkkqkkqkHHHHHHMMWWXzzuzwWwXHHKXMkHHuXMRXSuuuzuuzuzXHkHdHHWHHXuuwWHqHHuXzXWM
// XHHMNyrvvwdW@HpHWMHML MM[`  ` `.4kGz<<>Or```  `      `dWpbbbbbHMMbbbHHMXXuzzuzuzXWHHSXMkHHuXMSXuzzuzzuzuzWkkHWMHMSwuzzXHkHHXuzuWd#
// dHHH@NyzwwwWHMHHWMMMR dW]`` ` ```(HZx<<<4.```` `` ``  OZppfppppWfpWpK9NKXuuzuuzuXWHHudMqNHXWNuHuzzuzuzuzuHkHXMMBuuuzuuWkHHUuuuXSMS
// wWHMMMMkwwvdNpHHHM#MH-jWP``` `` ```7kI<:<h.``````` `` ,2OWVVyVVyWWWWIdMKWzuuuzzuXHHSwHHHHKXHHXSuuzuuzuzuXHHHXMXuuuuuuXHHHuzuuXSX#X
// wdWHMMMMmwXwHbpMNHMM@b.hb``````````` 7x1_(>_```````````(x7UUUV0XwvCI1dMWKXuzzuzuWHHudMkgkWbMSXuzzzuzzuzuWkHSW#zXwXuXXWHHuuXXuWXWSX
// vvXWHMMHWNkvWHbbMWMMMN_JF.```` `` `````?1_(_.`.`........(<777=<<<><<+dMXUuzuuuuWWMRwMHWMkWHHXSuuzuzuzzuXqHHXMHUXuXXHHHSuuwuXWud8uH
// mzzXWH#zHbHkXNbbWMMMMD~(_``````````````` .~_`.``.`.`.....___(<~(<<(<<dHkkuuuuuXkHHuWMkHkkkHSXXzuuzuuuuzXHHSd#uuXXWHHXuuuZuXSuqHudS
// UHzzXWSXXWbbHHHbWHMH#<~...```` ``````````````.```.` -_____<~~_<_<~~(jMWSuzuzuXWHMHXMHHHkkH#XSuzzuzuzuzuKkHXMQkWHHWUXuXXUuXUuXHuXBu
// .(Smd8wSvXbbbbHHHWHW3___.``````` `` ``````.```.```.`...._.._~~..~_~~(#WuzuuzXXkHMqMMHMkkkMUXuXzuuwuuzuXkHSWMWUUuuuXXUUuXHXXWSuXHXu
// .. JKwSvwzWkkkkHHHH5~~..```````````````````.```.````````.` .........dWSuuzzzdkHMW@MHMkkkHHXXuzuuXSuzuuWWHd#uuuXXkWSuXXWUXXHUXWHuuu
// .`(HXSzzzzwWbkWHNHr_...``````````````````.```````.```````.`.`..`.-.(HKuzzuuwHHMNMHHMkkkHHuZuuzuuXuuuuXkHWMHHHUUuXXXWHXXHHUuXW8uuuu
// .-MXWwzzzuzXkHHMHHN-.`````````` ````````````.`.````.``.```.`.`....-dXUXuzuXHWHMMHHBWHMMMSZuzuuzXXzuuXHHMHMHkHHHHHHHWHHSuXkHWSuuuuX
// (#XKzzzzzuzuWHHkWHHp ``.````````````````````````.````````.....-((-(NSXuzzXHW@D:~`(/1- .kXuzuuzXSuuzXXkHWMHHHHHHHHMWuuuQXUXWuuuXuXH
// MXWzuzzzzzuXHHbHNMMMt`.```````````````````````````.`.` ..-J7"!``  XKuzzuXHHM9;/<-.J-u!JXXuuzuXWuuuuXHHH#WMNHmkkkuXXkWUXXWXXuuuXqHH
// XWzzzzuzzwXHHHH#"````<.````````````````````.``.`...-c"7``` ` `  `(BzuuuXmHH8<!(- ?_!`jWUuzuuuWuuuzXWHNH> ..7WHHqHmQkWWXXuuuuuXWqHH
// SwuzzzXuwXHNHY``  ``  <,`.`````````````` `` ..J7=``` ` ` `` ````.#zuzXXHHH$~`` ```(_(HSuuuzuXSuzuuXHHWCi(` ._ ?WggHHHHWkkkkWHHHHMH
// zzzuzuzwWHMY!`  `   ` `(&.```````````` ..J7^ `` `  `  `   ` `. .HXuuXWHW#!` ` ```` (WUuzzuXXSzuuudHHXY$. : (..``.THHkqkHHHgHHMHkkk
// zzzzzzXHWK``  ` `` ` ` ` TJ.``````..J7=````    ` `  ` ` `` ` `.8zuXXHHW=`   ``  ..(XSuuuuuXWuuuuXHWH5~~` .`_?_,-``.TMMMMMMHkkqqHHH
// zzuuzdHHkN ` ` `  ``  ` ``(Wm,.(J7!```  `  ``` `` `` ` ` ``` .SzuXWHHY `` .._~<~~(dSuuuzzXHuuuuXHWHD::?C._.( -`(!_1 ,WHqHHHmqHHHHN
// zuzXXHHkHM;`  ` ` ` ``  ` .;jY= ` .``_``  `  `  `  ` `` ` `.dXuXWm@^ .._~_.~~~~~(d0uuzuuXHUuuuXHWH5:::::::_.<&._4r?_.;WMMM@MMY"<!`
// zzXHHHHMHMb`` `` ` `` `` .J!  ` ..`_~  ` ` ` `` `   `  ``.JXXXHY! .__.....~.~~~-d0wuzuXXHSuuuXWWH$::::;:::;:+- ~`(.i +HqHHkkHL..`.
// XWHHHMMHMHM; `  ` `   ` ._`` ...(:.=_` `  ` `  ` ```` .-dVT7^``````......~~~~~_jWuuuuuXHSuzuXHHH3<;:::::;;j<+z ``` -dHNkkMqkkN..``
// HHHMMHHHHNMN.``  ` `  `!`z(. ~..~ ! . ` ``  ` ` ` ..gHr``````````........~~~~_jWuuuuuXkSuuuXHWHC:;::;;:::+v>:((J<!(WHHMkkHNqkM;`..
// HMMkkHHHHM9?b ``  ` `  ``     .``. `  ` ` `  ``` 4HkkkH,  ``````.`......~~~~_+KuuuzuXHSuuuXHHK<(::::::<;<J+g9>::;<  .4NkkqMHqH]..`
// MHkHHHMM$<<:?L` `` ` `  ` ``.` `  !``  ` ` ` `  ` ?HbkkHx``````.`..`...~~~~_jKuuuuuXHSuuuqMHD<:<;:<++ddNMB3:;::;:<` `,HkkqH@HH].``
// kkHHkHY``` (;?h`` ` ` ``  ````  ` ` ` ` ` ` ` ` ```.4XWbHx```..`......~~~~_gKuuuuXWH0uuuXHH3:;++1z<jgMB3<::::::::~` `jMkqkHMHHF.`.
// kHHHH=` . ` _<?L  ` `  ` `    `  ` ` ` ` ` ` `  ` `  ?kwWHp .`.......~_~~(dKuuuuXWHUuuXWH9++z1<;+jWB3::::;;;::;:;_`` MNkqkqMNMF..`
// HHk@!.  ` ` ` ~?L  ` ` `` ` `` `` ` ` ` `  ` ` `   `  -WuXHh..`.....~~~~(dWuuuXXkHUuuXHH9>:<:++YY<:;::::;:::::;:::+.``?HHkHHHM>`.`


Measured memory_bytes: 2816