using System;
using System.Linq;
using System.Collections.Generic;
public class Test
{
static IEnumerable<T> Join<T>(T separator, IEnumerable<T> items) {
bool first = true;
foreach (var item in items) {
if (!first) {
yield return separator;
} else {
first = false;
}
yield return item;
}
}
public static void Main()
{
List<int> list = new List<int> {1, 2, 3, 4, 5};
foreach (var x in Join(-1, list)) {
Console.WriteLine(x);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uTGlucTsKdXNpbmcgU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWM7CgpwdWJsaWMgY2xhc3MgVGVzdAp7CglzdGF0aWMgSUVudW1lcmFibGU8VD4gSm9pbjxUPihUIHNlcGFyYXRvciwgSUVudW1lcmFibGU8VD4gaXRlbXMpIHsKCQlib29sIGZpcnN0ID0gdHJ1ZTsKCQlmb3JlYWNoICh2YXIgaXRlbSBpbiBpdGVtcykgewoJCQlpZiAoIWZpcnN0KSB7CgkJCQl5aWVsZCByZXR1cm4gc2VwYXJhdG9yOwoJCQl9IGVsc2UgewoJCQkJZmlyc3QgPSBmYWxzZTsKCQkJfQoJCQl5aWVsZCByZXR1cm4gaXRlbTsKCQl9Cgl9CglwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpCgl7CgkJTGlzdDxpbnQ+IGxpc3QgPSBuZXcgTGlzdDxpbnQ+IHsxLCAyLCAzLCA0LCA1fTsKCQlmb3JlYWNoICh2YXIgeCBpbiBKb2luKC0xLCBsaXN0KSkgewoJCQlDb25zb2xlLldyaXRlTGluZSh4KTsKCQl9Cgl9Cn0=