const main = (stdin) => {
    const input = stdin.split("\n");
    const n = Number(input[0]);
  	
  	let r=n;
    let c=0;
    while(1) {
      	if(r.split('').every(e) => e === '7') break;
        r+=n;
        c++;
    }
  console.log(r);
 
}
 
main(require("fs").readFileSync("/dev/stdin", "utf8"));