function perimeter(num) {
let a = 1,
b = 0,
temp,
arr = [];
while (num >= 0) {
temp = a;
a = a + b;
b = temp;
arr.push(b);
num--;
}
return arr.map(e => e * 4).reduce((a, b) => a + b);
}
console.log(perimeter(5)); // should be 80
console.log(perimeter(7)); // should be 216
console.log(perimeter(20)); // should be 114624
console.log(perimeter(30)); // should be 14098308