This is the simple version of Shortest Code series. If you need some challenges, please try the [challenge version](http://www.codewars.com/kata/570f45fab29c705d330004e3)

## Task:

There is a rectangular land and we need to plant trees on the edges of that land.

I will give you three parameters:

```width``` and ```length```, two integers > 1 that represents the land's width and length;

```gaps```, an integer >= 0, that is the distance between two trees.

Return how many trees have to be planted, if you can't achieve a symmetrical layout(see Example 3) then return 0. 
    
### Example: 

```
    
    Example1:
    width=3, length=3, gaps=1       o - o
    we can plant 4 trees            -   -
    sc(3,3,1)=4                     o - o
    
    Example2:
    width=3, length=3, gaps=3       o - -
    we can plant 2 trees            -   -
    sc(3,3,3)=2                     - - o
    
    Example3:
    width=3, length=3, gaps=2       o - -
    if we plant 2 trees, some       x   o
    gaps of two trees will >2       x x x
                                    
    if we plant 3 trees, some       o - -
    gaps of two trees will <2       x   o
    so we can not finish it         o - -
    sc(3,3,2)=0                         
    
    Example4:
    width=7, length=7, gaps=3       o - - - o - -
    we can plant 6 trees            -           -
    sc(3,3,3)=6                     -           o
                                    -           -
                                    o           -
                                    -           -
                                    - - o - - - o
    
    some corner case:
    
    Example5:
    width=3, length=3, gaps=0       o o o
    we can plant 8 trees            o   o
    sc(3,3,0)=8                     o o o
    
    Example6:
    width=3, length=3, gaps=10      o 1 2
    in this case, the max gaps      1   3
    of two trees is 3               2 3 o
    gaps=10 can not finished
    so sc(3,3,10)=0
                                    
```
    
### Series:
 - [Bug in Apple](http://www.codewars.com/kata/56fe97b3cc08ca00e4000dc9)
 - [Father and Son](http://www.codewars.com/kata/56fe9a0c11086cd842000008)
 - [Jumping Dutch act](http://www.codewars.com/kata/570bcd9715944a2c8e000009)
 - [Planting Trees](http://www.codewars.com/kata/5710443187a36a9cee0005a1)
 - [Give me the equation](http://www.codewars.com/kata/56fe9b65cc08cafbc5000de3)
 - [Find the murderer](http://www.codewars.com/kata/570f3fc5b29c702c5500043e)
 - [Reading a Book](http://www.codewars.com/kata/570ca6a520c69f39dd0016d4)
 - [Eat watermelon](http://www.codewars.com/kata/570df12ce6e9282a7d000947)
 - [Special factor](http://www.codewars.com/kata/570e5d0b93214b1a950015b1)
 - [Guess the Hat](http://www.codewars.com/kata/570ef7a834e61306da00035b)
 - [Symmetric Sort](http://www.codewars.com/kata/5705aeb041e5befba20010ba)
 - [Are they symmetrical?](http://www.codewars.com/kata/5705cc3161944b10fd0004ba)
 - [Max Value](http://www.codewars.com/kata/570771871df89cf59b000742)
 - [Trypophobia](http://www.codewars.com/kata/56fe9ffbc25bf33fff000f7c)
 - [Virus in Apple](http://www.codewars.com/kata/5700af83d1acef83fd000048)
 - [Balance Attraction](http://www.codewars.com/kata/57033601e55d30d3e0000633)
 - [Remove screws I](http://www.codewars.com/kata/5710a50d336aed828100055a)
 - [Remove screws II](http://www.codewars.com/kata/5710a8fd336aed00d9000594)
 - [Regular expression compression](http://www.codewars.com/kata/570bae4b0237999e940016e9)
 - [Collatz Array(Split or merge)](http://www.codewars.com/kata/56fe9d579b7bb6b027000001)
 - [Tidy up the room](http://www.codewars.com/kata/5703ace6e55d30d3e0001029)
 - [Waiting for a Bus](http://www.codewars.com/kata/57070eff924f343280000015)

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

def _disabled_input(*args, **kwargs):
    raise RuntimeError("input() is disabled in callable mode")
builtins.input = _disabled_input

ns = {"__name__": "__judge__"}  # prevent if __name__ == "__main__" blocks
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'def sc(width,length,gaps):\n    places = width*2 + (length-2)*2\n    if gaps == 0:\n        return places\n    div, mod = divmod(places, gaps+1)\n    if mod:\n        return 0\n    return div'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

_target = None
_fn_name = 'sc'
if _fn_name:
    if "Solution" in ns:
        try:
            _obj = ns["Solution"]()
            if hasattr(_obj, _fn_name):
                _target = getattr(_obj, _fn_name)
        except Exception:
            _target = None
    if _target is None and _fn_name in ns and callable(ns[_fn_name]):
        _target = ns[_fn_name]
# Fallback: if there's exactly one user-defined function, use it
if _target is None:
    _cands = [v for k, v in ns.items() if callable(v) and getattr(v, "__module__", "") in ("__judge__", "__main__")]
    _user_funcs = [c for c in _cands if getattr(c, "__name__", "").startswith("_") is False]
    if len(_user_funcs) == 1:
        _target = _user_funcs[0]
if _target is None:
    raise RuntimeError(f"Could not resolve callable '{_fn_name}'")

_raw = sys.stdin.read().strip()
if _raw:
    _parsed = json.loads(_raw)
    if isinstance(_parsed, dict):
        _kwargs = _parsed.get("kwargs", {})
        _args = _parsed.get("args", [])
    else:
        _args, _kwargs = _parsed, {}
else:
    _args, _kwargs = [], {}
if not isinstance(_args, (list, tuple)):
    _args = [_args]
_res = _target(*_args, **_kwargs)
try:
    sys.stdout.write(repr(_res) + "\n")
except Exception:
    pass

```

Measured memory_bytes: 5426