'use strict';

function main(arg) {
    let s = parseInt(arg);
    let memo  = new Set();
    let cnt = 0;
    
    memo.add(s);
    
    while(true) {
        if(s % 2 === 0) {
            s = s / 2;
            memo.add(s);
        } else {
            s = (s * 3) + 1;
            memo.add(s);
        }
        
        if(memo.has(s)) {
            console.log(s);
            break;
        }
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));