A - LIGHTOJ 1005 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%lld & %llu Submit Status
Description
A rook is a piece used in the game of chess which is played on a board of square grids. A rook can only move vertically or horizontally from its current position and two rooks attack each other if one is on the path of the other. In the following figure, the dark squares represent the reachable locations for rook R1 from its current position. The figure also shows that the rook R1 and R2 are in attacking positions where R1 and R3 are not. R2 andR3 are also in non-attacking positions.
Now, given two numbers n<喎?http://www.Bkjia.com/kf/ware/vc/" target="_blank" class="keylink">vc3Ryb25nPiBhbmQgPHN0cm9uZz5rPC9zdHJvbmc+LCB5b3VyIGpvYiBpcyB0byBkZXRlcm1pbmUgdGhlIG51bWJlciBvZiB3YXlzIG9uZSBjYW4gcHV0IDxzdHJvbmc+azwvc3Ryb25nPiByb29rcyBvbiBhbiA8c3Ryb25nPm4geCBuPC9zdHJvbmc+Y2hlc3Nib2FyZCBzbyB0aGF0IG5vIHR3byBvZiB0aGVtIGFyZSBpbiBhdHRhY2tpbmcgcG9zaXRpb25zLjwvcD4KCgoKPHA+SW5wdXQ8L3A+Cgo8cD5JbnB1dCBzdGFydHMgd2l0aCBhbiBpbnRlZ2VyIDxzdHJvbmc+VCAoodwgMzUwKTwvc3Ryb25nPiwgZGVub3RpbmcgdGhlIG51bWJlciBvZiB0ZXN0IGNhc2VzLjwvcD4KPHA+RWFjaCBjYXNlIGNvbnRhaW5zIHR3byBpbnRlZ2VycyA8c3Ryb25nPm4gKDEgodwgbiCh3CAzMCk8L3N0cm9uZz4gYW5kIDxzdHJvbmc+ayAoMCCh3CBrIKHcIG48c3VwPjI8L3N1cD4pPC9zdHJvbmc+LjwvcD4KCgoKPHA+T3V0cHV0PC9wPgoKPHA+Rm9yIGVhY2ggY2FzZSwgcHJpbnQgdGhlIGNhc2UgbnVtYmVyIGFuZCB0b3RhbCBudW1iZXIgb2Ygd2F5cyBvbmUgY2FuIHB1dCB0aGUgZ2l2ZW4gbnVtYmVyIG9mIHJvb2tzIG9uIGEgY2hlc3Nib2FyZCB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